Repository navigation
fix(workspace): keep shared core.hooksPath intact across worktree-start - #1464
Merged
Merged
Conversation
This was referenced Aug 12, 2026
[BUG] just worktree-start unsets core.hooksPath repo-wide, disarming the main checkout's hooks
#1463
Closed
c-vigo
added a commit
that referenced
this pull request
Aug 12, 2026
…ck (#1467) ## Summary `release.yml`'s **Rollback on Failure** built a commit whose tree was reset to `pre_finalize_sha` — a run-start snapshot — whenever the run failed and the branch tip had moved at all. Any commit merged to the release branch while a run was in flight was silently destroyed on that run's failure (#1459: the merged content of #1447 and #1448 wiped off `release/1.8.0` twice, both times with `finalize` *skipped*). ## Fix The rollback branch step now proves the branch holds only this run's own writes before touching anything, and refuses loudly otherwise: 1. **No-op when `finalize` never ran** (`needs.finalize.result == 'skipped'`/empty) — this alone prevents both incidents. 2. **No-op for candidates** — finalize is branch-neutral unless `release_kind == final` (second independent shield; both incidents were candidates). 3. Retained `CURRENT_SHA == PRE_SHA` no-op. 4. **Chain proof before any write**: `finalize` now exports the exact commit SHA it pushed (commit-action's `commit-sha` output) plus the post-sync tip. The tip must be exactly the finalize commit parented on `PRE_SHA`, or the sync commit directly on top of it — and since this org squash-merges PRs (single-parent, indistinguishable by parentage alone), the sync-tip path additionally gates on the sync commit's fixed message `chore: sync issues and PRs` (devkit also pins the author `commit-action-bot[bot]`; live-verified against the real 1.7.0 finalize/sync pair on `main`). Anything else ⇒ `::error` + step failure, branch untouched; the failure issue and job summary report the outcome. Only when the proof passes does the existing tree-at-`PRE_SHA` revert commit run — at that point it is exactly a revert of the run's own commits. The PR-body restore step (and its Release-App token mint) now also skip when finalize was skipped — finalize is the only PR-body writer. **All three copies fixed consistently**: devkit's `release.yml`, scaffolded `release-core.yml` (new `finalize_commit_sha` / `finalize_result` workflow_call outputs), and the scaffolded orchestrator `release.yml` — whose old rollback was a `git reset --hard $PRE_SHA` + force-push with zero guards, now replaced by the identical guarded API revert. Scaffold copies gate on the sync message only (the commit-bot name is per-consumer, the shipped `sync-issues.yml` message is a constant); script bodies are byte-identical between copies. No concurrency group (issue proposal 4) — deliberately out of scope. ## Tests TDD: `test(ci)` commit landed RED first (18 failed / 5 passed — the 5 were retained behaviors). New `tests/test_release_rollback_guard.py` executes the actual workflow scripts against stubbed `gh`/`retry` simulating the Git Data API, parametrized over both copies: both incident shapes no-op, foreign-tip and foreign-parent refuse, foreign squash commit atop finalize refuses (the row that fails against the unhardened script), genuine sync commit reverts. Existing #1378 rollback-identity test rewritten to pin the App-token API rollback. Verification (direct exit codes): `pytest tests/test_release_rollback_guard.py tests/test_workflow_release_publish.py` → 43 passed; broad `pytest tests/` (excl. image/integration/flake) → 524 passed; `actionlint .github/workflows/release.yml` clean; rendered-tree actionlint bats 6/6 (covers the scaffold copies in all modes); full `prek run --all-files` → exit 0. Also included: `chore` merge of `release/1.8.0` (brings in the #1463 fix from #1464; changelog union resolved manually, mirror byte-identical), and stale "branch reset to pre-finalization state" wording updated in `docs/RELEASE_CYCLE.md` / `DOWNSTREAM_RELEASE.md` and the failure-issue texts. ## Notes - Failed-job output propagation for `finalize_commit_sha` follows the pattern the job already relied on for `pre_finalize_sha`. - The dead `git_user_name`/`git_user_email` plumbing in `release-core.yml` (now unused after dropping the git-CLI rollback) is left in place — removal ripples across three workflows; separate-issue material. - The interim operating rule from the issue (don't merge into a release branch mid-run) becomes a courtesy rather than a data-integrity requirement, but remains good practice. Closes #1462
This was referenced Aug 12, 2026
c-vigo
added a commit
that referenced
this pull request
Aug 12, 2026
…ling (#1471) ## Summary After #1463 (PR #1464), `just worktree-start` no longer unsets `core.hooksPath` — a configured hooks path is left untouched (the tracked `.githooks` shims cover the new worktree) and the prek install into the shared `.git/hooks` survives only as the fallback when no hooks path is set. The #1454 doctor comments in both `justfile` copies still asserted the old behavior was "the INTENDED state ... on purpose", which would actively mislead the next hook-state investigation (the #1430 → #1454 → #1461 → #1463 chain shows how much debugging here leans on these comments). ## Changes Comment-only, zero behavior delta: - `justfile` + `assets/workspace/justfile`: the doctor linked-worktree comment now describes post-#1463 reality — the shared-hooks PASS branch covers the no-hooksPath fallback plus worktrees created before #1463; a post-fix worktree keeps the shared setting and hits the normal `.githooks` PASS branch. The `--git-path` rationale and the copies' one-phrase wording difference are preserved. (These are independent copies — `scripts/manifest.toml` mirrors only `justfile.gh`/`justfile.worktree` — so both needed the hand edit.) - `tests/bats/doctor.bats`, `tests/bats/consumer-doctor.bats`, `tests/test_flake_hooks.py`: the same stale claim repeated in test comments, folded in per the scope note on the issue. Doctor logic and echo strings untouched; no changelog entry (internal docs). TDD skipped: comment-only, non-testable. ## Verification `bats tests/bats/doctor.bats tests/bats/consumer-doctor.bats` → 26/26 ok; full `prek run --all-files` → exit 0; clean tree. Closes #1469
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
just worktree-startrangit config --unset-all core.hooksPathfrom inside the new linked worktree.core.hooksPathis shared repo config, so the unset disarmed the main checkout's tracked.githooksshims repo-wide — the #1430 failure mode, self-inflicted by a primary devkit workflow.Fix
Skip-when-set: a relative
core.hooksPathresolves against each worktree's root, and.githooksis tracked (present in every worktree), so when the setting exists the tracked shims already cover all three hook stages in the new worktree.worktree-startnow leaves the config untouched and skipsprek installin that state. The oldprek installpath survives only as the fallback when no hooks path is configured at all (the unset line is gone — it was a no-op there anyway).Rejected alternatives:
git config --worktree --unset-all: needsextensions.worktreeConfigrepo-wide, and a worktree-scoped unset cannot mask a shared value — it would actually require a worktree-scoped SET plus the extension flip. More moving parts for no gain given the shims are already present.Both copies fixed identically:
justfile.worktreeand the scaffoldedassets/workspace/.devcontainer/justfile.worktree.Tests
TDD:
test(workspace)commit landed RED first. Two new bats tests intests/bats/worktree.batsdrive the real recipe (both copies) in a sandbox repo with a bare origin and stubbed tools:core.hooksPathsurvivesworktree-start, all three tracked shims are executable in the new worktree, andprek installis never invoked;bats tests/bats/worktree.bats tests/bats/githooks.bats→ 14/14 ok; fullprek run --all-filesgreen.Notes
justfile/assets/workspace/justfilestill describe the pre-fix behavior ("worktree-start unsets core.hooksPath on purpose"); the doctor logic itself remains correct for both pre-fix worktrees and the fallback path, so those comments were left alone (minimal diff) — cheap follow-up if wanted.git config commit.template .gitmessagein the same recipe also writes shared config from the worktree, but idempotently (same value as main); out of scope here.Closes #1463