Repository navigation
feat(bin): publish per-home summary ledgers - #3222
Merged
Merged
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (3): Last reviewed commit: "no-mistakes(document): Clarify atomic ho..." | Re-trigger Greptile |
kunchenguid
force-pushed
the
fm/fm-startup-pr2-home-summary-ledger-r1
branch
from
August 28, 2026 23:36
4726e81 to
c0c627f
Compare
…leted home: teardown now skips side-band summary refresh when its overridden state directory was removed. Verified with remote lifecycle E2E, teardown tests, home-summary tests, ShellCheck, and git diff checks
2 of 3 tasks
prandelicious
added a commit
to prandelicious/firstmate
that referenced
this pull request
Aug 29, 2026
Intent
Implement PR2 of the captain-approved Firstmate startup and Bearings redesign after PR1 landed: publication only of a per-home state ledger, with no collector, consumer, Bearings behavior change, fleet-snapshot read-path change, or PR3-PR4 work. Each home must best-effort maintain state/home-summary.json as the same fm-secondmate-home-summary.v1 document produced by fm-fleet-snapshot.sh --secondmate-home-summary, extended with generated_epoch, and publish it atomically so interrupted writes leave either the prior complete valid JSON document or a new complete valid JSON document, never torn output. Refresh must be local to the owning home after a status append lands, at that home s locked session start, and after task spawn and teardown, with live-home staleness bounded to minutes; refresh failure must be logged and must never break the triggering caller. The additive design must remain safe on mixed-version fleets because nothing reads the ledger yet. Behavioral tests must exercise real producer and trigger surfaces: a status append on a seeded lab home produces an updated ledger equal to a fresh --secondmate-home-summary result modulo generated fields within trigger cadence, and a writer crash or kill mid-write proves atomic replace. Keep all existing snapshot and Bearings tests untouched and green. Preserve the previously validated and pushed PR2 head and its accepted pipeline fixes while reconciling it through the supported no-mistakes path onto current main, including the landed honest Herdr suite fix, then rerun the full validation pipeline. Do not merge the PR.
What Changed
state/home-summary.jsonpublisher using the existing secondmate summary schema withgenerated_epochfreshness metadata.Risk Assessment
✅ Low: The change is additive and publication-only, with bounded best-effort lifecycle hooks, atomic replacement, recurring watcher refresh, and no ledger consumer or existing read-path behavior change.
Testing
Inspected the target diff, exercised status/cadence publication, atomic interruption, bounded best-effort failures, session-start/spawn/teardown triggers, and unchanged Snapshot/Bearings behavior. The initial session-start run exceeded a 180-second harness limit but completed successfully when retried with adequate time; all other targeted checks completed, end-to-end ledger evidence was captured, and the worktree remained clean.
Evidence: End-to-end status publication and atomic interruption transcript
Source: End-to-end status publication and atomic interruption transcript
Evidence: Status-triggered published home-summary ledger
Source: Status-triggered published home-summary ledger
Evidence: Fresh real producer home-summary used for equivalence comparison
Source: Fresh real producer home-summary used for equivalence comparison
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed (2) ✅
bin/fm-home-summary-refresh.sh:211- The required “refresh failure must be logged” invariant is bypassed for non-timeout worker termination. If the bounded worker is killed directly or exits via its HUP/INT/TERM traps, the parent receives 129/130/137/143, takes this branch, and returns without logging;--best-effortalso returns nonzero despite its documented contract. In best-effort mode, handle every worker failure at this parent boundary with bounded reporting and exit zero.bin/fm-home-summary-refresh.sh:217- The accepted correction requires only bounded parent-side failure reporting, but when the two-second timeout logger fails, this fallback writes synchronously to stderr outside any bound. A blocked/full stderr pipe can therefore hang session start, spawn, teardown, or the watcher indefinitely after the refresh has already timed out. Keep the fallback itself under a deadline or make it nonblocking.🔧 Fix: Bound and log all best-effort refresh failures
2 issues (1 error, 1 warning) still open:
tests/fm-home-summary-refresh.test.sh:440- The worker-termination test shadows onlyperl, butfm_timeout_mechanismpreferstimeout, which is installed on the Ubuntu CI runners. The fake Perl never executes, the refresh succeeds, and the expected exit-143 log is absent, so this test deterministically fails in CI. Exercise the selected timeout mechanism or force a controllable mechanism.bin/fm-watch.sh:1196- The new cadence usesage_of, which returns a negative age when the ledger mtime is ahead of the current clock. After a backward clock correction, backlog-only changes can therefore remain unpublished until the clock catches up, violating bounded live-home staleness. Clamp future mtimes to “due immediately” at the sharedage_ofboundary.🔧 Fix: Harden cadence and timeout regression coverage
✅ Re-checked - no issues remain.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git status --shortand commit-range diff inspectionbash tests/fm-home-summary-refresh.test.shManual seeded-home workflow using realfm-watch.sh,fm-home-summary-refresh.sh, andfm-fleet-snapshot.sh --secondmate-home-summarybash tests/fm-session-start.test.shbash tests/fm-trace-context-spawn.test.shFocusedtest_kimi_readiness_gate_precedes_pointerselector fromtests/fm-kimi-harness.test.shFocusedtest_local_only_fork_remote_allowsselector fromtests/fm-teardown.test.shbash tests/fm-bearings-snapshot.test.shbash tests/fm-fleet-snapshot-view.test.shNormalizedjqcomparison of the published ledger against a fresh producer resultA combined lifecycle regression command reached its 300-second host timeout during the broader Kimi suite; the relevant Kimi and teardown cases were then run independently and completed✅ No issues found.
git status --short && git diff --stat 420721401c4080d1a4f6982b0ef6769e2a749b23..HEAD && git diff --name-only 420721401c4080d1a4f6982b0ef6769e2a749b23..HEADbash tests/fm-home-summary-refresh.test.shbash tests/fm-session-start.test.sh(initial 180-second harness timeout, then completed withtimeout=420)bash tests/fm-teardown.test.shbash tests/fm-trace-context-spawn.test.shbash tests/fm-kimi-harness.test.shbash tests/fm-fleet-snapshot-view.test.shbash tests/fm-bearings-snapshot.test.shbash tests/fm-bearings-board-render.test.shManual seeded-home verification using realfm-watch.sh,fm-home-summary-refresh.sh, andfm-fleet-snapshot.sh --secondmate-home-summary: appended a status event, compared normalized published and fresh summaries, then interrupted a blocked refresh at its deadline and verified identical before/after SHA-256 plus valid JSON.git status --shortafter testing and cleanup✅ **Document** - passed
✅ No issues found.
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Fix direct exit-code check in refresh test
✅ Re-checked - no issues remain.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.