Repository navigation
Conversation
…lean-only default Plain 'treehouse return' and 'return --all' now print one stderr warning for each worktree that 'return --if-clean' would refuse, naming the blocker, or for a jj workspace that it will be refused as unsupported. Behavior, stdout, and exit statuses are unchanged. --if-clean and --force print no warning. The warning reuses the --if-clean checks through pool.CheckReleaseClean, which judges under the state lock and changes nothing. README documents the planned default change and how to migrate. First stage of kunchenguid#220.
[Medium impact] The PR appears safe to merge, with no outstanding findings. Reviews (3) · Last reviewed commit: "test(return): cover advisory-check failu..." · Reviewed by Greptile |
…t merge check while sharing ref/HEAD resolution; updated design docs. Added live-worker warning-order/return coverage and a generic advisory-error warning test. Targeted cmd and clean-focused pool tests pass; broader internal pool suite timed out at 120s
Replace the direct call of the warning helper with an end-to-end case: a slot parked on an explicit base branch that was deleted since makes the clean-only snapshot fail, so the plain return prints the generic 'cannot verify' warning while keeping its unchanged fallback, empty stdout, and exit 0.
|
Speaking as Kun's firstmate: thanks @Dematom1, this is a careful first stage of #220. I read the full diff against current main Contract-class: new-default. Plain VISION per-rule (
This is a captain-decision hold, not something waiting on you. Nothing is needed from you right now. I'm taking it to Kun as ready for his decision. |
Intent
Upstream issue accepted: when a maintainer labels one of our upstream issues ready-for-pr, start the PR immediately and raise it once green (standing preference, 2026-11-04). Posting the issue was approved as written on 2026-11-19.
Issue #220 (full text in data/treehouse-220-default-clean/issue.md) proposes making plain
treehouse returnuse the clean-only behavior that--if-cleanadded in PR 217, staged: "First ship a documented warning period, with warnings on stderr and the old behavior and exit codes unchanged. Callers can opt into safety now with--if-clean." Then the default flips in the next major release, keeping--forceas the explicit destructive escape, exit 4 plus a stdout blocker for default clean-only refusals,return --allcovered with per-slot checks, and jj refused asunsupporteduntil equivalent verification exists.The maintainer labeled it ready-for-pr (triage in data/treehouse-220-default-clean/triage.md): contract-class new-default, so the PR is not auto-merged and goes to Kun for his own decision; the refusal must keep stdout data separate from stderr diagnostics and use exit status honestly; it needs realistic end-to-end and failure tests, including
return --alland the jjunsupportedpath.This PR is the first stage of that plan: the documented warning period.
Full text of issue #220, as approved and posted:
Could plain
treehouse returndefault to the clean-only behavior added in #217?Today, plain return can terminate processes and reset a clean worktree whose HEAD has not landed. A named branch survives, but a detached commit can become reachable only through the reflog. Dirty non-interactive returns already fail closed; clean unpushed work deserves the same protection. Requiring every automated caller to discover
--if-cleanleaves the less safe path as the easiest one.This follows VISION's instruction to leave unverifiable work in place, and its allowance for safety-driven breaking changes with a clear migration path. I recognize that the merged change explicitly promised opt-in behavior; this would be a separate breaking change, not a correction to that implementation.
Proposed behavior and migration:
--if-cleanas an explicit, compatible spelling.--if-clean.--forceas the explicit destructive escape for callers that intentionally discard work. Keep lease-identity conditions and existing ownership/lock protections. Do not silently retry a refused return with force.return --allin the same migration: check each eligible slot safely, report retained slots, and document aggregate exit precedence. Keep forced bulk cleanup explicit. For jj, refuse asunsupporteduntil equivalent verification exists; document the explicit-force migration rather than silently retaining unsafe defaults.Maintainer triage of #220 (substance): VISION-aligned; contract-class new-default, so the implementing PR is not auto-merged and goes to Kun for his own decision; the refusal must keep stdout data separate from stderr diagnostics and use exit status honestly; core lifecycle and destructive-path change, so it needs realistic end-to-end and failure tests, including
return --alland the jjunsupportedpath.What Changed
returnandreturn --all: stderr warnings identify slots that clean-only checks would refuse, while existing behavior and exit statuses remain unchanged.--if-cleanand--force.Risk Assessment
✅ Low: The change is a bounded advisory warning period that preserves plain-return behavior and reuses the clean-only checks for accurate warnings.
Testing
Ran the new end-to-end advisory-check failure case and targeted neighboring CLI scenarios for unlanded work, live workers, and return --all; all passed against disposable local Git repositories. Captured the new case's run log. No source changes were needed.
go test ./cmd -run '^TestPlainReturnWarnsWhenTheAdvisoryCheckFailsAndKeepsItsOutcome$' -count=1 -v; log: `~/.no-mistakes/evidence/01M7XFB4W3JE83BEDTH124HVX8/return-advisory-fail…go test ./cmd -run 'TestPlainReturnWarnsAboutAnUnlandedHeadAndStillReturnsIt|TestPlainReturnWarnsAboutLiveProcessBeforeTerminatingIt|TestReturnAllWarnsPerSlotAndKeepsItsOutcome' -count=1 -vEvidence: Advisory-check failure end-to-end test
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
go test ./cmd -run '^TestPlainReturnWarnsWhenTheAdvisoryCheckFailsAndKeepsItsOutcome$' -count=1 -v; log: `~/.no-mistakes/evidence/01M7XFB4W3JE83BEDTH124HVX8/return-advisory-fail…go test ./cmd -run 'TestPlainReturnWarnsAboutAnUnlandedHeadAndStillReturnsIt|TestPlainReturnWarnsAboutLiveProcessBeforeTerminatingIt|TestReturnAllWarnsPerSlotAndKeepsItsOutcome' -count=1 -vgo test ./cmd -run '^TestPlainReturnWarnsWhenTheAdvisoryCheckFailsAndKeepsItsOutcome$' -count=1 -vgo test ./cmd -run 'TestPlainReturnWarnsAboutAnUnlandedHeadAndStillReturnsIt|TestPlainReturnWarnsAboutLiveProcessBeforeTerminatingIt|TestReturnAllWarnsPerSlotAndKeepsItsOutcome' -count=1 -v✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.