|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Bug reports and pull requests are welcome. Two external contributions have |
| 4 | +already landed, so this is not a formality. |
| 5 | + |
| 6 | +## Running it |
| 7 | + |
| 8 | +``` |
| 9 | +npm install |
| 10 | +npm test # no router required |
| 11 | +npm run typecheck |
| 12 | +npm run build |
| 13 | +``` |
| 14 | + |
| 15 | +Tests run against sanitized fixtures captured from a real router. To refresh |
| 16 | +them, or to run a read-only smoke test against your own: |
| 17 | + |
| 18 | +``` |
| 19 | +KEENETIC_HOST=… KEENETIC_PASSWORD=… npm run capture:fixtures |
| 20 | +KEENETIC_TEST_HOST=… KEENETIC_TEST_PASSWORD=… npm run smoke |
| 21 | +``` |
| 22 | + |
| 23 | +## The one thing that matters most |
| 24 | + |
| 25 | +**Verify against the router, not against your model of it.** |
| 26 | + |
| 27 | +Keenetic answers a wrong field name with `{}`, HTTP 200, no error, and nothing |
| 28 | +changed. It is indistinguishable from success. Two real bugs here passed every |
| 29 | +unit test and only surfaced against live hardware, because the tests asserted |
| 30 | +what the author assumed the router does. |
| 31 | + |
| 32 | +So: read every write back through whichever view actually exposes the field, and |
| 33 | +say in the pull request which model and KeeneticOS version you checked it on. |
| 34 | +`src/tools/write.ts` is the pattern. `docs/rci-api.md` collects the traps. |
| 35 | + |
| 36 | +If a change cannot be verified without hardware you do not have, say so. That is |
| 37 | +a normal answer here and better than a confident guess. |
| 38 | + |
| 39 | +## Never commit real network data |
| 40 | + |
| 41 | +A test scans the whole repository for anything shaped like a real MAC address, a |
| 42 | +private IP or key material, and it will fail your build. It exists because those |
| 43 | +have leaked here before, including from a fixture captured off a live router. |
| 44 | + |
| 45 | +Device names and SSIDs have no detectable shape, so nothing catches those. |
| 46 | +Read your own diff before pushing it. |
| 47 | + |
| 48 | +## Style |
| 49 | + |
| 50 | +Match the surrounding code. Comments explain why something is the way it is, |
| 51 | +especially when it looks wrong: most of them are load-bearing and record a trap |
| 52 | +that cost someone an afternoon. |
| 53 | + |
| 54 | +Plain ASCII hyphens, no em dashes, anywhere. |
| 55 | + |
| 56 | +Commit messages say what changed and why it had to change that way. |
| 57 | + |
| 58 | +## Adding another vendor |
| 59 | + |
| 60 | +Please open an issue first. The code is RCI-shaped throughout, and a vendor |
| 61 | +boundary with one implementation behind it would be a guess. A separate |
| 62 | +repository that borrows the tool shapes, the verified-write pattern and the |
| 63 | +skills format is the cheaper start, and the parts worth sharing can be extracted |
| 64 | +once there are two working servers to compare. |
0 commit comments