Repository navigation
docs(tend): hold PRs that can make wt delete more, not ones that edit deletion code - #4148
Conversation
… deletion code The data-loss hold in the tend review reference fired on proximity: a diff that edited a file containing a deletion command, or code near the force-delete path, was held for human review. It held a PR that made the branch-deletion check strictly stricter, one the reviewer itself described as safer than what it replaced. The hold now fires on what the diff can do: add a deletion, widen what an existing one can delete, or loosen a check that gates one (the dirty-worktree check, the integration check behind `wt remove`'s branch deletion). The command list stays as a list of where deletions live, and the regenerable / throwaway-environment bound is unchanged. Scored against six cases, three runs each, with the whole reference pasted in: the old text held all three guardrails (a stricter integration check, a data-loss fix that narrows the squash-merge match, a warning reword in a file that calls `remove_dir_all`); the new text approved them and still held a dirty check that stops seeing untracked files, a looser squash-merge match, and `git worktree remove --force --force`. 18/18. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
The three triggers cover a deletion's extent, but not a diff that changes an existing deletion's target or when it fires relative to its gate. stage_worktree_removal is the case its own docstring names: "the order below is easy to get subtly wrong, and getting it wrong destroys uncommitted work". A diff that moves rename_into_trash above worktree.ensure_clean("remove worktree", ...), or reorders the fsmonitor stop past it, adds no deletion, widens nothing, and leaves the gate's own text untouched — and deletes the uncommitted work the gate exists to refuse. Retargeting is the same shape: changing generate_removing_path so two concurrent removals stage into one path, or changing what PROMOTE_STAGING_DIR resolves to, makes remove_dir_all destroy something else rather than something more.
This is the case the removed sentence named — #3457 added it as "a change near the force-delete path holds even when the destructive line isn't in the diff" — and none of the eval's six cases has that shape, so the eval doesn't show it survives. The umbrella clause does cover it in principle, but the colon plus three or-joined items reads as the definition of that clause, so a reviewer holding a reordering diff against the list finds nothing that matches and approves.
The suggestions below add a fourth trigger and reword step 1 to fit it — a reordering doesn't make a deletion "destroy more".
worktrunk-bot
left a comment
There was a problem hiding this comment.
Concern withdrawn on the eval data (replied inline). The reworded triggers hold the reorder and retarget cases and stop holding the stricter-check diffs that motivated the change; docs-only, checks green.
The data-loss hold in the tend review reference fired on proximity: a diff that edited a file containing a deletion command, or code near the force-delete path, was held for human review. That held #4146, which made the branch-deletion check stricter and which the reviewer itself called safer than what it replaced.
The hold now fires on what a diff can do: make worktrunk destroy something it used to keep, by adding a deletion, widening what an existing one can delete, or loosening a check that gates one (the dirty-worktree check, the integration check behind
wt remove's branch deletion). The command list stays as examples of where deletions live, a held review names how the diff could make a deletion destroy more, and the regenerable / throwaway-environment bound is unchanged.Eval: old vs new wording, whole reference pasted in
has_added_changes_by_sha(the #4146 change)wt remove -Dwarning in a file callingremove_dir_allgit worktree remove --force --forcefor locked worktreesrename_into_trashmoved aboveensure_cleanwt step prunepath taken from the renderedworktree-pathtemplateThe last two include four runs each of a variant that leaves the consequence out of the case. A third arm without a "code on the deletion path gets an ordinary review" sentence scored the same, so that sentence was cut. worktrunk-bot's suggested fourth trigger ("changes what an existing deletion targets or when it fires relative to its gate") held the reorder and retarget cases 3/3 too, and held the narrowing patch-id fix in 1 of 3 runs.
🤖 Generated with Claude Code