* fix(cli): guarded close replays molecule auto-close and open-children warning
mc-zndi7.75: runCloseDirectIfRevision/runCloseProxiedIfRevision bypass bd
close's batch architecture entirely (BatchCloseItem carries no per-item
ExpectedVersion), so they also bypassed two state-derived post-close
contracts that the batch route performs for every close:
1. Molecule auto-close (autoCloseCompletedMolecule / its proxied twin
autoCloseProxiedCompletedMolecule). Without replaying it here, a guarded
close of a molecule's last step left the molecule root stranded open
forever.
2. The "warning: closing X with N open child issue(s) still active" line
printed when --force waives the engine's open-children refusal.
Both routes now replay this work after a successful guarded close, exactly
as close.go's batch path and closeProxiedRunPostClose do, on both a real
close and an idempotent re-close (the proxied post-close work runs in its
own unit of work, mirroring autoCloseProxiedCompletedMolecule's existing
batch-route contract).
The third item in mc-zndi7.75 — gating on_close hook firing on Changed — is
deliberately NOT implemented here: hookIssueOperations.Close (embedded) and
recordingIssueUC.CloseIssueChecked (proxied) both fire on_close
unconditionally on success, including an idempotent re-close, by explicit,
independently pinned design in internal/storage/hook_issue_operations_test.go
("close no-op still fires close" — "Do not 'unify' this either") and
internal/storage/uow/notifying_test.go ("a re-close still reports the close"
— "THE BATCH COMPOSITIONS DISAGREE WITH THIS ONE, deliberately"). Only the
batch closers gate on Changed, to stop a replayed teardown batch from
re-running on_close once per item on every pass (ga-2yaqp.1) — a hazard this
single-id guarded close doesn't share. Reusing that gating here would
contradict both pinned invariants rather than fix a bug, so it's documented
in place and left for human review instead of changed unilaterally.
Adds CLI integration tests for both routes: guarded re-close healing a
stranded-open molecule root, and guarded --force close warning on open
children.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* build(bazel): sync cmd/bd BUILD.bazel for the new --if-revision close tests
make bazel-sync (bazel run //:gazelle) after adding
close_if_revision_embedded_test.go and close_if_revision_proxied_test.go.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>