Repository navigation
feat(nodes): recommended scopes for where the node stands, info only (#1035 M2) - #1106
adminopenclaw8-sketch wants to merge 4 commits into
Conversation
…1035 M2) GET /api/nodes/{pubkey}/scope-check sets a repeater's or room's own scopes next to what meshguide.dk recommends for its advertised position, through M1's engine (internal/scopeguide Recommend + Compare, unchanged): one typed node-row read by primary key, one DAGI point lookup on the in-memory index, a named response struct. 404 for unknown, hidden or blacklisted nodes and while dagi.enabled is off. The full node page shows it as "Recommended scopes here (meshguide.dk)" (public/node-scope-check.js, textContent only): the recommended chips, the node's default scope ("cannot be decoded" for an unnamed one) and the observer-reported list in neutral wording, a meshguide.dk link, nothing for companions or nodes without a position. ?section=node-scope-check deep links to it. The page renders twice on a cold load, so the module reuses the last answer for a minute: one request per node view. Relates to #1035 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… M2) CI's frontend lint (eslint no-undef, Kpa-clawbot#1342) rejects the bare global in the node page template; the wiring test now pins the window. form. Relates to #1035 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rapport — CS-Macmini PR#1106 #1035 — head 1cd1db6Status: #1035 M2 implemented as a draft. Every requirement has a red-before-green test, 29/29 mutants are killed, and all CI jobs are green on head Evidence tags: [T] = verified by a test or run, [A] = analysis from reading the code, [K] = known limitation or not verified. Requirements
Commands run locally [T]
CI per job, head
|
| Job | Result |
|---|---|
| Go Build & Test | pass |
| Go Ingestor | pass |
| Go Libraries & CLI | pass |
| Go Server 1/3, 2/3, 3/3 | pass |
| JavaScript Unit Tests & Lint | pass |
| Script & Container Unit Checks | pass |
| Validate Docker Image | pass |
| Playwright E2E 1/3, 2/3, 3/3 | pass (the new suite ran 10/10 in shard 2) |
| Verify E2E Shards & Coverage | pass |
| Verify Go Test Assignments | pass |
| Build & Publish Docker Image | pass |
First head 517391da:
- JavaScript Unit Tests & Lint failed on my own ESLint
no-undef: a bareNodeScopeCheckin thenodes.jstemplate. Fixed in1cd1db6a, and the wiring test now pins thewindow.form. - Script & Container Unit Checks failed on a Docker Hub pull error (
cannot pull alpine:3.24.1@sha256:…). This is infrastructure, not this change, and it passed on the next head without a re-run. - The known flake flaky: #180 packets URL E2E 'reload shows the same list' depends on fixture age (default 15-min window) #271 was not hit, and no job was re-run.
Invariants
cmd/serverstays read-only: the new code is oneSELECTby primary key [A].readonly_invariant_test.gopasses [T].- No new
map[string]interface{}outside tests [T]. .github/is unchanged against master, so the fork guards are untouched [T]. A grep for thegithub.repository == 'Kpa-clawbot/CoreScope'guard gives 8 indeploy.ymland 1 inrelease-fast-path.yml, identical to master. The brief's 9 likely counts a different pattern [K].cmd/server/go.modand theDockerfilenow require and copyinternal/scopeguide(Validate Docker Image passes) [T].
Choices made without asking
- A new endpoint instead of new keys on the node-detail map (M0 §6) [A].
- The postnummer comes from the DAGI index lookup on the row's own position: the same land-clipped index the membership snapshot uses, and fresher than the snapshot [A].
- The card sits at the end of the node page, so the async fill does not shift anything above it [A].
- The node page renders twice on a cold load. This is existing behaviour;
clock-skewis also fetched twice. The module therefore reuses one answer for 60 s instead of changingnodes.jsrendering [T].
Remaining
- The DAGI credit is not shown in the card:
DagiFilter.creditElement()returns null on the node page because its config is not loaded there. The module appends the credit when one is available [K]. Follow-up candidate for M3/M4. - The node's default scope still comes from the
nodes.default_scopecolumn, with no advert time. M0 §1 proposed reading the newest in-memory advert. M1 did not add that accessor, and M2 does not add it either [K]. - The meshguide link URL and the role set are hard-coded, marked for the customizer and config in M4 (rule 8) [A].
- The app was not checked against staging or prod, which the brief forbids. The browser check was local only: E2E screenshots at 1280×900 and 375×560, light and dark [T].
Review — CS-Minimax PR#1106 — head 1cd1db6Dom: REQUEST CHANGES An independent, read-only review of #1035 M2 against the M0 plan and the owner decisions of 2026-12-02. The wiring, API shape, layout, XSS handling and tests are solid. One owner decision (9, "cannot be decoded") is not met on real data, and the branch now conflicts with master. Evidence tags: [T] = verified by a test or run, [A] = analysis from reading the code, [K] = known limitation or not verified. Findings
Suggested fix for F1 (read-only, cheap): take the node's default from its newest flood advert in Note: M3 (#1107) builds on this helper ( Answers to the review points
Tests and mutantsThese ran on the merged tree (
My own mutants [T]:
Not verified
|
scripts/e2e-shards.json: keep both sides (#1094's test-issue-1023-m2-hidden-hops-e2e.js and this branch's test-issue-1035-m2-node-scope-check-e2e.js). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n a cold deep link (#1035 M2) Review fix round for #1106 (CS-Minimax, head 1cd1db6). F1: the ingestor never writes '' to nodes.default_scope (shouldUpdateDefaultScope / UpdateNodeDefaultScope skip it, Kpa-clawbot#1534); an undecodable scope lives in transmissions.scope_name ''. The check now takes the default from, strongest first: the firmware's own report (default_scope_confirmed_at, "*" = none), the node's newest flood advert (route 0/1, payload 4, by ingest id; NULL = unscoped, '' = cannot be decoded), nodes.default_scope (inferred from an older named advert), or nothing. One probe of idx_transmissions_from_pubkey ("+" keeps the planner off the payload_type index; pinned by a plan test). The response gains defaultSource and defaultAdvertAt. An ingestor test pins the row shape for a real undecodable transport-flood advert; the Go and E2E seeds use that shape with default_scope NULL. F3: the card waits for DagiFilter.enabled() (one config fetch per page session), so a cold deep link shows the DAGI credit too; F7: DAGI off makes no /scope-check request. F4: unit tests kill R3 (unanchored https check) and R4 (confirmation time outside the node's own report). F5: nodeScopeRow comment. F6: "cannot be decoded" is said once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Relates to #1035
What
M2 of #1035 (plan "M2: node page" in the M0 report, owner decisions of 2026-12-02, M1 #1101 merged as
10a5f1da): the full node page of a repeater or room with an advertised position shows "Recommended scopes here (meshguide.dk)", an info-only section that sets what meshguide.dk recommends for where the node stands next to what the node has.GET /api/nodes/{pubkey}/scope-check(cmd/server/node_scope_check.go). It runs M1's engine as is (scopeguide.Recommend+Compare), with no copy of it. The response is a named struct (NodeScopeCheckResponse, embedding M1'sVerdict) plusdefaultConfirmedAt,listReportedAtandsource(repo, pinned commit, meshguide.dk link). It reads one typed node row by primary key, so the new file has nomap[string]interface{}.nodes.default_scope;''means "cannot be decoded" here,NULLmeans none) and the configured allow-list (nodes.configured_scope, only when an observer reported it).notApplicableset torole(companion, sensor),position(no advertised position, 0,0 included; estimated positions are never used) oroutside(in no DAGI postnummer, e.g. Sweden). The page shows nothing in these cases.dagi.enabledis off. Public, like the node page. Read-only (bug(db): vacuumOnStartup fails with SQLITE_BUSY when ingestor + server share DB (auto_vacuum migration #919 broken in single-container topology) Kpa-clawbot/CoreScope#1283).public/node-scope-check.js: DOM built withtextContentonly.dk/eu/europe, plus postal scopes only on Fyn and Sjælland, with a note explaining why there are none elsewhere.meshguide.dk/#/defaults/region-scopeswith the pinned commit.#/nodes/{pk}?section=node-scope-check.clock-skewis also fetched twice. The module therefore reuses its last answer, or the request still in flight, for 60 s. It holds one entry, and a failed request is dropped, so a view costs one request.badge-scopechips, and a single column below 480 px.Plan (no separate plan was posted, as the task asks)
test-1035-node-scope-check.js(tests/fake-dom.js vm sandbox), then the module and thenodes.jswiring.test-fixtures/seed-1035-scope-check-nodes.sql, at desktop and 375×560, light and dark. Registered inscripts/e2e-shards.json(shard 2, the lightest).Choices made without asking (the smallest that changes no existing behaviour):
tests/e2e-1055-live.jsstartServertakes an optional seed file. The Live: DAGI area filter (kommune, landsdel, region, postnummer) — measure the cost first #1055 suites keep their default, and the Live: DAGI area filter (kommune, landsdel, region, postnummer) — measure the cost first #1055 M2 suite was re-run green.Performance
This is not a hot path: one request per node view, and nothing in ingest, WebSocket or render loops.
TestScopeCheckComputeBudgetasserts thatbuildNodeScopeCheck(DAGI lookup + Recommend + Compare) stays under 1 ms per call. It measured 2.9 µs/call over 5,000 calls (Apple M-series, without-race).BenchmarkNodeScopeCheckis included. Nothing scales with the number of nodes or packets, so the endpoint has no cache.Config / customizer (rule 8)
The meshguide link URL and the roles checked are hard-coded constants, marked for #1035 M4, where the plan puts the customizer and config.
Tests
cd cmd/server && go test ./...passes;internal/scopeguidepasses.sh test-all.shpasses: 415/415.node test-frontend-helpers.jspasses: 746/746.node test-1035-node-scope-check.jspasses: 20/20.test-issue-1035-m2-node-scope-check-e2e.jspasses: 10/10 locally.node scripts/run-go-server-shard.js --validateandnode scripts/run-e2e-shard.js --validateboth pass.scripts/check-xss-sinks.sh --diff origin/masteris clean..github/is unchanged.🤖 Generated with Claude Code