Skip to content

ci: fail a plugin that loads a file from a sibling plugin - #16560

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/check-no-sibling-plugin-imports
Nov 16, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/check-no-sibling-plugin-imports

Conversation

@kyle-sexton

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

Copy link
Copy Markdown
Member

No related issue: first run of /architecture:enforce-boundaries on this repository, approved by the owner in session.

Summary

Records the rule "a plugin's code never loads a file from a sibling plugin" and enforces it with a repository check, proven on an injected violation.

Fix

  • docs/conventions/architecture/README.md (new): the architecture topic doc (architecture_dir: docs/architecture, landscape_dialect: mermaid) and the rule under ## Boundary rules, ending in its Enforced by: line.
  • scripts/check-plugin-imports.sh with scripts/check-plugin-imports.test.sh: reads every tracked shell, Node (.tsx and .jsx included), Python and PowerShell file under plugins/<a>/ for a relative path in a load position that resolves into plugins/<b>/. Comment lines and path strings with no anchor are not crossings.
  • scripts/plugin-imports-exceptions.txt: seven dated exceptions, each a test that holds two plugins to one contract or runs a sibling's real script, where a copy would stop checking the other side. The check also fails on a listed entry that no longer crosses.
  • plugins/testing/skills/audit/scripts/cant-fail-scan.test.sh: writes its own C# files instead of reading the mutation-testing plugin's fixture.
  • Wiring: scripts/check-affected.sh and one step in the existing check-plugins job of pr-require-checks.yml; no new job, no hook. Nothing is written to agent instructions: the check enforces the rule.

Known gaps, so a pass means no crossing of the shapes the check reads, not no crossing at all: a variable named *PLUGIN_ROOT or *PLUGIN_DIR is resolved from the plugin's root and any other variable from the file's own directory, so a path after a differently named root variable is not seen; a path written from the repository root (<root variable>/plugins/<name>/...) is not read, because on today's tree every such line builds a fixture tree (5 lines in 2 files, none a real reach); and a path joined from an expression is not seen.

Verification

  • The check passes on the tree; with source "$SCRIPT_DIR/../../guardrails/hooks/hook-utils.sh" added to one plugin script it exits 1 naming the rule and the path:line; with only that line removed it passes again.
  • scripts/check-plugin-imports.test.sh: 40 of 40. scripts/check-affected.test.sh and scripts/check-script-contract.test.sh pass with the new check registered.
  • cant-fail-scan.test.sh: 1428 of 1428 before and after the fixture change; removing one [Fact] from the new files fails 3 checks.
  • scripts/check-affected.sh --tests: 18 passed, 142 skipped; the selected test suites ran past the local time budget and are left to CI.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01MWmASLnS6k3MEmYoBnwDv3

kyle-sexton and others added 3 commits November 16, 2026 10:59
Record the boundary rule from docs/plugin-philosophy.md:100 under
Boundary rules in a new architecture topic doc, and enforce it with
scripts/check-plugin-imports.sh: a relative path in a load position
that resolves into another plugin's directory fails, naming the rule
and path:line. Four tests that hold two plugins to one contract are
listed in scripts/plugin-imports-exceptions.txt; a listed file that
stops crossing fails as stale. The cant-fail scan suite now writes
its own C# files instead of reading mutation-testing's fixture.

The check runs in check-affected.sh and in the check-plugins job
beside the cross-plugin source drift step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MWmASLnS6k3MEmYoBnwDv3
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 16, 2026 16:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 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-16T16:25:08.128479Z 88f47e7 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: 88f47e76a6

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

Comment thread scripts/check-plugin-imports.sh Resolved
Plugin hook entry points are .tsx files, and the check skipped them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MWmASLnS6k3MEmYoBnwDv3
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step skipped
Commits pushed none (read lane)
Run 43906838911

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

…rt check

A path after a variable named *PLUGIN_ROOT or *PLUGIN_DIR was resolved
from the file's own directory, so three tests that reach a sibling plugin
that way passed unseen. Each is an agreement or integration test and is
listed as a dated exception.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MWmASLnS6k3MEmYoBnwDv3
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #16560 (incremental, head 008fb55)

I found no security issues in the changes since 6ba2fe55. I read every hunk of the 3 files in the incremental scope (.claude-lane/incremental.diff).

critical-findings: 0

This review was blocking only, because this lane already reviewed an earlier head. Only CRITICAL and IMPORTANT findings would have been reported.

What changed:

  • scripts/check-plugin-imports.sh: when a path in a scanned line starts from a variable whose name ends in PLUGIN_ROOT or PLUGIN_DIR, the check now resolves that path from the plugin's root (plugins/<own>) instead of the file's directory.
    • This changes only where the string normalisation starts, through the new optional fourth argument to consider.
    • The whole local is now declared once and reused.
    • The script still runs no eval, and it never sources or runs any path it pulls out of a scanned file. Those paths are only compared as strings and tested with -d.
    • The script can still only fail the build, so it lets nothing through and is not a trust control.
  • scripts/check-plugin-imports.test.sh: two new test cases for the plugin-root variable, one where the path crosses into another plugin and one where it stays inside its own plugin.
  • scripts/plugin-imports-exceptions.txt: three test files added as accepted crossings for this architecture lint (guardrails/hooks/coverage-manifest.test.sh, harness-ops/.../skill-pair-cooccurrence.test.sh, review/tests/explain-change-chrome.test.sh). An entry only stops this lint from failing on that file. It grants no access and lets no untrusted input reach anything.

Other notes:

  • Trusted paths: none of the 3 files matches a trusted-path glob.
  • Instruction surfaces and plugin manifests: none are touched.
  • Settled thread: the one settled thread (about .tsx/.jsx coverage) is not a security point, and nothing here repeats it.
  • Prior findings: the earlier review had no findings to carry over.
  • Embedded directives: none were found.
  • Spend: nothing new beyond the existing CI check step.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review, incremental (6ba2fe5 → 008fb55), blocking only

No blocking findings. I read every hunk of the 3 files in this push:

  • scripts/check-plugin-imports.sh
  • scripts/check-plugin-imports.test.sh
  • scripts/plugin-imports-exceptions.txt

This lane already reviewed an earlier head, so per the prior-findings file this review covers blocking findings only. Advisory findings were dropped.

What I checked

  • Plugin-root anchor (check-plugin-imports.sh).

    • Matching. re_anchor group 1 holds the $NAME or ${NAME} text. The case patterns *PLUGIN_ROOT | *PLUGIN_ROOT\} | *PLUGIN_DIR | *PLUGIN_DIR\} cover both forms, so CLAUDE_PLUGIN_ROOT matches too.
    • Base. On a match, consider gets plugins/<own> as the base. Every other anchor still uses the file's own directory, because ${4:-${file%/*}} falls back to it.
    • Variables. whole is now declared local once at the top of scan_line, which drops the repeated local whole lines in the loops. Each loop's rest="${rest#*"$whole"}" still uses that loop's own match.
  • Effect on the tree. I grepped the tree for *PLUGIN_ROOT/.. and *PLUGIN_DIR/.. in scanned file types. Exactly three files now land in a sibling plugin, and each matches one of the three new exception entries:

    • guardrails/hooks/coverage-manifest.test.sh:20 → harness-config
    • harness-ops/.../skill-pair-cooccurrence.test.sh:41 → session-telemetry
    • review/tests/explain-change-chrome.test.sh:8 → visualization

    The other matches do not count as crossings:

    • $PLUGIN_ROOT/../.., $PLUGIN_DIR/../.. and $PLUGIN_ROOT/../../docs|.claude-plugin resolve outside plugins/.
    • $PLUGIN_DIR/../outside.txt in planning/scripts/repin-digests.test.sh has no plugins/outside.txt directory.
    • The .json eval samples are outside the pathspecs.

    So the stale-entry gate and the no-unlisted-crossing gate should both hold.

  • Tests. The new case puts the file at plugins/alpha/scripts/deep/a.sh. There, $PLUGIN_ROOT/../beta/... reaches plugins/beta only when it resolves from the plugin root, so the case tells the new behaviour from the old one. The "stays in the plugin" case passes under both.

  • Settled thread (.tsx/.jsx coverage): this push does not touch it, and the regression case is still there. I did not raise it again.

  • Embedded instructions: none in the PR context, settled-thread or prior-findings files.

Unverified

I could not run anything here. The PR's claims are the author's and I have not confirmed them: 40 of 40 tests passing, and the check passing on the tree.

Spend

No cost hold. This push only changes a repo-local check script, its tests and its exceptions list.

Verifier dropped 0 of 0 candidates.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 8b9a49d Nov 16, 2026
92 of 93 checks passed
@kyle-sexton
kyle-sexton deleted the feat/check-no-sibling-plugin-imports branch November 16, 2026 16:54
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
scripts/check-affected.sh 1 0 0 0 0 0
scripts/check-plugin-imports.sh 5 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
scripts/check-plugin-imports.sh:219 LCR productive input-gap

The run's summary has the full report.

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.

1 participant