Repository navigation
fix(packets): one path-hash width helper for the hex breakdown (#322) - #327
Conversation
…mment fixes Follow-ups to #313 (#282), tests first. - test-packets.js: a buildFieldTable case for a TRANSPORT_DIRECT frame (route 3, path byte at offset 5) whose 0x00 is the zero-hop marker. Kills the `(route === 2 || route === 3)` -> `(route === 2)` mutant that survived #313. - test-frontend-helpers.js: senderPathHashSize covers the route-3 0x00 marker too, and both buildFieldTable sandboxes expose the shared width helper. - test-issue-322-comment-guards.js (+ test-all.sh registration): source-text guards for points 3 (pktEsc leak header) and 4 (normalizeObservedPathHashSizes callers); red against the wrong wording, green once corrected in the next commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow-ups to #313 (#282). - One implementation of the path-hash width rules: pathHashSizeFromByte() in app.js (TRACE -> null, 0b11 -> null, 0x00 zero-hop marker on a direct route 2/3 -> null, else (byte >> 6) + 1). senderPathHashSize() and buildFieldTable's Path Length row both call it, each still reading its own path byte at its own offset (header-derived vs pkt.route_type), so the rules cannot drift. Verified against firmware/src/Packet.h and firmware/docs/packet_format.md. - channels.js: the #282 (8) comment no longer claims the sender badge uses normalizeObservedPathHashSizes(); renderSenderPathHashBadge reads message.senderPathHashSize directly. Lists the real callers. - test-issue-282-pktesc-listener.js: the header no longer says the leak stacked per filter/region change; renderLeft() returns at the filtersBuilt guard, so the listener was added once per visit. - .eslintrc.json: register the new cross-file global; test plumbing lifts it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rapport — CS-MacBook PR#327 #322 — head 40f36f8Status: All 4 follow-ups to #313 done on a draft PR; every point has a test and a mutant, all local suites are green, the browser check passes, and all three CI jobs are green on the first run (no re-runs). Evidence tags: [T] test/run output I produced, [A] assessment/inference, [K] checked in code/diff/CI. Branch
Requirements
Firmware check [K]Width rules verified against the firmware: Local checks [T]
Browser check [T] — local Go server (my build) on CI-prepared
|
Review — CS-Macmini PR#327 — head 40f36f8Dom: APPROVE med nits Independent read-only review of the four #322 points (follow-ups to #313). Everything I could check against the firmware, the suites, the mutants and a real browser holds up. The nits below are all non-blocking; one is a documented behaviour delta on malformed input, two are residual DRY gaps outside the issue's stated scope. Evidence tags: [T] test/run output I produced, [A] assessment/inference, [K] checked in code/diff/CI. Findings
The review points1. DRY — one implementation of the width rules. Holds. Checked against the firmware [K]:
Residual copies are N2/N3; neither is in the issue's stated scope. 2. Test gap — the TRANSPORT_DIRECT
3. 4. 5. Browser check — no regression in the hex breakdown or the path display. Confirmed against a local Go server (my own build, CI-prepared Hex breakdown, 8 frames — output byte-identical on master and branch, no page errors:
Path display with real hops — also byte-identical on both trees [T]: FLOOD 2 hops The PR's own E2E, same server: No other behaviour change. Tests I ran [T]On the merged tree (
Mutants [T]Seven, all resolved. Five are mine (B, C, D, E, F, G below); A is the one the issue names, which I reproduced in both directions.
Each of the three firmware rules in the helper (width formula, CI [K]Run 37478839183, attempt 1, no re-runs, checked per job:
Neither known flake (#256 Hash Stats sort, #267 backfill write-hold) appeared. The author's CI claims match what I see. What I did not verify
|
Relates to #322
Follow-ups to #313 (#282), from the review of that PR. All four points, tests first then code (two commits). No behaviour change: points 1 and 7's output is identical for every well-formed frame — the width rules are unchanged, only their one home moves.
Plan (as built)
public/app.jsgainspathHashSizeFromByte(pathByte, routeType, headerByte)— the one implementation of the rules.senderPathHashSize()andbuildFieldTable's Path Length row both call it; each still reads its own path byte at its own offset (header-derived vspkt.route_type), so there is one offset source per caller.test-frontend-helpers.jssenderPathHashSize +test-packets.jsbuildFieldTable both exercise the shared rule (route-3 0x00)0x00marker untestedtest-packets.js: abuildFieldTablecase for route 3 (17aabbccdd00), path byte at offset 5hash_size=1; the case kills ittest-issue-282-pktesc-listener.jsheader overstated the leakrenderLeft()returns at thefiltersBuiltguard on filter/region changes, so the listener was added once per visit, not per changetest-issue-322-comment-guards.jspoint 3public/channels.js#282 (8) comment wrongnormalizeObservedPathHashSizes();renderSenderPathHashBadge()readsmessage.senderPathHashSizedirectly. Lists the real callers (union/merge, cached-message merge, packet → message mapping, dedup key).test-issue-322-comment-guards.jspoint 4The width rules were verified against the firmware:
firmware/src/Packet.h(getPathHashSize()=(path_len >> 6) + 1,isRouteDirect()= routes 2/3,hasTransportCodes()= routes 0/3) andfirmware/docs/packet_format.md(path_length bits 6-7 hash-size code,0b11reserved/invalid,0x00zero-hop marker).Verification
sh test-all.sh: 226/226 files pass (new comment-guard file registered).node test-frontend-helpers.js,node test-packets.js: green.(routeType === 2 || routeType === 3)→(routeType === 2)in the shared helper: kills both the senderPathHashSize assertion and the buildFieldTable route-3 case (single-source proof); reverted.scripts/check-xss-sinks.sh --diff origin/master: clean (scans the 3 changedpublic/files).no-undef: 0 errors (the new cross-file global is registered in.eslintrc.json).deploy.yml, 1 inrelease-fast-path.yml. No newmap[string]interface{}outside tests (no Go changes —cmd/serveruntouched). No hardcoded colours.e2e-fixture.db:test-packet-detail-sender-hash-size-obs-e2e.js3/3 (flood-route breakdown) andtest-channels-observed-path-hash-size-e2e.js8/8.buildFieldTable: TRANSPORT_FLOOD (route 0, byte-5 offset) →Path Length 0x40 → hash_size=2 bytes, hash_count=0; TRANSPORT_DIRECT (route 3)0x00→hash_count=0 (no encoded hash size); both with the Transport Codes section. No page errors.Draft until review.