feat(#1784): wire display consumers to path trust threshold - #1841
feat(#1784): wire display consumers to path trust threshold#1841Bjorkan wants to merge 6 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
|
Independent adversarial review — pr-polish parallel fan-out (round 1) Reviewed at HEAD 9ae4203. Diff: +136/−6, 6 files, pure frontend, tests present. Verdict: NEEDS-WORK — 2 MAJOR, 2 minor. Chain (#1824→#1840→#1841) not a review blocker (code is MAJOR
Minor
Not blocking: chain reviewable in isolation due to defensive guards, but merge in order #1824→#1840→#1841. |
…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
…e, CSS vars, behavioral test - MAJOR 1 (dijkstra): Unify inline fallback for MC_getPathTrustThreshold to 1 across all consumers (map.js, live.js, route-view.js). Was inconsistent: analytics/nodes fell back to 1, map/live/route-view fell back to 2. - MAJOR 2 (kent-beck): Add anti-tautology behavioral test that verifies MC_pathBelowTrust responds to actual hop content (1-byte vs 2-byte), not just a source-grep reference check. - MINOR 3 (carmack): Remove dead modeWeight[0]=0 assignment in nodes.js (loop already zeroes bucket 0 when _tt >= 2). - MINOR 4 (tufte): Replace hardcoded #1e293b / #e2e8f0 fallbacks with pure CSS vars (--input-bg / --text) in map.js trust-message control.
…age, fix stale comment - map.js: compute _hb as max across all hopKeys, not just first hop, so the trust-not-met message correctly reports the largest byte length seen - analytics.js: update stale comment claiming default=1
9ae4203 to
368211a
Compare
|
Review feedback addressed (commits MAJOR 1 (dijkstra): Unified all inline fallbacks for MC_getPathTrustThreshold to 1 across map.js, live.js, route-view.js (was inconsistent: 3 consumers used 2, 2 used 1). The production initialization path (roles.js) sets the real default (2); inline fallbacks are dead-code safety nets. MAJOR 2 (kent-beck): Added anti-tautology behavioral test (#1784: anti-tautology — MC_pathBelowTrust returns correct boolean for given hops). Sets PATH_TRUST=2, verifies 2-byte hop is NOT below trust, 1-byte hop IS below trust, mixed path works, and threshold 1 returns false. A stub returning hardcoded true would fail this test. MINOR 3 (carmack): Removed dead code in nodes.js — duplicate modeWeight[0]=0 assignment (loop already zeroes it). MINOR 4 (tufte): Replaced hardcoded #1e293b / #e2e8f0 fallbacks with pure CSS vars (--input-bg / --text) in map.js trust-message control. Additional fixes from subagent review:
Chain: Rebased on updated feat/path-trust-consumers-1784 (includes DefaultMinHashBytesForMapping=2, roles.js fallback fix, routes.go GetPathTrust fix). All 37 JS tests pass. |
Round-2 verification (parent grep, no re-spawn)Prior round-1 findings — verified at HEAD
Self-driven additions noted ( Zero BLOCKER / MAJOR remain from grep re-pass. No new findings. Merge blocker (structural)
Auto-merge not enabled — no CI checks reported on this branch (workflow triggers on Recommend operator: shepherd #1824 through review first. |
Bot polish review — round 1 (parallel)Verdict: needs-changes [dijkstra] BLOCKER — default drift, same as #1840. [kent-beck] MAJOR — [tufte] MAJOR — inconsistent gating copy + [carmack] nit — [kent-beck] nit — Blocked on: (1) resolve default drift w/ #1840; (2) fix bucket-0 collapse in |
PR #1841 Review — path trust display consumersDependency note: This PR depends on #1840 → #1824. Reviewed in isolation; merge ordering is the author's concern. [MAJOR] Stale trust banner on map (Carmack) — [MAJOR] Speculative flag broadened without API doc (Dijkstra) — [MINOR] Unrelated comment deletions (Beck) — [MINOR] Redundant [MINOR] nodes.js zeroes bucket-0 weight (Carmack) — Tests: Thorough — unit tests for Config: |
Fixes #1784
Summary
Step 4 of the #1784 multi-PR project — wires all frontend display consumers to respect the configured
pathTrust.minHashBytesForMappingvalue.Depends on: #1840 (must be merged first — provides
MC_meetsPathTrust/MC_pathBelowTrust/MC_getPathTrustThresholdhelpers andPATH_TRUSTglobal).Changes
map.js— trust-gated route displaydrawPacketRoutechecksMC_pathBelowTrustbefore drawing polylinesanalytics.js— subpath trust filteringrenderTableinrenderSubpathsfilters route patterns whose hops are below trust thresholdroute-view.js— speculative path annotationbelowTrustflag when any hop doesn't meet the configured threshold(speculative, <N-byte hops)annotation with tooltip explaining the trust thresholdpathTrust.minHashBytesForMappingin config.jsonlive.js— Paths Through widget_pathHopsBelowTrust()helper checks whether all hops in a path are below trust thresholdnodes.js— confidence weight adjustmentmodeWeightinitialization considers the trust thresholdTesting
test-issue-1633-hide-1byte-hops.js:Files changed (6 files, +136/-6)
Depends on: #1840
Written by: DeepSeek V4 Pro in Max Mode