feat(#1784): wire consumers to pathTrust.minHashBytesForMapping config - #1840
feat(#1784): wire consumers to pathTrust.minHashBytesForMapping config#1840Bjorkan wants to merge 3 commits into
Conversation
…pping config Step 3 of the Kpa-clawbot#1784 multi-PR project — wires the shared packetpath.MeetsPathTrust helper (from PR Kpa-clawbot#1824) into all consumer sites so the configurable trust threshold actually gates mapping/topology evidence. Server-side: - neighbor_graph.go: BuildOptions gains PathTrust field; edge building skips observations whose prefix length is below the configured threshold - neighbor_api.go: passes s.cfg.PathTrust through to BuildOptions - path_inspect.go: hopEvidence gains Trusted field; candidates marked speculative when any hop is below threshold; stats include threshold - /api/config/client: exposes pathTrust to the frontend Frontend: - roles.js: PATH_TRUST global populated from config client - hop-filter.js: MC_getPathTrustThreshold(), MC_meetsPathTrust(), MC_pathBelowTrust() — shared decision points for render-time consumers - customize-v2.js: trust threshold info shown below the existing hide-1byte-hops toggle in Path Display section Default: 1 (backward-compatible, trust-all). Operators wanting the conservative default (exclude 1-byte) can set minHashBytesForMapping: 2 in config.json; strictest mode uses 3. Testing: - trust_test.go: 10 tests covering default=1, threshold=1/2/3, clamping, zero-value fallback, nil safety - test-issue-1633-hide-1byte-hops.js: 10 additional tests for the new MC_* functions (all passing: 31/31 total) Depends on: PR Kpa-clawbot#1824 (SaarMesh-Bot) — this PR includes the foundation files from that branch for compilation; should be merged after Kpa-clawbot#1824. Written by: DeepSeek V4 Pro in Max Mode
Adversarial review (parallel personas)
Second-order concern (munger): Dependency status: #1824 still OPEN. This PR must not merge before #1824, and the foundation-file drift above must be reconciled first. Merge-block: 1 BLOCKER / 2 MAJOR — NOT merge-ready. |
…estor surface, nil-safe, tests - BLOCKER (munger): Sync DefaultMinHashBytesForMapping to 2 per Kpa-clawbot#1824. Wire-format minimum is no longer the default threshold — operator- confirmed. Update trust_test.go, hop-filter.js fallback, and config.example.json to match. - MAJOR (dijkstra): Remove ingestor-side PathTrust surface since no consumer reads it. Field, type alias, method and import removed from cmd/ingestor/config.go. - MINOR (carmack): Use s.cfg.GetPathTrust() consistently in path_inspect.go so nil s.cfg doesn't panic. Precompute statsMinBytes for the struct literal. - MAJOR (kent-beck): Add TestBuildNeighborGraph_PathTrustExcludes1ByteHops — consumer wiring test that proves edges are skipped at threshold=2 but built at threshold=1. - MINOR (tufte): Fix customize-v2.js trust-info: remove misleading 'or hidden', collapse two adjacent hint paragraphs into one.
… GetPathTrust, hoist loop var - roles.js: PATH_TRUST fallback now 2 (was 1), matching DefaultMinHashBytesForMapping - routes.go: handleConfigClient uses GetPathTrust() so nil s.cfg.PathTrust doesn't drop the field — default is always serialized - customize-v2.js: inline fallback 1→2 for trust threshold - neighbor_graph_test.go: remove mangled/stale comment block - path_inspect.go: hoist GetPathTrust() out of per-hop evidence loop, fix extra indentation
Step 4 of the Kpa-clawbot#1784 multi-PR project — wires all frontend display consumers to respect the configured pathTrust.minHashBytesForMapping value. Depends on PR Kpa-clawbot#1840 (server-side foundation + config exposure). Display consumers wired: - map.js: drawPacketRoute checks MC_pathBelowTrust before drawing polylines; shows "Route not displayed" message with config guidance when all path hops are below the configured trust threshold - analytics.js: subpath renderTable filters route patterns whose hops are below trust, with clear messaging in the info line explaining which filters are active - route-view.js: path picker groups tagged with belowTrust flag; speculative paths show "(speculative, <N-byte hops)" annotation with tooltip explaining the trust threshold - live.js: Paths Through widget distinguishes between 1-byte-filtered and trust-threshold-filtered paths in its fallback message - nodes.js: confidence mode weights zeroed for hash modes below the configured trust threshold (bucket-0 excluded at threshold >= 2) Testing: - test-issue-1633-hide-1byte-hops.js: 5 new source-grep guards verifying each consumer references the trust threshold helpers (all 26 tests passing) Depends on: PR Kpa-clawbot#1840 (must be merged first — provides the MC_meetsPathTrust / MC_pathBelowTrust / MC_getPathTrustThreshold helpers and the PATH_TRUST global) Written by: DeepSeek V4 Pro in Max Mode
|
Review feedback addressed (commits BLOCKER (munger): DefaultMinHashBytesForMapping changed from 1 to 2. Updated trust.go, trust_test.go (all tests pass), hop-filter.js fallback, config.example.json, and test-issue-1633-hide-1byte-hops.js. MAJOR (dijkstra): Removed ingestor-side PathTrust surface entirely from cmd/ingestor/config.go (field, type alias, method, import — zero consumers existed). MINOR (carmack): path_inspect.go now uses s.cfg.GetPathTrust() consistently (nil-safe), hoisted out of the per-hop evidence loop. statsMinBytes precomputed for the struct literal. MAJOR (kent-beck): Added TestBuildNeighborGraph_PathTrustExcludes1ByteHops — consumer wiring test proving edges are skipped at threshold=2 but built at threshold=1. All Go tests pass. MINOR (tufte): customize-v2.js: removed misleading "or hidden" claim, collapsed two adjacent "1-byte noisy" hint paragraphs into one. Additional fixes from subagent review:
Tests: All 31 JS tests pass. All Go tests pass (packetpath + server neighbor graph). |
Round-2 verification (parent grep, no re-spawn)Prior findings from round-1 review — all verified landed at HEAD
Additional self-driven fixes noted (roles.js fallback→2, Zero BLOCKER / MAJOR remain from grep re-pass. Merge blocker (structural, not code)
Recommend: get #1824 reviewed + merged first, then rebase this PR onto master (the bundled Auto-merge not enabled (waiting on chain + no CI to gate on this branch — checks are triggered only after master push per the workflow). |
Bot polish review — round 1 (parallel)Verdict: needs-changes [dijkstra] BLOCKER — default is not backward-compatible. [dijkstra] BLOCKER — [kent-beck] MAJOR — no revert-test for the default. [carmack] nit — [carmack] nit — Blocked on: resolve BLOCKERs — decide default (1 or 2), align code + PR body + BuildOptions doc + config.example.json; add default-behaviour revert-test. |
Review — #1840 path trust consumer wiringObservation: Depends on #1824 — must land first to avoid duplicate-file conflicts on rebase. 🔴 BLOCKER[B1] Default breaks backward compatibility (Carmack, Dijkstra) — PR body promises "Default [B2] 🟡 MAJOR[M1] Stale comment deletion (Kent Beck) — 🟢 MINOR[m1] Unnecessary IIFE in [m2] Redundant Tests (Kent Beck): 21 new tests (11 Go unit, 10 JS) + 1 integration test in Summary: B1 is the critical issue — the default silently changes behavior for every operator without explicit config. Fix the default or fix the documentation + add a migration note. |
Summary
Step 3 of the #1784 multi-PR project — wires the shared
packetpath.MeetsPathTrusthelper into all consumer sites so the configurable trust threshold actually gates mapping/topology evidence.Depends on: #1824 (SaarMesh-Bot) must be merged first. This PR includes the foundation files from that branch for compilation; after #1824 merges, the duplicates will be resolved on rebase.
Changes
Server-side consumer wiring
neighbor_graph.go:BuildOptionsgainsPathTrust *packetpath.TrustConfigfield. Edge building skips observations whose prefix byte-length is below the configured threshold.neighbor_api.go: passess.cfg.PathTrustthrough toBuildOptionsingetNeighborGraph().path_inspect.go:hopEvidencegainsTrusted boolfield; candidates markedspeculativewhen any hop is below trust threshold; responsestatsincludeminHashBytesForMapping.Config exposure to frontend
/api/config/client: now returnspathTrustobject withminHashBytesForMapping.Frontend consumer wiring
roles.js:PATH_TRUSTglobal populated from config client response (fallback: 1).hop-filter.js: Three new functions added:MC_getPathTrustThreshold()— returns current threshold (default 1)MC_meetsPathTrust(hop)— whether a hop prefix meets the thresholdMC_pathBelowTrust(hops)— whether ALL hops in a path are below thresholdcustomize-v2.js: Trust threshold info line shown below the existing hide-1byte-hops toggle in Path Display section. Shows current mode and how to change it.Default: backward-compatible
Default
minHashBytesForMapping: 1(trust-all). No regression for existing operators. To exclude 1-byte evidence:Testing
internal/packetpath/trust_test.go: 11 tests covering default=1, threshold=1/2/3, clamping, zero-value fallback, nil safetytest-issue-1633-hide-1byte-hops.js: 10 additional tests for the newMC_*functions — all 31 tests passingFiles changed (14 files, +416/-11)
Written by: DeepSeek V4 Pro in Max Mode