feat: dashboard X-ray + hub hardening + output-side proof line — Build 4 - #59
Merged
Conversation
…t-side proof line
- dashboard: exported pure xrayState (per-source events/raw/stored/saved sums,
legacy events bucket under mcp) + optional DashboardDeps.xray getter; PAGE
gains an X-ray panel (per-source table + the exact receipt text); index.ts
wires readSessionMark + activity.since + buildReceipt — SAME math as the
stop receipt, one aggregation, two surfaces
- hub server: per-address fixed-window rate limit (60/10s default, injectable
clock, bounded bucket map, /health exempt, gate before auth) -> 429; board
bounded at 500 entries (newest kept, writeAtomic rewrite only at cap).
Timing-safe auth + 1MB body cap were already present — unchanged.
- hub client: mirrorToHub 3 attempts (250/1000ms backoff), fetchHubBoard 2
attempts (300ms); network/5xx retry only — 4xx never retried
- receipt: output-side PROOF line — actual output tokens written this session
(transcript snapshot delta) + terse-mode-ON note; explicitly never counted
in 'avoided' (no provable counterfactual — honest-math rule holds)
Live-verified: dashboard /api/state bySource sums exact vs seeded ledger and
its receipt string matches the stop hook's ('avoided 9.0k' both surfaces).
verify EXIT=0 (596 tests).
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.
What (Build 4 — docs/LOOP-ENGINEERING.md Tier-3.9/G8)
Verification
rm -rf dist && npm run verifyEXIT=0 (596 tests). Live: seeded 3-door ledger → dashboard bySource sums exact; X-ray receipt == stop receipt; rate-limit 429 + eviction covered by injected-clock tests.Read-only over existing stores; no new MCP tools; no bump.