Repository navigation
fix(bin): prevent superseded crew runs from becoming current - #10
Merged
Merged
Conversation
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.
Intent
Fix bin/fm-crew-state.sh so it never reports a superseded older validation run as a task current state. Verify which detailed or coarse path causes the false failed verdict before changing it. Bind crew state to the run matching the current branch head or the most recent run for that branch; a parked or running active run must win over older terminal outcomes, while a genuinely newest failed run must still report failed. Add public-interface regressions for older failed plus newer parked and for newest genuinely failed, preserve all existing crew-state behavior, and require all crew-state tests plus bin/fm-lint.sh to pass. Treat transient status-log fallback while pipeline fix commits move HEAD and a later CI rerun state as out of scope unless diagnosis proves the same cause, and disclose any such connection rather than widening silently.
What Changed
Risk Assessment
✅ Low: The change now preserves newest-unbound-run evidence to block stale terminal history while retaining nonterminal fallback for rewritten branches, with focused public-interface regressions for both boundaries and genuine newest failures.
Testing
All crew-state tests passed. Public-interface evidence demonstrates the base failure, the repaired unattributable verdict, and preservation of genuine newest failures. No separate baseline command was supplied.
bin/fm-lint.shwas not rerun because this test phase explicitly prohibits linters; the outer lint phase owns that requirement.Evidence: Crew-state public-interface evidence
COUNTERFACTUAL (base): newer parked run, older failed run and failed status event state: failed · source: run-step · run failed TARGET: same scenario state: unknown · source: none · newest same-branch run head is not attributable TARGET: genuinely newest same-branch run failed state: failed · source: run-step · run failedPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
bin/fm-crew-state.sh:359- The required invariant says “a parked or running active run must win over older terminal outcomes,” but this newreturn 0discards all knowledge of the newest same-branch run when its head is unresolvable. The no-run path can then emit an olderfailed:status-log event as current state (lines 570–574), recreating the false failed verdict. The regression masks this by seeding a newerneeds-decision:log entry. Preserve a distinct newest-unbound-run result at this attribution boundary so older terminal history cannot become current, while retaining rewritten-branch protection.🔧 Fix: Preserve unbound runs against stale fallback failures
1 error still open:
bin/fm-crew-state.sh:563- The intent requires preserving existing crew-state behavior, but this unconditional sentinel barrier also suppresses valid nonterminal status-log state after a branch rewrite. With the existing rewritten-branch fixture plus a realisticrunsrow for its historical mismatched head,NEWEST_UNBOUND_RUN=1and the expected currentworking:status-log becomesunknown. Retain the sentinel but use it to reject terminal log states such as the stalefailed:event, while allowing the established nonterminal fallback for rewritten or locally advanced branches.🔧 Fix: Preserve nonterminal fallback for unbound rewritten runs
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-crew-state.test.shRan basebin/fm-crew-state.shthrough its public interface with a newer parked/unbindable run, an older failed matching run, and a stale failed status event.Ran targetbin/fm-crew-state.shthrough its public interface for the same stale-failure scenario and a genuinely newest failed run.Verified the worktree remained clean and temporary fixture helpers were removed.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.