Skip to content

refactor(lib): simplify plugin-options, publish-gate, pydeps and prerequisites shared libs - #15387

Merged
kyle-sexton merged 5 commits into
mainfrom
refactor/simplify-prerequisites-libs
Nov 11, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
refactor/simplify-prerequisites-libs

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #14335

Summary

Simplifies four shared lib sources from #14335 without changing their behavior: lib/plugin-options.mjs, lib/publish-gate.mjs, lib/pydeps.py and lib/prerequisites.mjs. lib/prerequisites.sh and lib/prerequisites.ps1 are unchanged: each is a short launcher with nothing to simplify, and the PowerShell file is left alone on purpose.

Built by hand rather than by the issue lane. The lane's patch was refused at the 262144-byte scan cap because prerequisites.mjs has 77 regenerated copies under plugins/, so every changed line is multiplied. The hand build was agreed with the hub session.

session: Simplify Planning

Fix

  • 134 hand-changed lines across 4 source files (cap 400 lines, 15 files), one commit per source file.
  • scripts/sync-shared-copies.sh regenerated the copies in the same commits; each plugin whose copy changed has one bump: patch changelog fragment ("Internal simplification, no behavior change.").
  • No code moves between files and no cross-file dedupe; that belongs to the sub-epic's restructuring pass.

Verification

  • node --test: prerequisites, check-declared-prerequisites, prerequisites-fleet, git-hooks install, promotion-evidence (96), publish-gate (171) and the publish-gate consumers that load here; all pass. Two consumer suites (callers.test.mjs, report-outcome.test.mjs) could not load locally for missing npm packages (ajv, yaml); CI runs them.
  • prerequisites.test.sh (326), result-gate.test.sh (48), animation install-python-deps.test.sh (21), sync-shared-copies.test.sh (96), and the three pydeps suites run directly (23/19/32): all pass.
  • sync-shared-copies.sh --check (767 copies match) and --check-bump origin/main, check-changelog-fragments.sh --check (89 valid), run-ruff.sh clean, biome lint no new findings.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH

kyle-sexton and others added 5 commits November 11, 2026 10:04
Hoist the isObject guard to module scope and reuse it for the settings
root check, build the managed settings list in one expression, and
resolve options into one object read user-first then managed, which
gives the same keys, order and precedence as merging two objects.
Regenerate the four shared copies and add a patch fragment per carrier.

Refs: #14335

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
Share one blocking-pattern lookup between the line classifier and the
UTF-16LE pass, one hunk-line test between deeperLeak and locateHit, and
one visibility reason and source name between the artifact and hosted
gates. Build the split-line pass's global regexes once at load instead
of on every adjacent-line pair. Regenerate the six shared copies and add
a patch fragment per carrier that lacked one.

Refs: #14335

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
Collapse the two-branch version checks in supported and _runs_supported
and the launcher listing's return into conditional expressions, and find
the `--` separator once in main instead of four times. Regenerate the
three shared copies and add a patch fragment per carrier.

Refs: #14335

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
Name the repeated "a string matching this pattern" test once and use it
across the manifest validation, share the schema-failure message
between check, report and probe, and call report directly from main in
place of a one-line wrapper. Regenerate the 77 shared copies and add a
patch fragment per carrier that lacked one.

Refs: #14335

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
Restore main's two-object merge in readOperatorOptions. The single
shared object let an option key named __proto__ set the result's
prototype, which main's object spread dropped, so behavior differed on
that key. Both PR reviews flagged it.

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

chatgpt-codex-connector Bot commented Nov 11, 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-11T17:59:39.803939Z b997c60 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.

@kyle-sexton
kyle-sexton marked this pull request as draft November 11, 2026 17:56
auto-merge was automatically disabled November 11, 2026 17:56

Pull request was converted to draft

@kyle-sexton
kyle-sexton marked this pull request as ready for review November 11, 2026 17:56
@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15387, head b997c60

No security issues found.

Scope. I read every hunk in .claude-lane/chunks/distinct.diff. That covers the four shared sources (lib/plugin-options.mjs, lib/prerequisites.mjs, lib/publish-gate.mjs, lib/pydeps.py), the first path of each identical-copy group, and one changelog fragment. The copies listed in identical.txt count as read. Every copy sits at an ordinary lib, script or hook-helper path, and none of them changes behaviour. That includes plugins/toolchain/hooks/plugin-options.mjs and plugins/source-control/skills/babysit-loop/scripts/operator-options.mjs: each is a module that other code imports, and its own content is unchanged in effect. So no copy's location changes what its content does.

Trusted path: lib/publish-gate.mjs and its 6 copies. I read the whole change and what it gates, which is the decision to publish an artifact or hosted page versus keep it as a local file, plus the credential and leak checks.

  • blockingIn returns the label of the first BLOCKING match. Before, the code checked whether the matched tuple existed; now it checks the label string. These are equivalent because the labels are non-empty strings.
  • JOINABLE_ALL builds each global regex once, at module load. JOINABLE is defined at L91, before its use at L240, so there is no load-order failure. matchAll works on its own copy of the regex, so a shared regex's lastIndex carries nothing from one call to the next. The re.test(left) || re.test(right) short-circuit is unchanged.
  • isHunkLine is the same predicate as before, now extracted into a function.
  • notPublic and sourceOf keep the same rule: only PUBLIC or NONE passes, and every other visibility, including unknown, falls back to the file or private host. Both are const arrows declared after publishGate. They are only called at runtime, and the CLI entry point at L526 runs after they are initialised, so there is no TDZ (temporal dead zone) error.
  • The order of checks did not change in either the artifact gate or the hosted gate: explicit, then visibility, then secret, then machine. Nothing that the base version stopped gets through.

lib/plugin-options.mjs (managed and user option resolution). The managed file comes first, then the sorted .json drop-ins, the same order as before. Moving isObject up to module level changes nothing. Malformed pluginConfigs still fails closed.

lib/prerequisites.mjs. matches(v, re) is exactly typeof v === "string" && re.test(v), so every schema check rejects the same inputs as before. Inlining cmdReport and extracting schemaFailure produce the same output and exit codes.

lib/pydeps.py. When there is no --, splitting at len(argv) gives the same rest == [] and passes all of argv to parse_args. supported, _runs_supported and _launcher_listed are equivalent rewrites. No new subprocess input or interpolation is added.

Other checks.

  • No plugin manifest, workflow, trust-control or merge-hold file is touched.
  • No standing instruction is deleted or weakened.
  • The 77 .changes/** fragments are changelog text only.
  • The PR context holds no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

This PR simplifies four shared lib sources (lib/plugin-options.mjs, lib/prerequisites.mjs, lib/publish-gate.mjs, lib/pydeps.py), regenerates their shared copies and adds one bump: patch changelog fragment per plugin whose copy changed. I read every hunk in the distinct diff, which covers each first path in identical.txt. The identical copies count as read, which makes all 171 listed files.

Behavior-preservation check (the closing issue's first criterion)

  • plugin-options.mjs: isObject moves from inside optionsIn to module scope. No other binding in the file uses that name. managedSettingsFiles still returns the base managed-settings.json first, then the sorted drop-ins, and it still throws on an unreadable drop-in directory as before.

  • prerequisites.mjs: each typeof x === "string" && RE.test(x) pair becomes the same expression in matches(x, RE), with identical error text. schemaFailure gives the same stderr string at all three call sites. cmdReport was a private one-line wrapper, and main now calls report(opts.roots, …) directly. matches and schemaFailure are new names that collide with nothing in the file, and both are defined at module scope before any CLI path runs.

  • publish-gate.mjs (trusted path, read in full):

    • blockingIn returns the matched label instead of the [label, re] pair, and every caller now uses the label directly.
    • JOINABLE_ALL builds the global regex once, after JOINABLE (line 91). String.prototype.matchAll iterates a clone of the regex, so sharing one global regex between calls carries no lastIndex state from one call to the next.
    • isHunkLine keeps the same filter.
    • notPublic and sourceOf give the same reasons and branches for PUBLIC, NONE and every other visibility, in both publishGate and hostedGate. They are consts declared after publishGate, but they are only reached from the CLI at line 514 or from an importer, both after module evaluation, so they are never read before initialization.

    No gate decision or message changes.

  • pydeps.py: supported, _runs_supported and _launcher_listed become equivalent conditional expressions. In main, split = len(argv) when there is no --, so rest is [] and parse_args(argv) gets the same arguments as before.

Copies at other paths: plugins/toolchain/hooks/plugin-options.mjs and plugins/source-control/skills/babysit-loop/scripts/operator-options.mjs carry the same content as the other plugin-options copies. Both are imported modules, not a hook manifest, settings or workflow file, so the content does nothing different at those paths. .claude/rules/mod-authoring.md matches plugins/*/hooks/**, but that file is a regenerated lib copy, not a hooks module the rule covers.

Closing issue #14335 criteria

  • Behavior unchanged: met, by my reading above. The existing suites for these libs (prerequisites, publish-gate, pydeps) assert on their outputs. The test runs listed in the PR body are author-claimed; I did not run them.
  • Only listed files, regenerated copies and fragments edited: met. prerequisites.sh and prerequisites.ps1 are left unchanged on purpose, and the PR body says why.
  • Within 400 lines and 15 hand-edited files: met (4 source files hand-edited).
  • sync-shared-copies.sh run and copies committed: the copies are in the diff. That they match the sources is author-claimed (--check); I did not run it.
  • ci-status green: not checked by this lane.

The changelog fragments cover all 77 plugins that carry a changed copy, including every plugin with a changed pydeps, plugin-options or publish-gate copy.

No plugin manifests changed. Nothing in the diff adds spend or billing.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 5afeff0 Nov 11, 2026
129 of 146 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/simplify-prerequisites-libs branch November 11, 2026 18:36
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 11, 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.

Simplify the plugin-options.mjs, prerequisites.mjs, prerequisites.ps1 and 3 more shared lib sources

1 participant