Skip to content

feat(source-control): provision a record's declared prerequisites - #18184

Merged
kyle-sexton merged 11 commits into
mainfrom
feat/16683-provision-prerequisites
Nov 22, 2026
Merged

kyle-sexton merged 11 commits into
mainfrom
feat/16683-provision-prerequisites

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Closes #16683

Summary

Adds the provisioning step the issue's 2026-11-21 amendment defines. An ecosystem record's requires entry may carry install: {manager: npm, lockfile: <repo-relative path>}, and nothing else. A separate step runs npm ci --ignore-scripts --no-audit --no-fund in that lockfile's directory. The check itself still installs nothing.

Fix

Each Done when item, in order:

  1. Schema. docs/contracts/ecosystem-commands/ecosystem.schema.json adds an optional install object on a prerequisite: additionalProperties: false, manager limited to npm, and a required lockfile that must be a repo-relative package-lock.json or npm-shrinkwrap.json. examples.test.sh adds one accepted case and five rejected ones: an extra key, a manager other than npm, no lockfile, a .. path and an absolute path. The contract README gains a "Provisioning" section, and the contract CHANGELOG gains 1.8.0, above the 1.7.0 location change from feat(ecosystems): move ecosystem records to docs/conventions/ecosystems #18187.
  2. The step. plugins/source-control/scripts/provision-prerequisites.sh takes its list from provision-prerequisites.mjs list and runs the npm command in each declared lockfile's directory. An entry without install gets nothing. The shared-seed install moved here from the worktree helper, and the seed key now includes the npm command, so seeds built with scripts on are not reused.
  3. Record. docs/conventions/ecosystems/typescript.yaml declares the root package-lock.json under check-cmd with install. This is one added hunk.
  4. One install path. worktree-create.sh has no npm ci of its own and calls the step. skills/worktree/context/create.md describes that path with scripts off.
  5. Fresh worktree. worktree-create.test.sh "lockfile: node_modules/.bin lands in the new worktree" creates a real worktree from a repo whose committed record declares its lockfile. The step installs it with no manual command. In provision-prerequisites.test.sh, the entry's probe passes after the step runs.
  6. Not-run cell. provision-prerequisites.test.sh shows the failure path: the install fails, the step exits 1 and names the entry and the command, and the entry's probe still reports absent. A model-run skill writes the skip (prerequisite missing: <name>) cell itself, so no deterministic test can show it. The existing eval plugins/toolchain/evals/ck-prerequisite-missing-incomplete covers that cell; it was not run for this change. Neither toolchain skill runs the step.
  7. Toolchain report. The not-run text in toolchain:check, its gates context and toolchain:lint names provision-prerequisites.sh beside the hint.

Other changes:

  • The decision's "Dissent considered" paragraph says scripts off can leave node_modules/.bin/claude as an executable stub that does not run. So verify-load.test.sh and adherence-experiment.sh now use that path only when --version runs, and fall back to claude on PATH otherwise.
  • Behavior change for repositories that consume the plugin: worktree creation no longer installs a package-lock.json that no record declares. This follows the decision ("installing only what records' requires entries name"), and the source-control changelog fragment says so.
  • The root lockfile entry sits under check-cmd. No typescript command strictly needs the root install, since biome runs only in plugins/miro/server, which has its own node_modules. So any key carries the same cost: in a clone without root node_modules, every typescript check-cmd reads skip. check-cmd is the command whose tool, biome, the root lockfile provides. Basis: judgment, package.json devDependencies.
  • The comment lint (necessary posture) flags every comment line this change adds. To satisfy it, the header paragraph of worktree-create.sh (9 lines, 2 of them stale about npm ci) was deleted instead of edited, along with the new block's comments. The helper's --help text still documents dependency install. Basis: the code-tidying-remote-comment-lint pre-commit output.
  • The contract README's Consumers table lists source-control as a new reader of install.
  • The step reads records from docs/conventions/ecosystems/ first and a legacy .claude/ecosystems/ file only for a name absent there, warning with both paths when both exist, as the contract's "Legacy location" section and feat(ecosystems): move ecosystem records to docs/conventions/ecosystems #18187's readers do.
  • Three corrections from the main-branch review of feat(ecosystems): move ecosystem records to docs/conventions/ecosystems #18187: the unattended "write nothing" rule in toolchain:check (SKILL.md), toolchain:lint (SKILL.md) and plugins/toolchain/reference/resolution-ladder.md now names the legacy .claude/ecosystems/ beside docs/conventions/ecosystems/, matching the graders of ck-unattended-stated-unresolved and ck-unsure-run-is-unattended; and plugins/code-metrics/reference/config.md links the contract's "Legacy location" section.

No change under .github/workflows/. The amendment takes the CI setup step and the CI cache out of this issue's Done when list, and it leaves CI's "Install the locked root toolchain" step outside the provisioning step.

Verification

  • bash plugins/source-control/scripts/provision-prerequisites.test.sh: 45 passed, including a legacy-location record read when the new home lacks that name, and a shadowed legacy record not read and named in a warning.
  • bash plugins/source-control/scripts/worktree-create.test.sh on the final tree: 404 passed, 1 skipped (Windows-only). This includes the declared-lockfile, undeclared-lockfile, seed and scripts-off cases.
  • scripts/check-affected.sh --base <merged main>: 21 passed, 1 skipped, over 24 changed files.
  • bash plugins/toolchain/tests/not-run-names-provisioning-step.test.sh: 7 passed.
  • scripts/sync-shared-copies.sh --check: all registered copies match. scripts/check-changelog-fragments.sh --check-required: every changed fragment-mode plugin (4) has a fragment.
  • node_modules/.bin/claude --version in a worktree installed with scripts on prints 2.1.329 (Claude Code), so the verify-load change still picks the root binary there.
  • Not run: scripts/check-read-caller-keys.sh --check, which needs .github/standards/runner-policy's packages installed locally. CI runs it.
  • bash docs/contracts/ecosystem-commands/examples.test.sh: 16 passed.
  • check-jsonschema validates the edited docs/conventions/ecosystems/typescript.yaml against the new schema.
  • shellcheck is clean on every changed shell file.
  • scripts/selection-audit.sh trace --strict on the new suite and on worktree-create.test.sh: no gap.
  • The live probe in verify-load.test.sh was not run, because it starts a Claude session.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35

kyle-sexton and others added 5 commits November 22, 2026 12:03
An ecosystem record's requires entry may carry an install object,
{manager: npm, lockfile: <repo-relative path>}, and nothing else. The new
provisioning step, plugins/source-control/scripts/provision-prerequisites.sh,
runs npm ci --ignore-scripts --no-audit --no-fund in the directory of each
declared lockfile and nothing for an entry without install. Its lister,
provision-prerequisites.mjs, reads the records from .claude/ecosystems and
docs/conventions/ecosystems.

worktree-create.sh no longer runs npm ci itself: it calls the step, which
keeps the shared-seed install, so new worktrees install with scripts off and
install no lockfile a record does not declare. This repository's
typescript record declares the root package-lock.json with install, so new
worktrees still get root node_modules.

The check still installs nothing: toolchain's not-run report names the step
beside the hint. The schema gains the install object and its test cases. The
verify-load probe and the adherence experiment now use node_modules/.bin/claude
only when it runs, since a scripts-off install can leave it a stub.

Closes #16683

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 22, 2026 18:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T18:48:25.919659Z 9cf4b56 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9cf4b56102

ℹ️ 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".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 45057023911, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45057023911

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 9cf4b561027ef4eb1a35a9a49f84d431b03d2f7c; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 1d6576a89c764c4bc0f1eacebf3a3358a74381e7: read 10 of 10 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18184 at 1d6576a8 (incremental since c37003b8)

No security issues found. This lane already reviewed earlier heads of this PR, so this review is blocking only: it reports only CRITICAL and IMPORTANT findings. I read every hunk of all 10 files listed in .claude-lane/incremental-files.txt. None of them matches a trusted path.

critical-findings: 0

What I checked

  • Which folder a record comes from (provision-prerequisites.mjs#L8).
    • RECORD_DIRS now lists docs/conventions/ecosystems first.
    • The new recordFiles reads a legacy .claude/ecosystems/<file> only when the new folder has no file of that name, and warns when the new file takes its place.
    • The base read both folders. This version reads the same set or fewer, so no new record text reaches the step.
    • Records are still only parsed as data with the plugin's own yaml-subset.mjs.
    • Every install entry still has to pass installError (only manager: npm, and a relative package-lock.json/npm-shrinkwrap.json path with no ..) before anything runs.
    • The command run is still the fixed npm ci --ignore-scripts --no-audit --no-fund.
    • The rest of the refactor in listInstalls only moves code: validation, the existence check and the grouping by directory are unchanged.
  • Seed cache. This push does not touch provision-prerequisites.sh. The seed-key fix that the settled threads cover (lines changed since resolution: no) is unchanged.
  • Skill text (toolchain check/lint SKILL.md, resolution-ladder.md). The unattended "write nothing" rule now also forbids writing a legacy .claude/ecosystems/ record. That narrows what an unattended run may write and removes no guardrail.
  • Tests and docs (provision-prerequisites.test.sh, worktree-create.test.sh, code-metrics/reference/config.md, .changes/*). These only move test fixtures to the new folder, add a test that a shadowed legacy record is not read, and add prose. None of it is a security surface.
  • Spend. Nothing in this push spends credits or can create a charge.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 4 inline finding(s) on 9cf4b561027ef4eb1a35a9a49f84d431b03d2f7c; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread plugins/toolchain/skills/check/SKILL.md Resolved
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 1d6576a89c764c4bc0f1eacebf3a3358a74381e7: read 10 of 10 changed file(s); 0 finding(s), 0 as inline comments.

Code review (1d6576a): incremental, blocking only

I read every hunk of all 10 files listed in .claude-lane/incremental.diff (the changes since c37003b). This lane already reviewed earlier heads, so this review lists blocking findings only.

Blocking findings: none.

What changed and what I checked

  • Record lookup in provision-prerequisites.mjs. RECORD_DIRS now puts docs/conventions/ecosystems first. The new recordFiles keys each record by file name, so a legacy .claude/ecosystems/ file is read only when the new home has no file of that name. When both exist, it prints one warning naming both paths (provision-prerequisites.mjs#L38-L49). This matches the contract's "Legacy location" section: the docs/conventions/ file wins, and the reader names both paths in one warning. Moving the loop body into listInstalls changes no behaviour: the declared count, warnings, lockfile checks and per-directory dedup are the same as before.
  • Tests. In provision-prerequisites.test.sh, the shadowing case uses a lockfile path that differs from the winning record's, so assert_not_contains "legacy shadowed" would catch a legacy record that was read when it should not be. The case also checks the exact warning text. The earlier "other record home" assertion now covers a legacy-only record and checks the same output string. The fixtures in worktree-create.test.sh moved to the new home. None of these changes loosens a check.
  • Docs and changelog fragments. These cover the toolchain "write nothing" wording, the code-metrics config note and the source-control/toolchain/code-metrics fragments. They describe the behaviour above correctly. The new code-metrics fragment is bump: patch for a docs-only change, which is the right level.
  • Settled threads: none is re-raised. The worktree-create.test.sh thread is marked lines changed since resolution: yes, but this push changes only that file's declare_lockfile fixture path, not the npm-missing assertions the thread was about.

Lane notes

  • The prompt has no loosened_check_verdict: or loosened_check_patterns: lines, so I used fail with no consumer entries. It has no decision-record line either, so I did not check the citation requirement. Loosened checks would be marked: fail (default; no resolver); patterns: 0.
  • No plugin manifest changed.
  • This push adds no paid spend.
  • I ran no tests.

Verifier dropped 0 of 0 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head 9cf4b561027ef4eb1a35a9a49f84d431b03d2f7c. What it wrote, as data:

What it wrote (35 lines)
Summary: Issue #16683: judged against the 2026-11-21 amendment's done-when list. The "owner's
  answers recorded" item is a person check and was not required. The diff delivers nearly all of it:
- the schema now has an `install` object (`additionalProperties: false`, npm only, a repo-relative
  lockfile) and tests that reject bad entries;
- `provision-prerequisites.sh` runs `npm ci --ignore-scripts --no-audit --no-fund` in each declared
  lockfile's directory, and its test covers one entry with `install` and one without;
- `.claude/ecosystems/typescript.yaml` declares the root lockfile;
- `worktree-create.sh` no longer runs `npm ci` itself, calls the step and stays non-fatal, and
  `create.md` describes the single install path;
- a fresh-worktree test shows the declared lockfile installed with no manual command;
- the toolchain check, gates and lint not-run text names the step.

The not-run cell is shown only indirectly: a test proves the probe still reports absent after a
  failed install, and the cell itself comes from the existing model-run skill and its existing eval.
  I accept that. Test Bash (0)/(1)/(2) passed on the judged head
  (https://github.com/melodic-software/claude-code-plugins/actions/runs/45056968995/job/137320091892).
  The diff touches no workflow and nothing in the takeover set, has no binary files, and turning
  install scripts off makes it safer than before. No text tries to steer the reviewer.

The verdict is fail because of one correctness bug. The new step accepts `npm-shrinkwrap.json`
  lockfiles, but the shared-seed key never hashes that file. A worktree can then get a stale
  `node_modules` hard-linked from an old seed.
- plugins/source-control/scripts/provision-prerequisites.sh:150 seed_key hashes only
  package-lock.json, package.json and .npmrc, but the schema and installError accept an
  npm-shrinkwrap.json lockfile, and seed_install copies it into the seed (line 186). When only the
  shrinkwrap changes, for example a transitive update with package.json unchanged, the key stays the
  same and a stale seed's node_modules is hard-linked in. Add npm-shrinkwrap.json to the hashed file
  list, and add a test where changing only the shrinkwrap builds a new seed.
- plugins/source-control/scripts/provision-prerequisites.sh:88 `--cap` or `--seed-root` given as the
  last argument makes `shift 2` fail without shifting, so the `while (($#))` loop never ends. Check
  that a value follows (exit 2 if not) before shifting.
- plugins/source-control/scripts/worktree-create.sh:1388 `${BASH_SOURCE[0]%/*}` gives back the file
  name itself when the helper is run as `bash worktree-create.sh` with no slash, so the step's path
  cannot be found and nothing is provisioned. Resolve the script's directory with `cd "$(dirname
  ...)" && pwd`, or reuse the helper's existing script-dir variable.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 22, 2026
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 22, 2026
… helper's directory

- provision-prerequisites.sh hashes npm-shrinkwrap.json into the seed key,
  so a changed shrinkwrap builds its own seed instead of reusing a stale one.
- --cap or --seed-root given last exits 2 with a message instead of
  looping forever on a failed shift.
- worktree-create.sh resolves its own directory once and uses it for every
  sourced library and helper, so `bash worktree-create.sh` run with no slash
  in the path finds them and the provisioning step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 22, 2026
kyle-sexton and others added 2 commits November 22, 2026 14:49
…ontract's next major

When no ecosystem record declares any install entry, the provisioning step
still installs a root npm-shrinkwrap.json or package-lock.json with the same
scripts-off npm ci, and prints one notice naming the lockfile and how to
declare it. Any declared install entry, a skipped one included, turns the
fallback off. The end condition (the ecosystem-commands contract's next major
version, with the legacy-location read) is recorded in the contract's
Provisioning section and changelog.

The tests "an undeclared lockfile is not installed" (provision step) and
"undeclared lockfile: npm is not run" (worktree helper) now assert the
fallback, per the owner's decision of 2026-11-22.

The worktree helper's no-npm case asserts the exact npm-missing warning and
remedy again, and both no-npm cases put node back on PATH alone so they run
where node and npm share a directory. A new toolchain test fails if the
not-run rules stop naming provision-prerequisites.sh.

Refs: #16683

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
The toolchain test no longer checks that source-control's step file exists:
a plugin's code never loads a file from a sibling plugin
(docs/conventions/architecture/README.md). The toolchain fragment names the
new test.

Refs: #16683

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
@kyle-sexton

Copy link
Copy Markdown
Member Author

Hold lifted. The owner chose "Fallback with end date (Recommended)" for #16683, recorded on the issue (#16683 (comment)). Head 27cbde8 builds that fallback, and all 7 review threads are answered and resolved. This pull request is clear to merge once its gates pass at this head; it merges after #18187.

Posted by an agent session.

@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts

Run 45066894747, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45066894747

Failed GitHub API calls

No failed call recorded by the run job's scripts.

kyle-sexton and others added 2 commits November 22, 2026 15:37
Takes the ecosystem records' move to docs/conventions/ecosystems/
(ecosystem-commands 1.7.0). The provisioning step's contract change
becomes 1.8.0 above it. The repository's typescript.yaml install entry
moves with the record. The provisioning lister reads the new home first
and a legacy .claude/ecosystems/ file only for a name absent there,
warning when both exist; its tests and the worktree-create fixture use
the new home.

Review fixes from the location change: the unattended "write nothing"
rule in toolchain check, lint and the resolution ladder also names the
legacy .claude/ecosystems/, and code-metrics reference/config.md links
the contract's Legacy location section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtViDMW2P121uLvSb35
Lane-Activity: pr-unblock/resolve-conflicts
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch

Run 45066894747, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed c37003b
Run 45066894747

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit d9270b3 Nov 22, 2026
76 of 77 checks passed
@kyle-sexton
kyle-sexton deleted the feat/16683-provision-prerequisites branch November 22, 2026 21:30
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provision a record's declared prerequisites automatically in worktrees, unattended runs and CI

1 participant