feat(scope-audit): one colour-coded Scopes column instead of three - #6
Merged
Conversation
The audit table printed DECLARED, NOT OBSERVED and UNDECLARED OBSERVED side by side. The first two were never independent: notObserved is a strict subset of declaredRegions, so the page showed the same set twice, once whole and once filtered, and left the reader to diff them. Measured on a live 197-row response before changing anything: notObserved is a subset of declaredRegions : 197 of 197 rows, no exceptions all declared regions observed : 7 rows none observed : 78 rows mixed : 44 rows no declared regions at all : 68 rows The 44 mixed rows are the ones that cost the reader time. They declare 8.3 regions on average of which 6.5 are unobserved, so usually one or two are green. BE-TUR-REP1_ON3FNZ declares 20 regions and lists 19 under NOT OBSERVED; the only difference is that "be" is missing from the second list. Finding that today means comparing two lists of twenty. Now it is one green chip among nineteen red. UNDECLARED OBSERVED is dropped. A repeater does not forward a scope it has not been configured with, so the column cannot fill except transiently when an owner REMOVES scopes while older messages are still inside the window, which is an artefact of the window rather than a fault worth a column. Confirmed empty on all 197 rows at both 24h and 7d. Nothing is lost: the STATUS column already renders an "N undeclared" badge for that case, and undeclaredObserved still feeds statusScore and the search index, both untouched. Sorting keys off notObserved, which is what the page ranks by anyway. Declared order is preserved rather than regrouped by colour, so a region stays in the position an operator is used to scanning. Verification: 8 new cases in test-frontend-helpers.js asserting the RENDERED markup through a new window.__meshcoreScopeAuditInternals handle, following map.js (Kpa-clawbot#1356/Kpa-clawbot#1933) rather than grepping source. Suite 662 to 670 passed, 0 failed. Then every one of the 197 live rows was pushed through the real function: 7 all-green, 78 all-red, 44 mixed, 68 empty, reproducing the independently computed figures exactly, and 793 chips against 793 declared regions so no chip is invented or dropped. Colours use existing variables (--status-green, --status-green-text) alongside the --status-red the missing chip already used, so the two read as one scale. Dead code removed: scopeChips and undeclaredChips had no remaining callers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PQS3XLoPD98yu9pxdRujqg
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.
Step one of getting the Scope Audit page ready to propose upstream. The page does not exist on
Kpa-clawbot/CoreScopeat all (no frontend, no route, no server code, zero grep hits), so it gets finished here first.The problem
DECLARED, NOT OBSERVED and UNDECLARED OBSERVED sat side by side, and the first two were never independent.
notObservedis a strict subset ofdeclaredRegions, so the table printed the same set twice, once whole and once filtered, and left the reader to diff them.Measured on a live 197-row response before changing anything:
notObservedis a subset ofdeclaredRegionsThe 44 mixed rows are where the reader pays. They declare 8.3 regions on average of which 6.5 are unobserved, so usually only one or two are green.
BE-TUR-REP1_ON3FNZdeclares 20 regions and lists 19 under NOT OBSERVED; the sole difference is thatbeis missing from the second list. Finding that today means comparing two lists of twenty. Now it is one green chip among nineteen red.Why UNDECLARED OBSERVED is gone rather than restyled
My first instinct was to keep it as a third chip colour, on the reasoning that a zero today does not prove the case is impossible. That reasoning was wrong: a repeater does not forward a scope it has not been configured with, so the column cannot fill at all, except transiently when an owner removes scopes while older messages are still inside the window. That is an artefact of the window, not a fault, and promoting it to a warning colour would have turned noise into an alert.
Nothing is lost by dropping it. The STATUS column already renders an
N undeclaredbadge for that case, andundeclaredObservedstill feedsstatusScoreand the search index, both untouched. Confirmed empty on all 197 rows at both 24h and 7d, which is consistent with it only ever arriving from stale history: a longer window would be more likely to show it, not less.Verification
Eight new cases in
test-frontend-helpers.jsassert the rendered markup through a newwindow.__meshcoreScopeAuditInternalshandle, followingmap.js(Kpa-clawbot#1356/Kpa-clawbot#1933) instead of grepping the source. Suite goes 662 → 670 passed, 0 failed. They cover observed vs missing colouring, one chip per declared region and no more, declared order preserved rather than regrouped by colour, an em dash instead of an empty cell for the 68 rows that declare nothing, each chip explaining its own colour in a title, HTML escaping of server-supplied names, and a defensive case where anotObservedentry that is not declared cannot invent a phantom chip.Then every one of the 197 live rows was pushed through the real function:
793 chips against 793 declared regions, so no chip is invented and none dropped.
Notes
notObserved, which is what the page ranks by anyway. The separate sort-by-declared-count axis is gone with the column; say so if you used it.--status-green/--status-green-textvariables alongside the--status-redthe missing chip already used, so the two read as one scale. No hardcoded hex.scopeChipsandundeclaredChipshad no remaining callers./api/scope-auditstill returnsundeclaredObserved, so this is frontend-only and reversible.Next
Once you are happy with the page here, the upstream step is a proposal to contribute the whole feature:
scope-audit.js(331 lines),scope-audit.css, threeindex.htmlwiring lines, plus the server half inscopes.goandroutes.gowith its existing tests inscopes_test.go.