Repository navigation
fix(bin): stop counting the no-mistakes gate mirror as landed work - #258
Merged
Merged
Conversation
* fix(teardown): detect untracked work regardless of Git status config * test(watcher): avoid blocking FIFO contention handshakes * no-mistakes(document): Document hidden-untracked teardown safety --------- Co-authored-by: Kun Chen <[email protected]> (cherry picked from commit 2363b71)
* fix: recheck landed work after teardown process reap * no-mistakes(review): Delay backlog close markers until post-reap safety proof * no-mistakes(document): Correct stale pending-close publication references * no-mistakes(document): Clarify initial teardown safety check ordering * no-mistakes(document): Correct teardown ordering comments and stale retention documentation --------- Co-authored-by: Kun Chen <[email protected]> (cherry picked from commit 5b91acf)
…ed work (#7820) * fix(teardown): refuse open-PR ships and ignore the no-mistakes mirror in the landed test Teardown deletes the record that merge recording depends on, so an ordinary ship whose recorded pr= is still open is refused (--force bypasses). The unpushed-commit checks also exclude the local no-mistakes mirror remote, which is not a forge, so work that only reached the mirror is no longer counted as landed. * no-mistakes(review): Exclude no-mistakes mirror from teardown unpushed checks * test: assert the mirror-only teardown refusal retains the task state (cherry picked from commit ed1eb1d)
…rk (#8030) * fix(teardown): refresh remote refs before refusing work as unlanded Teardown read landed work from the task copy's remote-tracking refs, so work pushed from another checkout was refused until someone fetched by hand. Refresh each remote, bounded and without pruning, when the refs do not show the work. A failed refresh leaves the refs as they were, still refuses, and names the remote in the refusal. * no-mistakes(review): Use fixed 30-second fetch bound, removing timeout override * no-mistakes(ci): Final state, replacing the earlier reports: the fix is in the worktree, uncommitted. The full run of tests/fm-teardown.test.sh did NOT complete: it was stopped at the 20-minute background limit after about 126 of 156 tests. All 126 passed with no failures, including the new test. The remaining ~30 did not run, so the outer test phase must run the full file. Change: validate_worktree_teardown_safety re-runs the dirty check through read_worktree_dirt right after refresh_remote_refs and refuses the same way if it fails or finds work. Added one test, test_edit_saved_during_refresh_refuses, covering local-only, direct-PR and no-mistakes modes. Kept the timed-out agent's code change; removed its extra second test and fake-git hook, per the one-test instruction. Verified: the new test failed with the recheck removed and passed with it restored. bash -n on bin/fm-teardown.sh passed. Not verified: shellcheck is not on PATH, so it did not run. The path where the recheck itself cannot read the copy has no test, per the one-test instruction. Partial log: /tmp/fm-teardown-full.log (cherry picked from commit bf05a4f)
…he done gate (#8339) * fix(bin): ignore the no-mistakes gate mirror in the done: reachability check fm_dod_named_head_reachable_outside_worktree accepted a named head found on any remote-tracking ref, including refs/remotes/no-mistakes/*, the local no-mistakes gate mirror. A head that only reached that mirror never left the machine, so leave the mirror's refs out of the check, as teardown already does with --exclude='no-mistakes/*'. * no-mistakes(review): Document gate-mirror exclusion refusing unfetched origin heads * fix(bin): refresh remote refs before refusing a done claim at PR registration A no-mistakes pipeline pushes from its own gate clone, so with the gate mirror excluded a GitLab or Forgejo CI-ready done was refused until someone fetched by hand. fm-pr-check.sh now opts into one bounded, no-prune refresh of the non-gate remotes in the worker copy, and in the project clone when it differs, then checks again. The refresh is teardown's, moved into fm-dod-lib.sh and shared. A refusal after a failed refresh says the verdict used the last-known refs. crew-state, inactive-reconcile and review-check note why they read the refs without refreshing. * docs(bin): say the watcher registers PRs only when config/pr-register-scan is on * no-mistakes(review): Bound scan refresh by budget; skip refresh on merge * no-mistakes(review): Refresh remote refs on merge-time re-record too * no-mistakes(review): Stop scan after refresh deadline; label skipped refreshes * no-mistakes(document): Clarify ship-landing guidance for unfetched no-mistakes heads * no-mistakes(ci): Fixed Greptile P1 r4529290256 in `fm_dod_refresh_remote_refs` (bin/fm-dod-lib.sh). The fix only touches that function. **Invariant:** one remote that hangs must not use up the refresh time of the remotes after it. In particular, origin, which normally holds the named head, must still be fetched within the scan deadline. The refresh is shared by the done-gate (scan, plain pr-check and merge-time re-record) and by teardown, so the fix is in that one shared function. **Change:** - **Origin first:** the function now builds the remote list with origin at the front when it exists, followed by the other non-gate remotes. `no-mistakes` is still skipped. - **Split budget:** when a deadline is given, each fetch gets an even share (rounded up) of the time still left, divided among the remotes not yet fetched. Unused time carries over to later remotes. - **Kept as before:** the 30 second per-remote cap, `--no-prune`, skipping remotes once the deadline has passed, and appending each unfetched remote to `FM_DOD_REFRESH_FAILED` for the last-known-refs message. - **Teardown:** it passes no deadline, so its only change is the fetch order. - **Comment:** updated to describe the new order and the split. The other comments that describe the refresh were checked and are still accurate. **Regression test:** `test_remote_hanging_before_origin_leaves_origin_its_refresh` in tests/fm-dod-lib.test.sh. - **Setup:** a `backup` remote whose helper hangs and that sorts before origin in `git remote`, a 4-second refresh deadline, and origin holding the named head. - **Asserts:** the done claim is accepted, origin's tracking ref is fetched to the head, `FM_DOD_REFRESH_FAILED` is `backup`, and the call ends within the deadline. - **Before the fix:** it failed with "kept origin's head from being accepted". **Verification:** - **Test suites:** tests/fm-dod-lib.test.sh, tests/fm-pr-check-security.test.sh and tests/fm-teardown.test.sh all pass, including the existing scan hanging-remote and budget tests. - **Lint:** `bin/fm-lint.sh` (pinned ShellCheck 0.11.0) passes on both changed files. **Not changed:** in the uncommon case where the worker copy is a separate clone, the project clone's refresh still runs after the copy's own refresh, against the same deadline. Per the instruction to change nothing else, I left that as it is * test(gotmp): provide fm-dod-lib and its sourced libraries in the teardown fake roots Teardown now sources bin/fm-dod-lib.sh for the shared bounded remote-ref refresh, and that library sources fm-brief-heading-lib.sh and fm-external-review-lib.sh from its own directory. Both fake roots in tests/fm-gotmp.test.sh symlinked only the siblings teardown needed before, so the real teardown refused at startup there. * no-mistakes(review): Split refresh deadline across copy and project clone remotes (cherry picked from commit 391f9d0)
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
Upstream pick 1 of 4 the captain approved ("Send all four"): stop counting the local no-mistakes mirror as "pushed". The done gate counts refs/remotes/no-mistakes/* as reachable (bin/fm-dod-lib.sh) and no-mistakes-mode teardown only runs its landing test when commits look unpushed (bin/fm-teardown.sh), an exposure under the never-tear-down-unlanded-work rule. Resolved substance of the pick: the picked upstream commits make the local no-mistakes gate mirror not count as landed or reachable, in both the done gate and teardown, so work that only reached the mirror is refused as unlanded. The picks also bring their prerequisite refresh of stale remote refs before teardown refuses landed work (upstream #8030), which is required for the done-gate change to apply. Upstream commits outside this pick are not included.
What Changed
bin/fm-dod-lib.sh) andbin/fm-teardown.shno longer treatrefs/remotes/no-mistakes/*(the local gate mirror) as pushed or reachable. Work that only reached the mirror is now refused as unlanded. Teardown in no-mistakes mode now runs its landing check regardless of whether commits look unpushed.fm-pr-check.sh,fm-crew-state.sh,fm-inactive-reconcile.sh,fm-review-check.shandfm-backlog-transition-lib.shget small adjustments to match.ship-landingskill,captain-hold-lifecycle.md,runtime-backends.md) are updated for the new behavior. The branch adds or extends tests for the done gate, teardown landed-work and process-reap,fm-pr-checksecurity, gotmp, and the watcher lock.Risk Assessment
Testing
The baseline changed-test run passed. I then ran the three test scripts that drive fm-dod-lib and fm-teardown against disposable git repos with a no-mistakes mirror remote, and all three exited 0. They show a head present only on the gate mirror is refused (also after a refresh) and a head on origin is accepted. They also show a branch pushed only to the mirror is refused at teardown, and that failed or hung refreshes refuse and name the remote. No live Herdr or lab session was needed, since the change has no UI or session surface.
Evidence: dod-lib test log
Source: dod-lib test log
Evidence: teardown test log
Source: teardown test log
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated --exclude-quarantined --pc02-if-idlebash tests/fm-dod-lib.test.shbash tests/fm-teardown-landed-work.shbash tests/fm-teardown.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.