Skip to content

fix(bin): clarify scratch guidance and dirty teardown refusals - #6505

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
mremond:fm/fm-6319-teardown-scratch-leftovers
Oct 4, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
mremond:fm/fm-6319-teardown-scratch-leftovers

Conversation

@mremond

@mremond mremond commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6319

Merged ship cleanup correctly refuses dirty worktrees, but worker scratch can leave a finished task blocked with an ambiguous refusal.

  • Direct ship briefs and both promotion outputs now keep proof and scratch outside the task worktree and require a clean worktree before completion. Promotion explicitly replaces the earlier scout write restriction.
  • Teardown distinguishes untracked-only leftovers from tracked edits and lists at most ten non-exempt untracked paths.
  • Existing refusal conditions, file exemptions, and --force behavior are unchanged; no files are automatically discarded or relocated.

Validation passed: teardown and brief suites (146 checks), three production mutations, pinned lint, documentation checks, and stock macOS Bash parsing.
The pipeline additionally passed eight focused checks and six live CLI scenarios, including successful cleanup with proof outside the worktree and preservation of dirty or unpushed work on refusal.

The promotion follow-up passed all 27 delivery tests and five mutation checks. The bounded path list is intentional and remains unchanged.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 warnings
  • ⚠️ bin/fm-brief.sh:664 - The requirement to “keep proof and scratch under data/<id>/ or a temp dir and leave the worktree clean before done” misses promoted ships. The new rule is emitted only by the ordinary ship scaffold. A scout promoted through bin/fm-promote.sh retains the conflicting worktree-only rule from bin/fm-brief.sh:590 because promotion preserves other instructions (bin/fm-promote.sh:244). It can therefore create proof logs inside the worktree, finish and merge, and encounter the same refusal. Emit this guidance through the shared ship-contract renderer in bin/fm-dod-lib.sh, including promotion instructions (bin/fm-promote.sh:282) and the persisted relaunch brief (bin/fm-promote.sh:296), explicitly superseding the scout restriction. The clean-before-done rule at bin/fm-brief.sh:666 and ownership pointer at docs/architecture.md:11 must remain consistent.
  • ⚠️ bin/fm-teardown.sh:1871 - Simplification: the ten-path listing, counter and truncation notice exceed the requested optional distinction between untracked-only leftovers and tracked edits. No stated requirement needs a filename inventory. Remove that component and retain the two classifications. Related introduced sites are bin/fm-teardown.sh:69 (listing contract), bin/fm-teardown.sh:1876 (listing and truncation output), tests/fm-teardown.test.sh:1235 (overflow fixture), and tests/fm-teardown.test.sh:1256 (listing expectations).
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Generate ship instructions: emitted rules specify task-data or temporary scratch storage, bounded outside writes, and a clean worktree before completion. ✅ pass live Generated ship instructions for all three delivery modes
Clean up landed work with proof outside the worktree: cleanup succeeds without a discard decision, returns the real pool slot, closes the task, and retains proof. ✅ pass live Live cleanup output and persisted task results
Attempt cleanup with untracked scratch, then retry: both calls refuse with the untracked-only diagnostic and preserve every file and task record. ✅ pass live Complete live CLI transcript: untracked scenarios in remote-backed and local-only modes
Attempt cleanup with unstaged or staged tracked edits: cleanup identifies tracked changes and preserves them. ✅ pass live Complete live CLI transcript: tracked scenarios in remote-backed and local-only modes
Mix tracked edits with excess scratch paths: cleanup reports tracked changes, lists at most ten non-exempt paths with an overflow notice, and preserves all work. ✅ pass live Complete live CLI transcript: mixed scenarios in both modes
Attempt cleanup with a clean but unlanded, unpushed commit: cleanup refuses and preserves the commit, branch, files, and task record. ✅ pass live Complete live CLI transcript: unpushed scenarios in both modes
  • Verified target 3b5b5d6422207a289c2c656f59a9bd00ed290b9d and inspected its scoped diff against the supplied base.
  • Ran eight focused cases through bash tests/.fm-6319-selected-qa.sh: untracked, tracked, mixed, and unpushed refusal checks.
  • Ran the untracked diagnostic regression against base 1f3e769616fdf9f31f85f4c3e6a9f71606634238; it failed at the expected missing-classification assertion.
  • Ran python3 ~/.no-mistakes/evidence/01M418J4Y0Z6WQQPFEBCJ3HQNR/live-cli-validation.py: real brief generation, Git repositories, Treehouse pool operations, teardown commands, and tasks-axi state checks.
  • Compared file hashes, Git status, HEAD, branches, and task records across refusals; verified retained proof and available pool slots after successful cleanup.
  • Removed disposable fixtures and temporary runners; confirmed git status --short was empty.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Keep ship proof material outside the task worktree and distinguish untracked-only leftovers from tracked edits without changing cleanup guards.

Fixes kunchenguid#6319
@greptile-apps