Skip to content

fix(#911): /merger and /release participate in the checkout lock - #917

Merged
admarble merged 2 commits into
mainfrom
feature/911-fix-skills-merger-and-release-mutate-the-main-chec
Aug 8, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/911-fix-skills-merger-and-release-mutate-the-main-chec

Conversation

@admarble

@admarble admarble commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #911.

/merger and /release both ran branch-mutating git in the main checkout while referencing the checkout lock (#901) nowhere: they took no protection (an interleaved branch switch from another session could land /merger's merge or /release's version-bump commit on the wrong HEAD) and, being non-holders, were themselves refused mid-run when another session held the tree.

Both skills now copy /fullsolve's Phase 0.3 contract:

  • /merger acquires before its first guarded verb (the baseline git checkout main), identified by its first issue number, and releases on every exit path — happy-path completion (Step 8), the regression-gate halt (Step 7), and Error Handling — and not on branches that continue to a later mutation (the fix(locks): checkout release ignores holder identity on skip-pid-check locks — a blocked session's release contract unlocks the tree mid-run #906 distinction: the integration git merge and mid-workflow git checkout main stay protected until the run ends).
  • /release acquires after its read-only pre-flight, before the first mutation/approval pause, under a reserved sentinel issue id (999999999) — it has no issue of its own, and both the CLI and the numeric-only pre-tool.sh guard prove ownership by positive integer. The spec's --label=release alternative would require schema + CLI + hook changes and is left to a follow-up (noted in the skill text). It releases on happy-path completion, the before-publish rollback, and the Error Handling blanket. The pre-flight exit 1 branches deliberately carry no release call: the acquire is placed after pre-flight, so an abort there holds no lock (this refines spec AC-5's literal scenario in favor of its requirement — no exit path can leak a lock it never took).
  • Both skills document that acquire/release are no-ops under SEQUANT_ORCHESTRATOR (AC-6) and are mirrored byte-identical across skills/, .claude/skills/, templates/skills/ (AC-7, lint:skill-sync 44/44).

Tests

  • merger-checkout-lock-skill.test.ts / release-checkout-lock-skill.test.ts — per-site gate tests, scoped to the delimited acquire section (extractor throws on rename rather than going vacuous), with release sites pinned as an exact count so a deleted site fails the count test.
  • merger-release-checkout-lock.integration.test.ts — contention proof driving the real .claude/hooks/pre-tool.sh: a foreign session's first guarded command (git checkout main for merger, git reset --soft HEAD~1 for release) is refused exit 2 naming the holder; the holding session runs it unrefused; and with no lock held the command passes (baseline isolating the cause).
  • 54/54 tests pass; build passes; lint:skill-sync and lint:skill-calls clean.

Mutation verification (CLAUDE.md gate-test rule)

Mutation Result
Deleted the regression-gate release site from skills/merger/SKILL.md Exactly the 2 tests asserting it failed (skills — exactly the expected number of release sites, skills — the regression-gate halt releases before it stops); 22/24 passed; restored
Deleted the acquire fence from skills/release/SKILL.md Exactly the 3 tests asserting it failed (exactly one acquire block, the acquire fence uses the sentinel id and --skip-pid-check, acquire lands after read-only pre-flight); 21/24 passed; restored

Execution evidence

Sentinel round-trip against the built CLI, unchanged: locks checkout acquire --issue=999999999 --skip-pid-check ✓ → check renders the holder correctly → release --issue=999999999 ✓.

Follow-up commit: QA gap fixes (741ba8e5)

Closes the two actionable gaps from the QA pass:

  1. After-push rollback release site — the "After git push, before npm publish" rollback previously relied on the Error Handling blanket alone; it now carries its own inline locks checkout release --issue=999999999 call, symmetric with the before-publish rollback. EXPECTED_RELEASE_SITES bumped 3 → 4 with a new per-site gate test.
  2. Sentinel rendering — locks list and the CLI's release-refusal now render the holder as /release (sentinel) instead of issue=#999999999, via describeCheckoutHolderIssue() (new, exported with RELEASE_SENTINEL_ISSUE from src/lib/locks). The shared formatCheckoutLockedMessage and the hook's shell-side message are deliberately untouched — the hook mirrors that sentence in shell, and a TS-only rewording would drift the mirror. The refusal's recovery hint keeps the literal numeric --issue=999999999, which must stay typeable. Verified live against the rebuilt CLI (list row + refusal + release round-trip).

The spec's AC-5 pre-flight clause divergence (documented above) and the prompt-only-enforcement caveat are design decisions, not defects — unchanged. Full --label=release support remains the follow-up.

Mutation (gap-fix commit) Result
Deleted the new after-push rollback release site from skills/release/SKILL.md Exactly the 2 tests asserting it failed (exactly the expected number of release sites, the after-push rollback releases before it stops); 25/27 passed; restored

Post-fix: 90/90 tests across the four affected files; build passes; lint:skill-sync 44/44.

Both skills ran branch-mutating git in the main checkout without
referencing the checkout lock (#901): they took no protection and, as
non-holders, were refused mid-run when another session held the tree.

- /merger acquires before its first guarded verb (baseline git checkout
  main), releases on every exit (happy path, regression halt, error),
  identified by its first issue number.
- /release acquires after read-only pre-flight under a reserved sentinel
  issue id (999999999 — it has no issue and the lock/guard key on a
  positive integer), releases on happy path, rollback, and mid-release
  error. The --label alternative is left to a follow-up (schema+CLI+hook).
- Mirrored byte-identical across the three skill dirs (lint:skill-sync).
- Per-site mutation-verified gate tests + a contention proof driving the
  real pre-tool.sh (foreign holder refused, holder allowed).

Entire-Checkpoint: 7b93572a52b5
… rendering

Two gaps from the #911 QA pass:

- /release's 'After git push, before npm publish' rollback relied on the
  Error Handling blanket alone; it now carries its own inline checkout-lock
  release, symmetric with the before-publish rollback. EXPECTED_RELEASE_SITES
  bumped 3 -> 4 with a new per-site gate test (mutation-verified).

- The /release sentinel rendered as issue=#999999999 in `locks list` and the
  CLI release-refusal, inviting readers to look up a fake issue. Both CLI
  surfaces now render it as '/release (sentinel)' via
  describeCheckoutHolderIssue. The shared formatCheckoutLockedMessage and the
  hook's shell-side message are deliberately untouched: the hook mirrors that
  sentence in shell, and a TS-only rewording would drift the mirror (#871
  class). The recovery hint keeps the literal numeric --issue form, which must
  stay typeable.

Full --label=release support (schema + CLI + hook) remains the documented
follow-up.

Entire-Checkpoint: 3fff85533005
@admarble
admarble merged commit ace4a9b into main Aug 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(skills): /merger and /release mutate the main checkout without participating in the checkout lock

1 participant