Skip to content

feat: dashboard X-ray + hub hardening + output-side proof line — Build 4 - #59

Merged
PDgit12 merged 1 commit into
mainfrom
feat/xray-hub
Jul 7, 2026
Merged

feat: dashboard X-ray + hub hardening + output-side proof line — Build 4#59
PDgit12 merged 1 commit into
mainfrom
feat/xray-hub

Conversation

@PDgit12

@PDgit12 PDgit12 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What (Build 4 — docs/LOOP-ENGINEERING.md Tier-3.9/G8)

  • X-ray: dashboard renders per-source token flow (mcp/hook/proxy), top sinks, and the exact session receipt — reusing buildReceipt + activity.since (one aggregation, two surfaces; live-verified numbers identical to the stop hook's).
  • Hub hardening: per-address rate limit → 429 (injectable for tests), board bounded at 500 newest, client retry with backoff (4xx never retried). Timing-safe auth + 1MB cap were already in place — verified, unchanged.
  • Output-side proof (user ask): receipt now shows actual output tokens written + terse-mode-ON note — provable facts only; explicitly excluded from 'avoided' (counterfactual unknowable).

Verification

rm -rf dist && npm run verify EXIT=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.

…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).
Copilot AI review requested due to automatic review settings July 7, 2026 08:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@PDgit12
PDgit12 merged commit 9f5521c into main Jul 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants