Add recursive close (--recursive/-r) to cascade-close a subtree#133
Merged
Conversation
…work-ep5)
bw close <id> --recursive (-r) closes the issue and every descendant,
leaf-up, in a single commit. Already-closed members are skipped (an
already-closed root is tolerated so a re-run mops up stragglers); the
root keeps its --reason while descendants record 'closed with parent
<root>'. External issues that become unblocked are surfaced and deduped;
internal unblocks are suppressed.
New Store.CloseSubtree returns SubtreeCloseResult{Closed, Skipped,
Unblocked}. The non-recursive path and its CloseResult JSON shape are
unchanged.
Collaborator
|
So something I just thought of, after trying this out: We should add this to |
Owner
Author
yes, indeed we should. that's a good call. |
Mirrors the recursive close in this PR for delete, per review feedback: delete an issue and its entire subtree (all descendants) leaf-up in a single commit (one "delete <id>" intent line per removed issue, reusing the existing delete verb for deterministic replay). - Store: DeleteSubtree + DeleteSubtreePreview + SubtreeDeleteResult in internal/issue/subtree_delete.go, reusing buildSubtreeSet/subtreePostOrder. External dependents that become fully unblocked are surfaced and deduped; internal (in-subtree) unblocks are suppressed as noise. - CLI: delete grows --recursive/-r. Like the non-recursive path it previews by default; --force commits. - Tests: store-level (nested leaf-up order, deletes open+closed members, pass-through closed node, external unblock surfaced, internal unblock suppressed, still-blocked dependent not surfaced, preview mutates nothing) and CLI (preview->force, -r alias, --json shape). Follow-up to beadwork-ep5.
Owner
Author
|
Good call — added
Smoke-tested end-to-end: preview mutates nothing, |
iautom8things
approved these changes
May 31, 2026
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.
Summary
Adds a
--recursive/-rflag tobw closethat closes an issue and its entire subtree (all descendants) in a single commit.--reasonverbatim; each descendant recordsclosed with parent <root-id>.CloseResultJSON shape are unchanged (back-compat). Recursive mode emits a newSubtreeCloseResult{Closed, Skipped, Unblocked}.Implementation
internal/issue/subtree_close.go:Store.CloseSubtree(id, reason)+ post-order traversal helper. Traversal is built from all issues (including closed) so it passes through closed nodes to reach open descendants.cmd/bw/close.go:--recursiveflag,cmdCloseRecursive(single commit viacommitWithRetry, oneclose <id>intent line per closed issue +unblockedlines).cmd/bw/helpers.go:-r→--recursivealias.cmd/bw/command.go: flag, description, and example.Tests
subtree_close_test.go): nested grandchildren, leaf-up order, reason propagation, skip-already-closed, already-closed root, external unblock surfaced, internal unblock suppressed.close_test.go): recursive close,-ralias, skip messaging, JSON shape.Closes beadwork-ep5.