Skip to content

Gitmoot: GITMOOT-COC: IMPLEMENT #1230 PR 2 — the WAKE-LEDGER - #137

Merged
jerryfane merged 5 commits into
mainfrom
gitmoot/adhoc-f24424c5
Jul 29, 2026
Merged

jerryfane merged 5 commits into
mainfrom
gitmoot/adhoc-f24424c5

Conversation

@jerryfane

Copy link
Copy Markdown
Collaborator

WHAT:
GALAXY-IMPL: Implemented the wake-ledger API bridge and responsive Overview UI on branch gitmoot/adhoc-f24424c5. PR number is pending Gitmoot delivery because this runtime explicitly forbids commit/push operations.

WHY:
Gitmoot finalized this implementation from a task worktree.

CHANGES:

  • Committed changes from /root/.gitmoot/worktrees/gitmoot--gitmoot-dashboard/adhoc-f24424c5

RESULTS:

  • node --check extracted SPA script: exit 0
  • go build ./...: exit 0
  • go vet ./...: exit 0
  • go test ./...: exit 0
  • git diff --check: exit 0
  • Playwright desktop 1440x900 and mobile 390x844: badge=5, urgent ordering correct, role/time receipt filters passed, raw fixture payload absent, one shared /api/events stream per page, no console errors.
  • Playwright fallback checks: wake endpoints returning 404 show the newer-build message; 503 shows unavailable without inferring a clear ledger; exit 0.
  • Playwright #1194 fixture: unset started timestamp renders '-' on desktop and omits duration on mobile; exit 0.
  • Screenshots: /tmp/wake-ledger-desktop.png and /tmp/wake-ledger-mobile-panel.png.

RISK:
Review the generated diff before merging.

TASK:
adhoc-f24424c5

AGENTS:

  • galaxy-impl

RAW FINAL REVIEW OUTPUT:

GALAXY-IMPL: Implemented the wake-ledger API bridge and responsive Overview UI on branch gitmoot/adhoc-f24424c5. PR number is pending Gitmoot delivery because this runtime explicitly forbids commit/push operations.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-impl
Runtime: codex
Job: local-implement-galaxy-impl-18c6935e3ec4c0ec

Decision: implemented
Summary: GALAXY-IMPL: Implemented the wake-ledger API bridge and responsive Overview UI on branch gitmoot/adhoc-f24424c5. PR number is pending Gitmoot delivery because this runtime explicitly forbids commit/push operations.

Findings

  • The assumed contract is: summary {outstanding,pending,aged_attempted,delivery_unknown,stalled,oldest_age_seconds}; wake rows {id,target_role,source_kind,source_id,state,attempt_count,last_error,age_seconds,created_at,attempted_at}; receipt rows {id,target_role,source_kind,state,attempt_count,delivered_at}.
  • Although the UI never renders raw last_error, the public endpoint still transmits it. PR 1 should redact or classify this field server-side before public deployment.

Changes Made

  • Added optional WakeDataSource and exact wire types in datasource.go:462-527, with non-null row envelopes.
  • Added validated metadata-only handlers and routes for /api/wakes/summary, /api/wakes, and /api/wakes/receipts in api.go:401-470 and server.go:38-40.
  • Added deterministic fixtures and API contract, filtering, normalization, fallback, and determinism tests in fakefeed.go:728-830 and api_test.go:405-503.
  • Added an always-visible wake-obligations tile and full ledger panel in web/dist/index.html:1423-1509. Aging obligations use the loudest treatment; delivery_unknown and stalled sort first.
  • Added receipt history filtered by role and 1h/6h/24h/7d/all time ranges.
  • Bounded last_error by inspecting at most 256 characters and emitting only fixed classes: TIMEOUT, RATE LIMITED, AUTH, NOT FOUND, TRANSPORT, or DELIVERY ERROR. Raw strings never enter rendered HTML.
  • Reused the existing shared /api/events SSE fan-out and Overview refresh path. No EventSource or per-connection server poller was added.
  • Applied the cheap #1194 truthfulness fix across Jobs, Tasks linked jobs, Agents recent runs, and both job inspectors: durations require a real started timestamp. #1224 was not expanded because no corresponding job fields exist in this contract.

Tests Run

  • node --check extracted SPA script: exit 0
  • go build ./...: exit 0
  • go vet ./...: exit 0
  • go test ./...: exit 0
  • git diff --check: exit 0
  • Playwright desktop 1440x900 and mobile 390x844: badge=5, urgent ordering correct, role/time receipt filters passed, raw fixture payload absent, one shared /api/events stream per page, no console errors.
  • Playwright fallback checks: wake endpoints returning 404 show the newer-build message; 503 shows unavailable without inferring a clear ledger; exit 0.
  • Playwright #1194 fixture: unset started timestamp renders '-' on desktop and omits duration on mobile; exit 0.
  • Screenshots: /tmp/wake-ledger-desktop.png and /tmp/wake-ledger-mobile-panel.png.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: lead
Runtime: claude
Job: workflow-2hlx65hb990p0

Decision: changes_requested
Summary: Wake-ledger API + Overview panel are well-structured and follow the repo's optional-interface conventions (404 when unsupported, nil-row normalization, 400 on bad state/since, XSS-safe escaping, client-side error classification, fetch-token race guard). Two issues block: (1) WakeRow.LastError is serialized verbatim over GET /api/wakes even though its own doc comment says it may carry message payload content and the fixtures deliberately embed secrets — the UI's on-screen promise that 'raw error strings are never displayed' is not true of the endpoint; classification belongs server-side. (2) The Overview panel shows a header count of 5 over a 6-row 'Outstanding ledger' list against the shipped fake, because the list filter only excludes 'delivered' while the summary excludes 'failed'. Two lower-severity items noted (limit=100 with no state filter can be consumed by delivered rows on a real bridge; 'problem' amber styling fires on any outstanding wake, including normal in-flight pendings). NOTE: the go build/vet/test gate could NOT be run — every 'go' command was denied by the sandbox — so test results are unverified; review is static only.

Findings

  • WakeRow.LastError leaks message payload content through the public API (high)
    • detail: The field's own comment states it 'is untrusted and may contain payload content; public clients must not render it verbatim', and fakefeed.go:731-745 deliberately embeds payloads in it ('owner decision: rotate the private signing key', 'use the unredacted customer fixture'). The handler passes it straight to writeJSON, so anyone hitting GET /api/wakes — or opening the browser Network tab — sees the raw text. The UI panel simultaneously prints 'Metadata only. Delivery error text is classified; raw error strings are never displayed' (web/dist/index.html:1493), which is true of this client but false of the contract. Since _wakeErrorClass already reduces it to one of six fixed labels, the raw string serves no client purpose. Fix: classify in the handler and emit error_class instead of last_error, or redact before serialization.
    • file: datasource.go
    • line: 481
  • Outstanding count and outstanding list disagree (6 rows under a count of 5) (medium)
    • detail: The list filter is .filter(r=>r&&r.state!=='delivered'), so 'failed' wakes render in the 'Outstanding ledger' pane. The summary's outstanding (fakefeed.go WakeSummary: 5) counts only pending(2)+attempted(1)+delivery_unknown(1)+stalled(1) and excludes 'failed'. Against the shipped fake the panel therefore renders 6 rows beneath a header count of 5, and wake-failed-001 matches none of the pending/aged-attempted/delivery-unknown/stalled chips. Reproducible today via go run ./cmd/gitmoot-dashboard-dev. Decide whether a failed wake is an outstanding obligation and make both surfaces agree.
    • file: web/dist/index.html
    • line: 1482
  • limit=100 with no state filter lets delivered rows starve the outstanding list (low)
    • detail: The client requests /api/wakes?limit=100 unfiltered and drops delivered rows client-side. The published state enum (api.go validWakeState) includes 'delivered', so a bridge whose Wakes() returns delivered rows in the default listing will consume the server-side limit before outstanding rows are reached; the panel then silently under-reports while the header count stays high. Not reproducible against FakeDataSource (it holds no delivered rows in fakeWakeRows). Either send an explicit filter, or define GET /api/wakes as outstanding-only in the interface doc.
    • file: web/dist/index.html
    • line: 1448
  • 'problem' styling triggers on any outstanding wake, including healthy in-flight ones (low)
    • detail: problem = outstanding>0 || unknown>0 || stalled>0 drives the amber tile and amber panel border. A 3-minute-old pending wake (wake-pending-002, age 180s) is normal delivery-system state, so under routine operation the Overview tile is permanently amber, desensitizing operators to the aged/red signal that actually matters. Consider gating 'problem' on aged_attempted/delivery_unknown/stalled and letting plain pending stay neutral.
    • file: web/dist/index.html
    • line: 1478
  • wakeLimit clamping is untested (low)
    • detail: wakeLimit handles empty/non-numeric/zero/negative (-> 100) and >500 (-> 500), but no test exercises any of those branches; TestFakeWakeLedgerContractFiltersAndDeterminism only passes valid limits (100, 1, 10). A regression that dropped the wakeMaxLimit clamp would ship green.
    • file: api.go
    • line: 250

Tests Run

  • go build ./... — BLOCKED: sandbox denied the command, not executed
  • go vet ./... — BLOCKED: sandbox denied the command, not executed
  • go test ./... — BLOCKED: sandbox denied the command, not executed
  • static review of api.go / datasource.go / server.go / fakefeed.go / api_test.go and the web/dist/index.html wake panel (imports, receiver types, interface satisfaction, MarshalIndent vs test assertions, escaping, fetch/race/listener lifecycle) — completed

Needs

  • A maintainer or CI must run go build ./... && go vet ./... && go test ./...; this reviewer's sandbox denied all go commands, so the gate is unverified.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-review
Runtime: codex
Job: local-review-galaxy-review-18c6950e954ca412

Decision: failed
Summary: checkout /root/.gitmoot/worktrees/gitmoot--gitmoot-dashboard/adhoc-f24424c5 has uncommitted changes
Diagnostics: checkout /root/.gitmoot/worktrees/gitmoot--gitmoot-dashboard/adhoc-f24424c5 has uncommitted changes

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-impl
Runtime: codex
Job: local-implement-galaxy-impl-18c695c8315b8107

Decision: implemented
Summary: GALAXY-IMPL: I authored the salvaged classification code in the preceding pass, then independently reviewed and improved it. The public leak is fixed locally; current pushed head remains 9ec5ceb because Gitmoot runtime instructions prohibit manual commit/push.

Findings

  • The 256-byte bound is safe for classification, but the salvaged version lowercased before truncating and therefore did unbounded work. The implementation now truncates first.
  • Public last_error is now restricted to empty or TIMEOUT, RATE LIMITED, AUTH, NOT FOUND, TRANSPORT, DELIVERY ERROR. Unknown text maps to DELIVERY ERROR and cannot leak source content.
  • Classification is deliberately lossy. A marker after byte 256 becomes DELIVERY ERROR, which is safer than inspecting or returning unbounded text.

Changes Made

  • api.go:19-31 defines the scan bound and fixed public classes.
  • api.go:280 adds the bounded server-side classifier; handleWakes rewrites every LastError before writeJSON.
  • datasource.go:472 documents that data sources may provide raw text but the public handler emits only a fixed class.
  • api_test.go:435 adds table coverage for empty, all classes, precedence, generic fallback, and bounded scanning.
  • api_test.go:506 adds the endpoint regression asserting fixture secrets are absent and expected classes are serialized.
  • Preserved /tmp/salvage_137_errorclass.patch unchanged.

Tests Run

  • Fail-before-fix command: go test . -run '^TestFakeWakeLedgerContractFiltersAndDeterminism$' -count=1. With the handler rewrite temporarily removed it exited 1 at api_test.go:506: wake API leaked raw delivery error "rotate the private signing key"; the response also exposed both raw payload-bearing last_error strings.
  • After restoring the handler, the same focused regression exited 0.
  • go build ./...: build=0
  • go vet ./...: vet=0
  • go test ./...: test=0; 107 test/subtest pass events, 0 skips.
  • Live GET /api/wakes?limit=6 returned fixed TRANSPORT, TIMEOUT, and AUTH classes; live_secret_leak=0.
  • git diff --check: exit 0.

Needs

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

GALAXY-REVIEW: Changes requested for head d085116c0db4f94d8333e08148682ac0c8233fc9.

The public last_error leak is closed and the Go gate passes. One independent browser finding still blocks merge: the page reports 5 outstanding wakes but renders 6 rows in the “Outstanding ledger,” including a terminal failed row.

Findings

  1. Blocking — outstanding count and ledger rows disagree. web/dist/index.html:1482 excludes only delivered, so failed remains in the outstanding list. fakefeed.go:782-785 reports Outstanding: 5, excluding the failed fixture. A live browser run rendered header count 5 with six states: delivery_unknown, stalled, two pending, attempted, and failed. Define whether failed remains outstanding, then align the summary and row filter.

  2. Pass — the raw-error leak is closed on the wire. api.go:472-477 rewrites every WakeRow.LastError through wakeErrorClass before the only writeJSON that emits WakeRows. State/role/limit variants all use this handler. Receipts are a separate WakeReceipt shape with no error field (datasource.go:493-506) and route through handleWakeReceipts (api.go:480-506). Live GETs returned:

    • /api/wakes?limit=100: only TRANSPORT, TIMEOUT, AUTH, and empty last_error values; no raw payload text.
    • /api/wakes?state=delivery_unknown&role=lead&limit=1: last_error: "TRANSPORT".
    • /api/wakes?state=stalled&role=g4&limit=1: last_error: "TIMEOUT".
    • /api/wakes/receipts?role=lead&since=2026-07-28T22:00:00Z&limit=10: delivered receipt metadata and no error field.
  3. Pass with a non-blocking classifier caveat. api.go:277-301 truncates to 256 bytes before lowercasing and returns only the fixed set "", TIMEOUT, RATE LIMITED, AUTH, NOT FOUND, TRANSPORT, or DELIVERY ERROR; output cannot leak input. Empty maps to empty, and unmatched input maps deliberately to DELIVERY ERROR. A crafted string can steer the heuristic: connection reset while sending payload auth token maps to AUTH because auth has higher precedence than transport. That is lossy/misleading metadata, not a disclosure, so the class should not be treated as ground truth.

  4. Pass — prior criteria did not regress.

    • Shared watcher: api.go:32-130 retains one server watcher, and api_test.go:222-267 proves two clients share one baseline/poller.
    • Badge prominence: web/dist/index.html:1399-1400,1504-1505; browser-computed tile class was ov-tile wake aging, with red-tinted background and border.
    • XSS escaping: web/dist/index.html:1415,1483-1493; hostile role/source/id strings rendered as text, with zero injected img, svg, or script nodes and no payload execution.
    • Honest degradation: web/dist/index.html:1458-1481,1504; mocked fresh 503 responses rendered - in the badge and “temporarily unavailable. No clear state is being inferred,” never a fake zero.

Commands and outcomes

  • Fresh clone/fetch/checkout: exit 0; git rev-parse HEAD = d085116c0db4f94d8333e08148682ac0c8233fc9.
  • Live fake-server probe: go test -run 'TestGalaxy(LiveGET|ClassifierAttack)$' -v -count=1 . — exit 0; 2 passed, 0 skipped. The temporary probe was removed.
  • Fail-before-fix proof: with only the handler rewrite temporarily removed, go test -run '^TestFakeWakeLedgerContractFiltersAndDeterminism$' -count=1 . — expected exit 1; 0 passed, 1 failed, 0 skipped. It failed at api_test.go:506 after returning the raw private-key payload.
  • Restored regression: same command — exit 0; 1 passed, 0 skipped. git diff --exit-code -- api.go — exit 0.
  • Required unpiped gate with shared caches:
    • go build ./... — exit 0.
    • go vet ./... — exit 0.
    • go test ./... — exit 0; 107 test/subtest pass events, 0 skipped, 0 failed.
  • Shared-watcher focus: go test -run '^(TestHandleChangeEventsHeadersHeartbeatAndNoReplay|TestHandleChangeEventsRegistryCapAndCleanup)$' -v -count=1 . — exit 0; 2 passed, 0 skipped.
  • Wake-contract focus: go test -run '^(TestHandleWakeLedgerUnsupportedDataSource|TestHandleWakeLedgerNormalizesNilRows|TestWakeErrorClass|TestFakeWakeLedgerContractFiltersAndDeterminism)$' -v -count=1 . — exit 0; 12 test/subtest pass events, 0 skipped.
  • Independent Playwright checks: initial Chromium launch exited 1 before opening a page because root sandboxing was enabled; rerun with chromiumSandbox: false exited 0. Live render, hostile-XSS, and fresh-503 degradation checks: 3 passed, 0 skipped.
  • Final git diff --exit-code — exit 0; clone remained detached and clean at the named head.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-review
Runtime: codex
Job: local-review-galaxy-review-18c696405a937453

Decision: changes_requested
Summary: GALAXY-REVIEW: Changes requested for head d085116. The public last_error leak is closed and the Go gate passes, but the UI reports 5 outstanding wakes while rendering 6 ledger rows. Review posted to PR #137: #137 (comment)

Findings

  • BLOCKING — web/dist/index.html:1482 excludes only delivered rows, so failed remains in the Outstanding ledger; fakefeed.go:782-785 reports Outstanding: 5 while the live page renders six rows, including failed.
  • PASS — api.go:472-477 classifies every WakeRow before writeJSON. Live unfiltered and filtered GETs returned only TRANSPORT, TIMEOUT, AUTH, or empty values; datasource.go:493-506 receipts expose no error field.
  • NON-BLOCKING — api.go:277-301 returns only fixed classes and truncates before classification, so output cannot leak. Crafted text can steer the heuristic; for example, a transport error containing 'auth token' maps to AUTH.
  • PASS — api.go:32-130 and api_test.go:222-267 retain one shared watcher rather than a per-connection poller.
  • PASS — web/dist/index.html:1399-1400,1504-1505 gave the wake badge prominent aging styling.
  • PASS — web/dist/index.html:1415,1483-1493 escaped hostile values; no injected img, svg, or script nodes executed.
  • PASS — web/dist/index.html:1458-1481,1504 rendered '-' and an unavailable message for fresh 503 responses, not a false zero.

Changes Made

Tests Run

  • Fresh clone/fetch/checkout and HEAD verification: exit 0; head d085116.
  • Live fake-server probe: exit 0; 2 passed, 0 skipped. /api/wakes and filtered variants returned fixed classes without raw payloads; receipts returned metadata without an error field.
  • Regression with handler substitution removed: expected exit 1; 0 passed, 1 failed, 0 skipped; raw private-key payload reproduced. After restoration: exit 0; 1 passed, 0 skipped; api.go diff exit 0.
  • go build ./...: exit 0.
  • go vet ./...: exit 0.
  • go test ./...: exit 0; 107 test/subtest pass events, 0 skipped, 0 failed.
  • Shared-watcher focused tests: exit 0; 2 passed, 0 skipped.
  • Wake-contract focused tests: exit 0; 12 test/subtest pass events, 0 skipped.
  • Playwright initial launch: exit 1 before page load due Chromium root sandboxing; configured retry: exit 0. Live render, hostile-XSS, and fresh-503 checks: 3 passed, 0 skipped.
  • Final git diff --exit-code: exit 0.

Needs

  • Align failed-wake semantics between the summary and Outstanding ledger before merge.
    Diagnostics: workflow advance failed: workflow blocked: branch lock rejected action for gitmoot/adhoc-f24424c5

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-impl
Runtime: codex
Job: local-implement-galaxy-impl-18c696d361ac5e60

Decision: implemented
Summary: GALAXY-IMPL: Fixed the outstanding-count drift locally. Current pushed head remains d085116 because runtime instructions prohibit manual commit/push; Gitmoot delivery must publish the new commit.

Findings

  • Outstanding means pending, attempted, stalled, or delivery_unknown. Failed and delivered are terminal and excluded; failed remains queryable through /api/wakes?state=failed.
  • The classifier’s heuristic can be steered into another fixed diagnostic class, but no disclosure or control-flow consequence exists. Keeping it is appropriate for this PR.

Changes Made

  • Added WakeSummary.Rows as the authoritative candidate row set.
  • handleWakeSummary applies the single Go outstanding-state classifier, sanitizes errors, and then assigns Outstanding = len(Rows). Count and rows therefore come from one server-side representation.
  • Older data sources with nil summary rows fall back to state-specific Wakes queries using the same canonical state list.
  • The SPA now renders summary.rows directly and makes no separate /api/wakes row request or client-side state-filter decision.
  • Fake summary deliberately supplies all six candidate rows; the handler reduces them to five outstanding rows, proving failed is excluded at the server boundary.
  • The confirmed leak fix remains intact, including fixed error classes on both summary and general wake responses. /tmp/salvage_137_errorclass.patch remains untouched.

Tests Run

  • Regression path: api_test.go:435, TestFakeWakeSummaryOutstandingRowsCannotDrift.
  • Fail-before-fix command: go test . -run '^TestFakeWakeSummaryOutstandingRowsCannotDrift$' -count=1. With canonicalization removed it exited 1 at api_test.go:447: outstanding badge=5 but ledger rows=6.
  • After restoration, the same focused test exited 0.
  • Live summary probe: outstanding=5, rowCount=5; states were delivery_unknown, stalled, attempted, pending, pending; no terminal rows or raw errors.
  • Playwright: badge=5 and rendered rows=5; stalled and delivery_unknown present; failed absent; no separate /api/wakes? row request; no console errors.
  • go build ./...: build=0
  • go vet ./...: vet=0
  • go test ./...: test=0; 108 test/subtest pass events, 0 skips.
  • node --check and git diff --check: exit 0.

Needs

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-impl
Runtime: codex
Job: local-implement-galaxy-impl-18c69749f7af3664

Decision: implemented
Summary: GALAXY-IMPL: Added failed to the canonical outstanding wake states. Engine delivery is pending; resulting head is unknown to me.

Changes Made

  • Canonical outstanding states are now pending, attempted, stalled, delivery_unknown, and failed; only delivered is excluded.
  • Updated the fake summary and contract assertions from 5 to 6 outstanding obligations.
  • Badge/row agreement remains single-sourced: the server classifies rows, sets Outstanding=len(Rows), and the SPA renders summary.rows without reclassification.

Tests Run

  • Regression: go test . -run '^TestFakeWakeSummaryOutstandingRowsCannotDrift$' -count=1 passed with the fix.
  • Fail-before-fix proof: removing failed produced outstanding=5, want 6 including failed wake and exit 1; restoring it passed.
  • go build ./...: build=0
  • go vet ./...: vet=0
  • go test ./...: test=0; 108 test pass events, 0 skips.
  • Live fake-server contract: outstanding=6, rows=6, failed present, delivered absent, and no raw fixture secrets; exit 0.
  • git diff --check: exit 0.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Review record — reconciliation of two independent passes

Posted by gitmoot-coc as a relay, not as a review. This comment describes review records; it is deliberately not formatted as a verdict and must not be read or matched as one. The authoritative records are the job payloads cited below.

First pass — read-only, at head 9ec5ceb916a9 (now superseded).
Job local-ask-research-sol-d-18c69483baf7e821, seat research-sol-d. It asked for changes on one blocking issue: WakeRow.LastError was serialized verbatim and returned by /api/wakes, so the public endpoint could return raw delivery-error text embedding payload content. It confirmed this with a live GET rather than by reading the diff. It was explicit that it could not run the full gate and did not claim one.

That finding has since been FIXED — it is not an outstanding objection. It is recorded here only so the superseded record is not mistaken for a live blocker.

Second pass — gated, at head d085116c0db4.
Job local-review-galaxy-review-18c696405a937453, seat galaxy-review, distinct from the implementer. It verified the leak closed at source (every row classified before serialization, confirmed by live unfiltered and filtered requests, and the receipts path carries no error field), with the Go gate passing. It then asked for changes on a separate issue: the obligations count and the rendered ledger disagreed — the badge reported 5 while six rows rendered, because the client excluded only delivered.

Third pass — the count issue, at head 74545de13c9c.
That disagreement was resolved by single-sourcing rather than by aligning the two filters: the count is now derived from the same server-side classifier that produces the rows, so the two cannot drift apart. The canonical state list was then corrected to treat failed as outstanding, per the ruling that an obligation is outstanding unless it is delivered — failed, stalled and delivery_unknown exist precisely when a wake did not reach its target, so hiding them from the badge would rebuild the false signal this surface exists to prevent.

Both original findings are closed at the current head. Verify at the job records above rather than at this summary.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

GALAXY-REVIEW: Changes requested at exact head 74545de13c9c787fc7710444dfe718ee3384e5d5.

Both original behavioral findings are closed at this head: raw delivery errors do not leak, and the live badge/header/row count is 6 with failed rendered end to end. The PR is not yet done because the committed count-drift regression stays green when the critical server-side count derivation is deleted.

Findings

  1. Blocking — the count-drift regression does not protect the derivation. The implementation is correct at api.go:475-488: it filters/classifies one candidate slice, assigns it to summary.Rows, then derives summary.Outstanding = len(summary.Rows). However, TestFakeWakeSummaryOutstandingRowsCannotDrift (api_test.go:435-464) uses FakeDataSource, whose source fixture already supplies matching Outstanding: 6 and six rows (fakefeed.go:781-786). I removed only summary.Outstanding = len(summary.Rows) and both that test and TestFakeWakeLedgerContractFiltersAndDeterminism still exited 0. A temporary probe with an intentionally stale source count (Outstanding: 99) failed on both candidate-row and legacy nil-row paths when the derivation was removed. Commit that shape of test so dropping the single-source derivation cannot ship green.

  2. Pass — failed is canonical and its regression fails correctly. wakeOutstandingStates contains failed at api.go:277-283, and it is the only server definition of outstandingness. Removing failed made TestFakeWakeSummaryOutstandingRowsCannotDrift fail with outstanding=5, want 6 including failed wake. The restored test asserts both Outstanding == 6 and presence of all five canonical states at api_test.go:446-461.

  3. Pass — count and rendered rows are structurally joined. handleWakeSummary handles both source-provided rows and legacy Rows == nil sources, passes candidates through publicWakeRows(..., true), and derives count from that exact result (api.go:475-488). Independent probes with a bogus source count confirmed both paths return count 2 with the same two rendered candidates. The SPA requests /api/wakes/summary, extracts summary.rows, and stores the same summary object (web/dist/index.html:1445-1464); it renders that array directly without a state filter (web/dist/index.html:1481-1485). _wakeStateRank at line 1433 is a presentation-only sort map, not an outstanding-state definition. Cached snapshots also preserve the same summary and row pair together.

  4. Pass — the public leak remains closed on every row-emitting path. publicWakeRows classifies LastError at api.go:320-329; both summary and list handlers use it before writeJSON (api.go:486-488,513-514). Live GET results:

    • /api/wakes/summary: HTTP 200, outstanding: 6, six rows, fixed classes TRANSPORT, TIMEOUT, AUTH, or empty; no raw payload text.
    • /api/wakes?limit=100: HTTP 200, six rows with the same fixed classes; no raw payload text.
    • /api/wakes?state=failed&role=herdres&limit=1: HTTP 200, one failed row with last_error: "AUTH".
  5. Pass — rendered surface. A real browser showed header count 6, Today tile 6, six .ov-wake-row elements, exactly one failed row, and no raw fixture payload. No console errors occurred.

Commands and outcomes

  • Fresh clone/fetch/checkout and git rev-parse HEAD: exit 0; exact head 74545de13c9c787fc7710444dfe718ee3384e5d5.
  • Baseline regressions: go test -run '^(TestFakeWakeSummaryOutstandingRowsCannotDrift|TestFakeWakeLedgerContractFiltersAndDeterminism)$' -v -count=1 . — exit 0; 2 passed, 0 skipped.
  • Remove failed from wakeOutstandingStates: go test -run '^TestFakeWakeSummaryOutstandingRowsCannotDrift$' -count=1 . — expected exit 1; 0 passed, 1 failed, 0 skipped. Restored afterward.
  • Delete summary.Outstanding = len(summary.Rows): the two committed regression tests above exited 0; 2 passed, 0 skipped. This is the blocking test gap.
  • Temporary inconsistent-source probe, restored code: exit 0; 3 test/subtest pass events, 0 skipped. With the derivation deleted: expected exit 1; 0 passed, 3 failed, 0 skipped. Temporary probe removed.
  • Live fake-server GET probe: exit 0; 1 passed, 0 skipped. Temporary probe removed.
  • Playwright live-render check: browser open/snapshot/evaluation exit 0; 1 rendered-state check passed, 0 skipped; console errors 0.
  • Required unpiped shared-cache gate:
    • go build ./... — exit 0.
    • go vet ./... — exit 0.
    • go test ./... — exit 0; 108 test/subtest pass events, 0 skipped, 0 failed.
  • Final clean-check: git diff --exit-code — exit 0; detached clone remained clean at the exact head.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-review
Runtime: codex
Job: local-review-galaxy-review-18c6986366b7ce8c

Decision: changes_requested
Summary: GALAXY-REVIEW: Changes requested at head 74545de. Both original behavioral findings are closed, but the committed count-drift regression remains ineffective when the critical count-derivation line is removed. Verdict posted to #137 (comment)

Findings

  • BLOCKING — api_test.go:435-464 uses FakeDataSource, whose fakefeed.go:781-786 fixture already supplies matching Outstanding: 6 and six rows. Removing api.go:487 (summary.Outstanding = len(summary.Rows)) left both committed drift tests green. Add an intentionally inconsistent source count so this regression fails if derivation is removed.
  • PASS — api.go:277-283 canonically includes failed. Removing it produced the expected regression failure: outstanding=5, want 6 including failed wake.
  • PASS — api.go:475-488 derives count and rows from one classified collection for source-provided and legacy nil-row paths. web/dist/index.html:1445-1464 consumes summary.rows, and lines 1481-1485 render it without an outstanding-state filter. The client state map at line 1433 controls sorting only.
  • PASS — api.go:320-329 classifies errors, and both summary and list handlers apply it before serialization at api.go:486-488 and api.go:513-514. Live responses contained only fixed classes and no raw payload text.
  • PASS — the browser rendered header 6, tile 6, six rows, exactly one failed row, and no raw fixture payload; console errors were zero.

Changes Made

Tests Run

  • Fresh clone/fetch/checkout and HEAD verification: exit 0; exact head 74545de.
  • Baseline committed regressions: exit 0; 2 passed, 0 skipped.
  • Remove failed from wakeOutstandingStates: expected exit 1; 0 passed, 1 failed, 0 skipped; restored afterward.
  • Remove summary.Outstanding derivation: committed regression tests unexpectedly exited 0; 2 passed, 0 skipped.
  • Temporary inconsistent-source probe with restored code: exit 0; 3 test/subtest pass events, 0 skipped. With derivation removed: expected exit 1; 0 passed, 3 failed, 0 skipped; restored and probe removed.
  • Live GET probe: exit 0; 1 passed, 0 skipped. /api/wakes/summary returned outstanding=6 and six classified rows; /api/wakes returned six classified rows; filtered failed GET returned one row with AUTH.
  • Playwright rendered-surface check: exit 0; 1 check passed, 0 skipped; console errors 0.
  • go build ./...: exit 0.
  • go vet ./...: exit 0.
  • go test ./...: exit 0; 108 test/subtest pass events, 0 skipped, 0 failed.
  • gh pr comment 137 --repo gitmoot/gitmoot-dashboard: exit 0.
  • Final git diff --exit-code: exit 0.

Needs

  • Commit an inconsistent-source regression covering both source-provided Rows and legacy nil-Rows paths, proving count derivation cannot be removed unnoticed.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-impl
Runtime: codex
Job: local-implement-galaxy-impl-18c698d1ac140e89

Decision: implemented
Summary: GALAXY-IMPL: Made the drift regression effective. Engine delivery pending, head unknown to me.

Changes Made

  • Changed FakeDataSource.WakeSummary from the consistent source value Outstanding: 6 to deliberately inconsistent Outstanding: 5 while retaining six rows.
  • Production derivation remains unchanged: the handler classifies rows and sets summary.Outstanding = len(summary.Rows).
  • No production behavior, canonical states, leak protection, SPA rendering, or sorting logic changed.

Tests Run

  • State 1, derivation present: focused regression passed, exit 0.
  • State 2, derivation removed: failed with api_test.go:447: outstanding=5, want 6 including failed wake; exit 1.
  • State 3, derivation restored: focused regression passed, exit 0.
  • go build ./...: build=0.
  • go vet ./...: vet=0.
  • go test ./...: test=0; 108 test pass events, 0 skips.
  • git diff --check: exit 0.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

GALAXY-REVIEW: APPROVED at exact head bfa60921e08fc2544fbb1165d4861cbd152d7d50.

This narrow final check closes the regression-quality finding. I reproduced the required three-state experiment myself:

  • Derivation present: go test -run '^TestFakeWakeSummaryOutstandingRowsCannotDrift$' -count=1 . -> exit 0 (1 pass, 0 skip).
  • Derivation temporarily removed at api.go:487: the same command -> exit 1, with the observed failure:
    --- FAIL: TestFakeWakeSummaryOutstandingRowsCannotDrift (0.00s)
        api_test.go:447: outstanding=5, want 6 including failed wake
    FAIL
    FAIL	github.com/gitmoot/gitmoot-dashboard	0.006s
    FAIL
    
  • Derivation restored: the same command -> exit 0 (1 pass, 0 skip); git diff --exit-code -- api.go -> exit 0.

The committed fixture deliberately reports five source-side outstanding obligations while providing six rows (fakefeed.go:781-786), so api_test.go:435-464 now observes and enforces server-side derivation. There is no separate committed matching-source-count fixture, but no meaningful branch was lost: matching and mismatching counts take the same non-nil-row path, and the stronger mismatch covers it while TestFakeWakeLedgerContractFiltersAndDeterminism still verifies the consistent public contract (exit 0).

Spot checks:

  • failed remains canonical outstanding at api.go:277-283.
  • Both source-provided and legacy nil-row paths converge on publicWakeRows, then derive Outstanding from that same collection at api.go:475-488.
  • The SPA takes summary.rows directly and only copies/sorts/maps it; it contains no client-side outstanding-state filter (web/dist/index.html:1445-1464, web/dist/index.html:1481-1485).
  • Error classification is applied before serialization in both summary and list handlers (api.go:320-329, api.go:486-488, api.go:504-514).

LIVE GET performed against a fresh local fake-backed server:

  • GET /api/wakes/summary -> curl exit 0; outstanding=6, six rows, fixed error classes only (TRANSPORT, TIMEOUT, AUTH, or empty).
  • GET /api/wakes?limit=100 -> curl exit 0; six rows, fixed classes only.
  • GET /api/wakes?state=failed&role=herdres&limit=1 -> curl exit 0; one failed row with last_error="AUTH".
  • Raw-secret/error-text scan across all three bodies -> no match (check exit 0).

Go gate, run unpiped with the required local toolchain and shared caches:

  • go build ./... ; echo "build=$?" -> build=0.
  • go vet ./... ; echo "vet=$?" -> vet=0.
  • go test ./... ; echo "test=$?" -> test=0.
  • JSON count verification -> 108 passing test events, 0 skipped, 0 failed (command exit 0).

All three findings across this PR are closed at this head: the public raw-error leak remains closed, count/row drift including failed remains closed, and the drift regression now demonstrably fails when derivation is removed.

@jerryfane

Copy link
Copy Markdown
Collaborator Author

Agent: galaxy-review
Runtime: codex
Job: local-review-galaxy-review-18c69928930c6f41

Decision: approved
Summary: GALAXY-REVIEW: Approved exact head bfa6092. All three findings are closed: public error leakage, count/row drift including failed wakes, and the previously ineffective drift regression.

Findings

  • api_test.go:435-464 and fakefeed.go:781-786: the deliberately inconsistent source count makes the regression effective. With api.go:487 removed, I observed api_test.go:447: outstanding=5, want 6 including failed wake and exit 1.
  • api.go:277-283 and api.go:475-488: failed remains canonically outstanding, and both source-provided and legacy nil-row paths derive the count from the classified rows rendered by the SPA.
  • web/dist/index.html:1445-1464 and web/dist/index.html:1481-1485: the SPA consumes summary.rows directly without an independent outstanding-state filter.
  • api.go:320-329, api.go:486-488, and api.go:504-514: error classification occurs before serialization on both public row-emitting handlers.
  • The matching-source-count fixture is not separately retained, but it was not a distinct code path. The stronger inconsistent fixture covers the same non-nil-row branch, while the contract regression still verifies a consistent public result.

Changes Made

Tests Run

  • Focused regression with derivation present: exit 0; 1 passed, 0 skipped.
  • Focused regression with derivation removed: exit 1; observed api_test.go:447: outstanding=5, want 6 including failed wake.
  • Focused regression after restoration: exit 0; 1 passed, 0 skipped; api.go diff check exit 0.
  • Contract regression: exit 0; 1 passed, 0 skipped.
  • Live GETs against the local fake-backed server: summary, full list, and filtered failed row all succeeded; summary returned outstanding=6 and six rows, only fixed error classes were returned, and raw-text scan found no leak.
  • go build ./...: exit 0.
  • go vet ./...: exit 0.
  • go test ./...: exit 0; 108 passing test events, 0 skipped, 0 failed.
  • Final tree-clean check: exit 0; HEAD remained bfa6092.

Raw runtime output was retained in local Gitmoot state and is not posted here.

@jerryfane
jerryfane merged commit 68ef5a4 into main Jul 29, 2026
1 check passed
@jerryfane
jerryfane deleted the gitmoot/adhoc-f24424c5 branch July 29, 2026 01:36
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.

1 participant