Repository navigation
feat(git-hooks): migrate hook artifacts left under an earlier plugin name - #15594
Conversation
…name The git-hook installer now finds everything an install under an earlier plugin name left for one of a plugin's entries: stamped copies in the repository and user config-hook directories, <event>.d markers, lefthook jobs that run such a copy, decline keys, config-hook keys and the includeIf that loads them. Entry names are unique across plugins, so no earlier name appears in code. - verify adds a superseded row per earlier plugin name, naming the exact removal; a decline under the earlier name counts as declined, resolved by git's precedence (its false is an opt-in), and stays silent at session start. - plan returns a superseded decision per entry and earlier name; the setup agent removes the artifacts and carries each decline to the entry's own key at the same scope on the user's yes, through the new install.mjs decline --opt-in for a false value. - copy writes the local opt-in when only the master or own global key would decline, so an install survives the old key's removal. - Synced to every carrier; the decisions reference (synced copies and guardrails' copy), each carrier's setup skill check step, the check-placement contract and minor fragments describe it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1115d3875
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed Security review: PR #15594, changes since
|
Two review findings on the superseded plan: - A decline under an earlier plugin name that an includeIf scopes to some repositories was planned by scope only, so the carry landed in the main global file (every clone) and the unset missed the included key. Each declines[] and config[] item now names the config file that sets it, decline takes --file to write the plugin's own key there, and the decisions reference has the agent carry and unset in that file. - The carried value was hand-parsed, so a value git reads as true, such as 2, was planned as an opt-in. Each line's boolean now comes from git config --type=bool in its own file, the same reading configBool uses; a value git rejects is only unset. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
The superseded scan took an earlier plugin name from repository directory and marker names (behind a stamp a repository author can forge, or none) and from decline config keys, so a cloned repository could put a name such as `$(...)` into the paths the setup agent is told to delete. Every source of an earlier name (copy directories, <event>.d markers, lefthook jobs, decline keys and config-hook keys) now has to match the entry-name rule ([a-z0-9][a-z0-9-]*), one NAME_PART pattern shared by all; any other name is skipped. The decisions reference tells the agent to pass each listed path, key and value as one argument, never inside a shell string. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
claude-review reviewed claude-review: incremental review of Scope. I read every hunk of the 8 files in
None of the copies sits at a path that changes what its content does. Guardrails' hand-kept copy has the same new What changed. Before this push, the installer treated any other plugin name as a possible earlier name. Now it uses only the names the plugin lists in a new
The tests cover these cases:
The existing superseded and decline tests now declare their earlier names. No blocking findings. A minor point, not counted: the Settled threads. The Windows short-name Closing issue. The PR body says Manifests. This push changes no Embedded text. I found none in the PR context, the settled threads or the prior findings. Not verified by me. I had no shell and ran nothing. The test counts, the sync check and the mutation results in the PR body are the author's claims and unverified. |
…own key The plan marked an earlier-name line for carry-over whenever the file that sets it had no own key, though the entry's own key wins from any scope. Following the plan could then flip a decline. A line is now only unset once the own key is set anywhere. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
… reaches Following the superseded plan must never change whether the entry is declined, in the clone that plans or in any other. The own-key guard was clone-wide, so a global earlier-name line was only unset once this clone had a local own key (as copy writes), and every other clone lost the decline. carryOver() now decides per line: a local line is carried when no own key is set here; a global line is carried unless an own key at system scope or in a main global file already reaches every clone, and is kept for the user (keep: true) when an own key in an include holds the other value, since a carry then shadows that include and no carry drops the decline elsewhere. The decisions reference tells the agent to leave and report a kept line. A table-driven test checks the invariant over 100 states (own key, earlier key, master key) in the planning clone and a second clone; before this fix it failed the 6 states with a local own key and a global earlier key that disagrees with the master key. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
Held: a seventh review finding on the decline carry-over (a global carry can change clones covered by an |
The decline carry-over read config only as the planning clone sees it, so an own key or an earlier-name line in an include this clone does not match was invisible: a global line was carried over an own key that only another clone reads, and an earlier-name line in such an include was never listed or removed. sharedConfig() now reads the system file and both global files directly (GIT_CONFIG_GLOBAL, or ~/.gitconfig and $XDG_CONFIG_HOME/git/config) with every file they include, nested to git's depth, whatever the condition, marking each file conditional or not; a file that exists but cannot be read counts against every shared line. Each file's lines are read on their own with git's boolean reading, so a key set twice is listed per line. carryOver() then decides from the clones each line reaches: an own key in a file every clone reads means unset only, one in a conditional include with the other value means keep, and a local or worktree line follows this clone's own key. Earlier-name lines in includes this clone does not match are now listed, carried and unset in place. The invariant test grows to 234 states with includes that match only the planning clone or only a second clone, checked in three clones, and now also asserts that no earlier-name line is left but kept ones. Before this fix 60 states failed. New tests cover nested and unreadable includes, both global files, a key set twice, mixed-case section names and worktree config. The decisions reference tells the agent what the scan covers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
Hold lifted: the owner chose the complete carry-over ("nothing cosmetic left behind, whatever is cleanest/tidiest, best long term", 2026-11-12), and it is pushed in 2ceccce. The usual merge gates apply: both review lanes on the head, |
|
The pr-verify verifier failed head What it wrote (82 lines)This pull request leaves the merge queue, and ci-status holds it out while it carries |
…ge it A carry writes the own key into the line's file, where git appends a new section at the end, past everything the file includes, while an included file is read at its include line. Two earlier-name lines of different values in a file and a file it includes could so be carried in the other order, flipping every clone that reads both. orderBound() states the principle: a carry is planned only when its outcome cannot depend on file order. Within one include chain (the system file, each global file, this clone's local file, its worktree file, each with what it includes), readOrder() records where each file's last earlier-name line and its end fall; carries of different values in two files are kept when those come in a different order, or when the chain reads a file twice. Carries into one file replace each other and end on git's value. Separate chains keep their order. Different values under two earlier plugin names, read as "declined when any is true", are kept too. The invariant tests now run each case in its own HOME through child processes, concurrently: 234 one-line cases and 168 two-line cases (a file and its include, a file and an includeIf only another clone matches, a local file and a local include, both include orders, and both global files). Before this fix 20 two-line states failed, all with the include line after the key in the parent and different values. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
Held: a ninth review finding on the decline carry-over (a file included from two global config chains) is open. Before another patch, the owner is asked whether to keep modelling git's shared-config read order or to carry at local scope only and report shared lines. The hold ends when the owner chooses and the chosen change is pushed. |
…cal key only The decline carry-over modelled the read order of shared git config so it could carry and unset lines in system and global files and their includes, and each review found another order it missed. Following the owner's ruling, the plan now acts on the planning clone only. - An earlier-name decline key still counts at any scope, as git resolves it (own key, then the earlier-name key, then the master key). - When this clone sets no own key, plan carries the value this clone resolves to the own key in its local config; keys under different earlier names that resolve differently, or to no boolean, carry nothing and are kept for the user. - Only earlier-name lines in this clone's own local and worktree config files are listed for removal. A line in a system or global file, or a file one includes, is marked keep and shared; one in a file a local include pulls in, keep and included. Neither is ever edited: the setup agent shows the user the command to remove it once every clone relying on it has its own key, and verify stays silent about it once this clone has one. - sharedConfig(), readOrder(), orderBound(), carryOver() and decline --file are gone. repoInfo reads its paths in one rev-parse call. - The invariant test is one 130-case table in-process; the file runs in about 7.5 s. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
Hold lifted. Design change in ff20d68 (owner ruling, 2026-11-12): the decline carry-over is now local-only.
The usual merge gates apply: both review lanes on the head, |
repoInfo resolved the clone's own config paths against the directory as the caller spelled it, while config lines carry the path git reports. Through a symlinked or short-name path a local earlier-name line read as coming from an included file and was never listed for removal. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
The JavaScript realpath keeps a Windows short-name component as written, while git reports the long name, so the clone's own config still did not match through a short-name path. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…rlier names The installer treated any other plugin name holding a copy, marker, lefthook job, config-hook key or decline key for the same entry as an earlier name, relying on entry names being unique across plugins, which nothing enforces: a plugin shipping a same-named entry could have its live install offered for removal and its declines counted. A renamed plugin now declares its former names as a top-level earlierNames array in git-hooks/entries.json, the manifest the installer already loads and validates. Each name must match the entry-name rule, must not be the plugin's own name and may not repeat; anything else is a manifest error. leftovers() and the decline lookup read only those names, and with none the installer behaves as before this change. Each name is a migration line, removed once no consumer repository still holds artifacts under it. The check-placement contract, the decisions reference and the fragments say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
Refs: #15552
Summary
The shared git-hook installer (
lib/git-hooks/install.mjsand its copy in every carrier plugin) now finds what an install under a plugin's former name left for one of its entries, when the plugin declares that name, and gives the setup agent what it needs to retire it. Nothing is renamed here: this is the generic support a plugin rename needs before it lands.Fix
A renamed plugin declares its former names as a top-level
earlierNamesarray ingit-hooks/entries.json. Each name must match the entry-name rule, must not be the plugin's own name, and may not repeat; a malformed list is a manifest error. Each name is a migration line, removed once no consumer repository still holds artifacts under it. With noearlierNames, the installer behaves exactly as on main.verifyadds onesupersededrow per declared earlier name an entry has artifacts under. The artifacts are:<event>.d/markers;includeIf;Only declared names are looked at, so another plugin that ships an entry of the same name is never reported, offered for removal or counted. The installer code holds no earlier name.
A decline key under a declared earlier name still counts, at any scope. Git resolves it: the entry's own key comes first, then the earlier-name key's resolved value, then the master key. Nobody is asked again, and an earlier opt-in (
false) still wins over a master decline.planreturns asupersededdecision per entry and earlier name. For declines it acts on this clone only:install.mjs decline, with the new--opt-inforfalse). When keys under different earlier names resolve differently, nothing is carried and the lines are kept for the user.keepandsharedand is never edited. The setup agent shows the user the exactgit config --file <file> --unset-all <key>command, to run once every clone that relies on that line has its own key. A line in a file a local include pulls in is markedincludedand reported the same way.verifystays silent about shared lines once this clone has its own key.copywrites the local opt-in when only the master key or the own global key would decline, so an install survives the old key's removal.repoInforeads the work tree root and the hooks, exclude and config paths in onegit rev-parsecall instead of three.Docs:
setupskill;earlierNamesfield, and thesupersededand decline rows of its drift table.One
minorchangelog fragment per carrier plugin (10).Verification
node --test --test-concurrency=4 lib/git-hooks/install.test.mjs: 226 tests, 222 pass, 0 fail, 4 skipped, about 7.6 s. The skipped cases are config-hook cases that need git 2.54; this host has 2.53.0.true/falseat local or global scope), the earlier-name key (unset, ortrue/false/2at local scope, at global scope, or in an include that only one clone matches), and the master key.planproposes nothing more.earlierNames(a hostile name, not a list, a repeated name, the plugin's own name).bash lib/git-hooks/check-lib.test.sh: 61 passed, 0 failed.scripts/sync-shared-copies.sh --check: all 818 registered copies match.scripts/check-changelog-fragments.sh --check-required origin/main: all 10 changed fragment-mode plugins have a fragment.typos --config _typos.tomlover the changed files: no findings.Against the issue text
This follows #15552's "The old name reaches it as data from the plugin, a migration line listed in the PR with its removal condition": the installer reads former names from the plugin's
earlierNames, and the rename PR (#15568) supplies the value.Related
typos-formattospelling), which needs this before it can land and is too large for the review lanes as one pull request.session: AI Hero
🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr