Repository navigation
feat(actions): change-scoped CI execution with conservative filtering - #327
Conversation
… filtered CI Generalize the claude-security-review relevance matcher into a reusable change-detection composite action (API file listing, root-anchored gitignore matching, fail-open on every operational fault, hard errors on unhonorable filter syntax) and dogfood it in ci.yml: file-type-scoped lanes gate at job level under the always-running ci-status required check, so a skipped lane reports skipped and branch protection still passes, while a failed detection goes red instead of riding fail-open to silent green. Content-agnostic lanes and osv-scanner stay unconditional. Fixes #244 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RhS3T7ShwJgKTrvk2Mvd3C
|
Claude finished @kyle-sexton's task in 5m 27s —— View job Claude finished the reviewTasks
🔴 Blocking —
|
|
Claude finished @kyle-sexton's task in 3m 19s —— View job Security review complete
ScopeReviewed all 6 changed files against FindingsNo exploitable vulnerabilities found. Specifically checked and ruled out:
Everything above matches the defense-in-depth the PR description claims (job-level-only skips, |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d1f63d043
ℹ️ 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 has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
…t contract The shfmt lane runs flagless and reads .editorconfig, which does not set switch_case_indent; the local pre-push check wrongly passed -ci. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RhS3T7ShwJgKTrvk2Mvd3C
|
Claude finished @kyle-sexton's task in 1m 16s —— View job Security review complete
ScopeThis is a re-run on the current head, FindingsNo exploitable vulnerabilities found. Trust-boundary reasoning specifically checked:
Consistent with the prior pass on this PR: defense-in-depth is intact (job-level-only skips, |
## Fix The `zizmor` filter group matched `.github/**` and `fixtures/composite-action/**` only, but the lane runs with `paths: .` and audits composite-action metadata wherever it lives. A composite added outside `.github/actions/` — say `tools/example/action.yml` — set the group to `false` and skipped a security lane that does audit that file: an underfilter, the exact direction this action's safety model calls non-negotiable. Adding `**/action.yml` closes it. That single pattern is complete because `action.yaml` is rejected repo-wide by the always-run action-metadata-filename gate, so no second spelling can hide. zizmor is the only group needing a repo-wide pattern, and the added comment says why so the asymmetry is not read as an oversight. Every sibling lane's discovery really is confined to `.github/`, verified rather than assumed: `actionlint` auto-discovers `.github/workflows` only, `composite-run-shellcheck.sh` globs `.github/actions/*/action.yml`, and ci.yml's "Validate composite actions" check-jsonschema step passes the same scoped glob. ## Verification Drove the real `match.sh` with the filter block extracted from the live `ci.yml`, listing a single changed file `tools/example/action.yml`: - before (pattern stripped): `zizmor: false` — reproduces the skip - after: `zizmor: true` - docs-only listing after: `zizmor: false`, `markdown: true` — the change-scoping this PR exists for is intact, not traded away Also added a contract test pinning the gate to the audit scope, and confirmed it FAILS with the pattern removed rather than passing vacuously. `match.test.sh` (12 cases), `zizmor-native.test.cjs` (6), Biome format-check, and comment-hygiene all pass; the two touched files add no hygiene violations. ## Related Addresses the P2 review finding on #327. No linked issue beyond the PR's own #244. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 1m 6s —— View job Security review complete
ScopeRe-run on the current head,
This directly resolves the third-party Codex review comment on the prior commit (zizmor's filter under-covering its own FindingsNo exploitable vulnerabilities found, in this delta or in the PR as a whole. Confirmed the rest of the diff is unchanged and my prior trust-boundary analysis still holds:
Consistent with both prior passes on this PR: defense-in-depth is intact (job-level-only skips, |
Summary
Adds change-scoped CI execution with conservative filtering, per #244's spec: a new first-party
change-detectioncomposite action, dogfooded in this repo'sci.yml, so file-type-scoped lanes skip at JOB level when a PR cannot affect them — a changed PowerShell file no longer runs the .NET, Go, Python, TypeScript, or Pester lanes, and a docs-only PR runs a fraction of the matrix.Filter mechanism (decided at execution per the issue's locked scope): the action generalizes the already-hardened relevance matcher from
claude-security-review.yml'schangesjob — checkout-free PR file listing via the API (actions/github-script, no gh CLI dependency), root-anchored gitignore matching viagit check-ignorein a scratch repo,!/?/+rejected up front because they silently match FEWER files under gitignore rules than under Actionspaths:rules — extended to many named filter groups sharing one listing, emitting a singleresultsJSON output of"true"/"false"strings. First-party rather thandorny/paths-filterortj-actions/changed-files(CVE-2025-30066 was the mutable-tag vector this repo's pin policy exists to avoid): the repo already owns an audited matcher with exactly the fail-open semantics required, and reusing it keeps one matcher vocabulary (reuse-or-replace, no second parallel way).Safety model — why a needed lane cannot be silently skipped
The non-negotiable constraint is "never overfilter into silently skipped tests". Defense in depth, all layers verified against current GitHub docs:
paths:. Per GitHub's Troubleshooting required status checks, a workflow skipped by path filters leaves its required checks Pending and blocks merge forever ("Avoid requiring workflows that can be skipped"), while a job skipped by anif:conditional reports conclusionskipped— and "successful check statuses aresuccess,skipped, andneutral". This repo additionally aggregates everything into the single requiredci-statuscheck, whichif: always()runs unconditionally, so the required check always reports regardless of which lanes skipped.pull_requestevents (pushes tomainalways run everything), API listing failures, and listings at the 3,000-filepulls.listFilescap (a truncated listing could hide the file that made a lane relevant) all resolve every group to"true".!= 'false', never== 'true', under!cancelled(). A failed detection job leaves the output unset, which is not'false'— every gated lane then runs in full. String booleans are deliberate: with JSONfalseand!= false, GitHub's expression coercion makesnull == falsetrue, so a group name absent from the filters would silently skip its lane; with strings, an absent key (null != 'false') runs it.changesis aggregated byci-statusalongside the lanes it gates: config errors (bad pattern syntax, malformed groups) fail the detection job even on runs that fall back to run-everything, so lanes still run (layer 3) but the required check fails until the config is fixed — fail-open cannot become the permanent steady state unnoticed..github/**(any CI change re-runs everything); language groups glob their file types repo-wide, not just the fixture trees the lanes currently scope to; content-agnostic lanes (typos, editorconfig, gitleaks, links, exec-bit, action-metadata-filename, machine-specific-paths, eol-renormalize, comment-hygiene) stay unconditional because any file can carry the defect they gate on.osv-scanneris also deliberately ungated: a filter enumerating every manifest/lockfile format OSV supports would drift as upstream adds formats, and an unlisted new lockfile type would then skip the scan that covers it.An independent fresh-context review of the staged diff (rationale withheld) audited every gated lane's actual checked file surface against its filter group; its findings are folded in — notably
fixtures/composite-action/**added to thepowershell,actionlint, andzizmorgroups (those lanes' composite-metadata tests read those fixtures), nested**/.markdownlint*configs andnuget.configcase variants covered, the osv-scanner ungating above, executable bits on the new scripts (the ungatedexec-bitlane would have caught this PR itself), and a parser guard rejecting indented header-shaped filter lines as ambiguous instead of silently stealing the patterns that follow them.Accepted tradeoffs: gated lanes now start after the
changesjob (~30–60 s serialization per run) and the detection job itself bills roughly one hosted minute; both are recouped as soon as one lane skips (this workflow has 18 gated jobs, including a Windows Pester lane that bills at 2×). A PR with zero changed files skips all gated lanes; the ungated lanes andci-statusstill run.Deliberate non-refactor:
claude-security-review.yml's inlinechangesjob keeps its own copy of the matcher rather than calling this action. That job is deliberately checkout-free inside a reusable workflow — a local./action reference requires a checkout, and a remote reference would pin this repo's own SHA inside itself. Re-pointing it at this action (accepting a narrow checkout, under its own security review) is follow-up work, tracked on #244.Spend note and consumer rollout
This repo is public, so its own hosted minutes are free — the dogfood here is the reference wiring plus latency/queue relief. The billable win lands when the four private consumers (medley, dotfiles, provisioning, github-iac — all already on the
ci-statusaggregator pattern, none path-filtering today) adopt the action in their locally-ownedci.ymlfiles; consumerci.ymls are deliberately not standards-sync-managed, so rollout is per-repo PRs, tracked from #244.Test plan
match.test.sh: 19 cases — fail-open branches (non-PR event, failed/missing listing), per-group matching, root-anchoring parity with Actionspaths:, previous-path (rename) listing matching, empty-listing and vacuous-group behavior, and every configuration error (negation,?/+, pattern before header, indented header-shaped lines, invalid/duplicate group names, no groups) including that config errors fail even on the run-everything fallback path. Wired into theselector-contractlane.node --test .github/scripts/*.test.cjsgreen locally (one slice anchor inselect-runner.test.cjsnewline-anchored so job-level lookups no longer collide with same-named filter groups).actionlintandzizmorclean on the changed workflow and action;shellcheckandshfmtclean on the new scripts (change-detectionadded to the shfmt lane's paths)..github/**, so every gated lane must run (nothing may skip), andci-statusmust aggregatechangesas success.Related
Fixes #244. Related: #243 (org-wide CI/CD conventions audit), #245 (self-hosted runner performance, explicitly out of scope here), #242 (claude-code-action fleet audit).
🤖 Generated with Claude Code
https://claude.ai/code/session_01RhS3T7ShwJgKTrvk2Mvd3C