Repository navigation
Conversation
…stub (#1023 M2) Go tests for every path that serves a packet a hidden identity relayed or sent: the list (flat, grouped, expand=observations for the VCR), the detail (also Live's replay), POST /api/packets/observations, the WebSocket (new transmission and new observation, top level and nested packet), the grouped SQL fallback, /api/packets/{hash}/path (hop left out, no position borrowed from a hidden neighbour) and resolve-hops (bestCandidate leak). Each runs for a hidden prefix, the node blacklist and the observer blacklist, with a visible control hop; a nothing-hidden control and a rename-back test guard against tautologies. hidden_hops.go is a compile-only stub that hides nothing, so these fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… M2)
Packets a hidden identity (M1's rule: node or observer blacklist, a hidden
current name, or a newest advert with one) relayed or sent stay served, but
its full key is no longer in them:
- resolved_path entries of a hidden key are served as null, like an
unresolved hop: list, grouped (store and SQL fallback), expand (VCR),
detail (also Live's replay), batch observations, node health, observer
analytics and the WebSocket frame with its nested packet (redacted in the
poller after M1's per-poll refresh, so a hop hidden by this poll's advert
is caught too).
- /api/packets/{hash}/path leaves the hop out like an unresolved one (the
branch keeps its hop count) and no longer estimates a visible hop's
position from a hidden neighbour.
- resolve-hops uses the shared set for candidates and never reports a
hidden affinity pick as bestCandidate (it did, after rejecting it).
One helper on M1's hiddenPredicate (hidesKey, redactPath), no new DB query
per packet: one map lookup per served hop, a nil predicate (one pointer
test) when no key can be hidden, and a copy only of a path with a hidden
hop (resolved paths are shared with the LRU).
Tests: per path for a hidden prefix, the node blacklist and the observer
blacklist with a visible control hop; a nothing-hidden control, rename
back, a blacklist set before the next rebuild, an upper-case key, copy on
write; an allocation guard and benchmarks; an E2E on Packets and Live.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se (#1023 M2) On the CI runner under -race, TestHiddenHopsRedactAllocs counted 1402 allocations for 1365 copied paths: AllocsPerRun counts every goroutine's allocations. The bound gets a constant plus 10 % slack, still far below one allocation per hop (about 4.5 per path), the regression it guards; the nothing-hidden modes keep a small constant bound and the nil-predicate check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rapport — CS-MacBook PR#1094 #1023 — head 5108841Status: M2 is code complete and CI is green on Evidence marks: [T] run in this session (test, benchmark, mutant, browser, CI); [K] read in the code; [A] assumption or choice. Requirements → test → mutantEach Go test runs for three modes: a hidden prefix (🚫), the node blacklist and the observer blacklist. Each one has a visible control hop. "Red before" means the test fails on
All 18 mutants were killed. Method: apply one change, run the listed test, revert. Perf [T]Benchmarks run on 30K packets from 2K nodes, 50 of them hidden (medians,
RunsLocal [T]:
CI per job:
The Go Server 3/3 failure on
Neither failure reproduced locally under Choices and remaining work
|
Review — CS-VM2 PR#1094 — head 5108841Dom: REQUEST CHANGES Summary: The redaction itself is correct, copy-on-write and cheap. List, grouped, VCR, detail, batch observations, observer analytics, SQL fallback, WebSocket, One leak in M2's own scope remains: the server-made ping-bot reply on the Channels page names a hidden relay of a packet that stays served. It reads Evidence marks: [T] run by me in this review; [K] read in the code; [A] assumption or judgement. Trees:
Findings
Answers to the review pointsLeak hunt (privacy), with every probe run in
Non-hidden control [T]:
Option (b) and M1 consistency [K]:
Read-only and maps [K]:
Behaviour beyond the purpose [K]:
Docs: they are accurate except for finding 1 ("not named in them") and the wording in finding 5. Hygiene [T]:
Perf (hot path)All numbers are [T],
Master vs merged, same machine, interleaved:
All of this is within noise: no regression. At realistic scale, the REST page serves 50 paths and the WebSocket poll is capped at 600 messages per second. With 50 hidden identities that is about 7 ms per poll on this slow test machine, and about 0.2 ms on the author's machine. This is acceptable [A]. Tests and mutantsRed before → green after [T]: on Every issue acceptance item has a red→green test, with one exception: finding 1's path. The issue's own acceptance says "no API response … contains a hidden node's … name", so that path needs a test too. Own mutants: each was applied to the merged tree, run against
Suites:
On the merge with the new master
E2E [T], local Go server and fixture prepared as in CI: freshen, CI seed SQL,
Phone flow [T]:
CI per job (from the coordinator's snapshot) on
What I did not verify
Requested changes
|
Relates to #1023
Plan (M2 of #1023)
M1 (#1053) stopped serving a hidden identity's own ADVERT and ANON_REQ packets. M2 handles the packets that are still served: packets the hidden node relayed or sent. They stay, but the hidden node's full key, name and position must not appear in them.
The rule and the set are M1's (
hiddenPredicateover thehiddenPKsnapshot plus the live config's blacklists). There is no copy: a node blacklist, an observer blacklist, a hidden current name, or a newest advert with a hidden name all hide it. Hiding follows the identity's current state, so a node that is renamed back is named again after the next rebuild.In served packets, the only field that carries a full key is
resolved_path. Decoded payloads of the packets that stay hold only 1-byte hashes. On the server, names and positions come from/api/packets/{hash}/pathand/api/resolve-hops.What changes
cmd/server/hidden_hops.go(new): one helper on M1's predicate.hidesKey(key)tests a key againsthiddenPKand then the live config.redactPath(rp)is copy-on-write. Resolved paths are shared with the LRU, so the slice is copied only when one of its hops is hidden.hiddenHopPredicate()isnilwhen no key can be hidden.resolved_pathentries of a hidden key are served asnull, the same as an unresolved hop. This applies to:applyResolvedPathJobs,groupedPageWithRP), includingexpand=observations(the Live VCR);enrichObsWithTx);QueryGroupedPackets, from M1'sHiddenSenderskeys);packet. This is redacted in the poller after M1's per-poll refresh, so a hop hidden by an advert in the same poll is caught. The E2E showed that the WebSocketresolved_pathis the server's own live hop resolution, not the stored one, so this was a real leak./api/packets/{hash}/path: a hidden hop is left out ofpoints, the same as an unresolved hop, and the branch keeps itshopscount. A visible hop with no position of its own is no longer placed at its hidden neighbour's position. It usesnearestVisiblePositionedNeighbor, which already existed (Analytics: the Areas tab counts hidden identities #1005)./api/resolve-hops: candidates are filtered through the shared set, so the observer blacklist and M1's newest-advert name now count too. A hidden affinity pick is no longer returned asbestCandidate. Before this change it was set even after the hop had been rejected as hidden. Its confidence tier is not reported either.visibleSubpaths, copy-on-write, prefix-aware), after the M0 research. I made no change there; mutant M18 shows that its existing tests catch the bug.config.example.json_comment_hiddenNamePrefixes,docs/user-guide/configuration.md(Hidden nodes) anddocs/api-spec.md(GET /api/packets, Hidden identities).The server stays read-only, since only
SELECTs already present are used. No newmap[string]interface{}is added outside tests: the WebSocket message is read through the existingjsonObjectalias. No colours, frontend or workflows changed.Perf
This is a hot path: packet serving and the WebSocket broadcast. Each served hop costs one map lookup on the lower-case stored key.
strings.ToLowerruns only for a key with upper case; it was 30 % of the cost before this change. There is no per-packet DB query. When no key can be hidden, the predicate isnil, so each path costs one pointer test and 0 allocations. When hops are hidden, only paths with a hidden hop are copied.TestHiddenHopsRedactAllocsenforces this.The table shows
go test -bench BenchmarkHiddenHops -benchtime 2s -count 5, each run on 30K packets from 2K nodes, 50 of them named 🚫 (M1's benchmark store). Values are medians.Redact30K: every one of 30K paths (1–8 hops) served onceBroadcast600: one poll batch at its cap (100 tx + 500 obs)offcolumn runs the same code path as master: a nil predicate.Tests (red before → green after)
43d95527is test-only on a compile-only stub that hides nothing. AllTestHiddenHops1023_*tests fail there, except the nothing-hidden control, which passes by design.458c8301makes them green and adds three tests: observer analytics, blacklist-before-rebuild and upper-case key. Each of the three is shown red by its mutant (M3, M12, M13).test-issue-1023-m2-hidden-hops-e2e.js(shard 2) runs on its own server with ports from 13900. It is red against a master binary (0/3) and green on this branch (3/3).Each Go test runs for a hidden prefix, the node blacklist and the observer blacklist, with a visible control hop.
🤖 Generated with Claude Code