Repository navigation
Conversation
Owner
Author
|
Change after opening (commit
|
A13xB0
force-pushed
the
feat/2142-scope-transport-api
branch
from
October 10, 2026 14:45
c08c502 to
060668b
Compare
Owner
Author
|
This branch has been updated before going upstream:
It's submitted upstream as Kpa-clawbot#2167. The description here predates those changes; the upstream one is current. |
…rding (Kpa-clawbot#2142) The scope audit only lists repeaters that have answered a declared-regions request. Kpa-clawbot#2142 asks for a transport view: every repeater seen forwarding in the window, the region scopes it carried, its declared regions where known ("not asked" otherwise), and a region filter for tracking a rollout. Adds ScopeTransportRow / ScopeTransportResponse, a ?mode=transport stub that returns no rows, and tests: repeaters that never answered are listed with asked=false and null declared fields, repeaters with no traffic are left out, region=X (spelled fr, #fr or FR) marks carriers and non-carriers and counts them, the blacklist applies, an unknown mode is a 400, and the two views are cached separately. Four fail on the stub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
…pa-clawbot#2142) GET /api/scope-audit?mode=transport lists one row per repeater the forwarding scan attributed traffic to in the window, whether or not it ever answered a declared-regions request: - transported: the named region scopes it was seen carrying, with packet counts and first/last seen (most packets first), plus unscoped, unmatched and ambiguous-hop counts; - asked / declaredRegions / notObserved / configState / declaredAt where a declared answer exists, null where it does not ("not asked"); - region=X (with or without '#', any case) adds carriesRegion per row and carrying / notCarrying counts: the rollout report. Same single ScopeAuditForwarding scan and attribution rules as the declared view (FLOOD-family routes, no 1-byte hops, ambiguous hops credited to nobody), with every repeater and room in nodes as a target. Cached per window with the declared view's TTLs, under the same singleflight group; the region filter is applied to a copy of the cached result. An unknown mode is a 400. Documented in docs/api-spec.md. BenchmarkComputeScopeTransport (1,200 repeaters, 30k flood transmissions in 24h, 4-hop paths): 219 ms per compute, 1,200 rows, 425 KB response. newTestStoreWithDB now takes testing.TB so benchmarks can use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
…egion= Across the API, region= is the observer IATA filter (/api/nodes, /api/packets, ...). The transport view used region= for a region SCOPE (be, be-van), which would collide with adding the observer filter to the scope audit. It is now ?scope=, echoed as "scope", with carriesScope on each row; carrying / notCarrying are unchanged. Tests and docs/api-spec.md updated to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
…r, row and sort helpers SonarLint S3776 (cognitive complexity 41 > 15). Same response; the transport tests are unchanged and pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
A13xB0
force-pushed
the
feat/2142-scope-transport-api
branch
from
October 10, 2026 17:22
060668b to
bb056a1
Compare
Owner
Author
|
Merged upstream as Kpa-clawbot#2167 (2026-10-10T19:22:20Z). Closing; master will be synced from upstream. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backend half of upstream issue Kpa-clawbot#2142 (the page is a separate, stacked PR).
GET /api/scope-auditlists only repeaters that have answered a declared-regions request: 17 of almost 200 nodes on the instance the request came from. This adds a transport view,GET /api/scope-audit?mode=transport&window=…[&scope=X], with one row per repeater seen forwarding in the window:transported: the named region scopes it was seen carrying, each with packets and first/last seen (most packets first), plus unscoped, unmatched and ambiguous-hop counts;asked,declaredRegions,notObserved,configState,declaredAtwhere a declared answer exists;asked: falsewith null declared fields where it does not ("not asked" is not "declares nothing");scope=X(spelledsco,#scoorSCO):carriesScopeon every row andcarrying/notCarryingcounts, which is the rollout report the issue asks for.mode=declared(or nomode) is unchanged. An unknownmodeis a 400.Partial fix for Kpa-clawbot#2142: this PR provides the API; the page is the stacked PR. The issue should only be considered done once both are in.
How it follows the issue's notes
ScopeAuditForwardingpass, with every repeater and room innodes(plus any declared target) as a target instead of only the declared ones. Same attribution rules: FLOOD-family route types only,minForwarderHopHexLen(no 1-byte hops), and a hop whose prefix matches more than one repeater is credited to none of them.scopeAuditNodeIdentitiesruns oneINquery; exercised at 1,200 keys in the benchmark below.transport|key. The scope filter is applied to a copy of the cached result, so one scan serves every scope. (scope=, notregion=: across the APIregion=is the observer IATA filter.)Performance
BenchmarkComputeScopeTransport: 1,200 repeaters (Kpa-clawbot#1975 quotes an instance with 1,179), 30k flood transmissions in the last 24h on 4-hop paths of 3-byte prefixes, a third region-scoped:219 ms per compute, served from cache for 30 s (24h) or 5 min (7d); a 425 KB uncompressed response for 1,200 rows. This is new code with no "before"; the declared view's numbers are untouched (same scan, same cache).
On real data (pre-prod: a copy of the production database and the live feed)
mode=transport, 24hmode=transport&scope=eng-ne, 7dmode=transport&scope=%23SCO, 7d (same window, now cached)sco: 237 carrying, 427 notThe 7d cold compute is the same full-window hop scan the declared view already pays for 7d (its own TTL comment measures 16.7 s on a live-shaped database); like the declared view it is then cached for 5 minutes, and every scope filter is served from that one scan.
c08c5026renamed the filter fromregion=toscope=after opening (see the comment below); the real-data figures above were taken before the rename and are otherwise the same code.Tests
b2e10dba: response types and amode=transportstub that returns no rows, plus tests. Four fail on the stub:asked: falseand null declared fields (and the answered one with its declared list andnotObserved);scope=fr/%23fr/FRmarks carriers and non-carriers and counts them; no scope means nocarriesScopeor counts;4133ae40: the implementation,docs/api-spec.md(newmodeandscopeparameters, a Transport view section with the response shape), and the benchmark.make test: 16 of 16 modules pass, including every existing scope-audit test.Review notes
newTestStoreWithDBnow takestesting.TBso the benchmark can use it (callers unchanged).map[string]interface{}; the response is a named struct.🤖 Generated with Claude Code
https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H