Skip to content

ci(pr-require-checks): gate tests that cannot fail in ci-status - #9400

Merged
kyle-sexton merged 9 commits into
mainfrom
ci/9184-cant-fail-scan-step
Oct 23, 2026
Merged

kyle-sexton merged 9 commits into
mainfrom
ci/9184-cant-fail-scan-step

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Closes #9184

Summary

This is Part A of #9184: a scoped can't-fail scan in the required check. Part B (mutation testing) is split out to #9195. Automation Lanes owns pr-require-checks.yml and reviews the head of this PR.

Fix

  • scripts/check-cant-fail-scan.sh runs /testing:audit's cant-fail-scan.sh --check in one of two modes.
    • With a base, it runs --check --file on each added, copied, modified or renamed file.
      • The scanner decides what counts as a test file. When it reports adapter: none (no adapter claims the file, the adapter is off, or paths.exclude drops it), the file is skipped. Any other exit 2 fails the gate. So "not a test file" is told apart from an unreadable test file.
      • --file does not apply the whole-tree walk's directory prunes (evals/fixtures, build, vendor and others), so the script skips those paths itself. Its suite fails if this list drifts from the scanner's collect_files().
      • A diff with no test file prints Not applicable.
    • With no base, it scans the whole tree.
  • check-plugins adds a gate step cant_fail_scan through run-hygiene-gate.sh, with a cant-fail-scan row in CHECK_RESULTS. It reads lane_base.
  • A new job, check-tests, runs the whole-tree scan whenever lane_base is empty. That covers the schedule, a dispatch, and a pull request or merge group that select-tests resolves to the whole tree (no usable base, or a manifest change). With a base it returns at once.
    • It runs under the standard contract-only and draft gates and branches in the shell, as the workflow's "PR-ONLY STEPS BRANCH IN THE SHELL" rule asks. ci-status needs it, with no special skip rule.
    • The first version gated the job to schedule and dispatch and counted its skip as success. Review found that a whole-tree merge group then scanned nothing (threads on pr-require-checks.yml). A job-level if: on lane_base also fails check-docs-only-gate.sh. So the job now runs on every non-draft event and costs its setup and checkout when a base exists. It stays off the critical path.
  • Job choice (Q2), using the workflow's own rules.
    • The whole-tree scan was timed on a hosted ubuntu-24.04 runner with 4 vCPUs: 133 s and 132 s serial, and 64 s sharded four ways (1301 test files either way).
    • No existing job fits under its timeout with the scan added, and a longer timeout is not allowed. A job of its own on every pull request would not shorten the critical path. So the per-file loop (seconds) goes in check-plugins, and the whole tree goes in check-tests.
    • check-tests measures about 140 s with checkout: ceil(max(1.5 x 140, 1.1 x 140) / 60) = 4 minutes.
    • Sharding would give 3 minutes, but it needs a second fail-closed denominator (a shard with no test file exits 2), so the serial scan is kept.
  • Flagged to Automation Lanes, not fixed here: check-plugins' own schedule wall is now 136-142 s (runs 39401228774 through 39814885238). 1.5 x 142 = 213 s already exceeds its 3-minute cap without this step.
  • "Test guards" means the CI checks only (Q3).

Verification

  • bash plugins/testing/skills/audit/scripts/cant-fail-scan.sh --check on the merged head exits 0 (PASS, 1301 test files).
  • git grep -n 'cant-fail-scan.sh' -- .github/workflows/pr-require-checks.yml matches lines.
  • Local suites, all exit 0:
    • bash scripts/check-cant-fail-scan.test.sh (20 cases, among them the stay-quiet cases for no changed test file and for a clean changed test file, and check-tests' own step run with and without a diff base);
    • bash scripts/ci-ordered-skips.test.sh (13, unchanged from main);
    • bash scripts/check-affected-gates.test.sh;
    • scripts/check-docs-only-gate.sh --check;
    • scripts/check-lane-coverage.sh --check;
    • actionlint;
    • shellcheck;
    • shfmt -d.
  • Not applicable, on a PR run whose diff had no test file: run 39958912840, check-plugins: ::notice::Not applicable: no test file changed since origin/main, cant-fail-scan=success
  • Red, on a throwaway commit adding a def test_x(self): pass test: run 39959422215, check-plugins failed on rule-zero-assertion at scripts/test_cant_fail_demo.py:5, with cant-fail-scan=failure the only failed gate
  • Green, on the revert of that commit: run 39959956500, check-plugins: PASS: 3 changed test file(s) (the three changed suites, clean), cant-fail-scan=success. The first attempt's lint-repo hung 7 minutes in its checkout step and was re-run
  • Head 4519d05: run 39962565125 is green. check-tests took 12 s and printed check-plugins scans the test files changed since origin/main.
  • Timing run (a temporary job, reverted in this branch): 39902191134

Related

🤖 Generated with Claude Code

kyle-sexton and others added 5 commits October 23, 2026 00:47
A pull request or merge group scans its changed test files with
/testing:audit's cant-fail-scan.sh in check-plugins and reports the gate
not applicable when it changes none. The whole-tree scan runs in a new
check-tests job on the schedule and on dispatch, sized from hosted-runner
timing; ci-status counts its skip on a pull request or merge group as
success.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 23, 2026 13:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T13:11:32.563955Z f3fb50c 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: f3fb50c8c9

ℹ️ 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 .github/workflows/pr-require-checks.yml Resolved
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 4519d05c5d5332a70a44f3ff5229f3cc878031ce: 0 finding(s), 0 as inline comments.

Incremental review of 4519d05 (since 8f0d9f7)

No findings. I read the incremental diff and the four changed files, and used the full diff and the PR context only for background. I did not run any code or the test suites.

What changed. check-tests used to run only on the schedule and on dispatch. It now runs on every pull request and merge group. It needs: [select-tests] and carries the same contract-only and draft if: gate as the other lanes. It branches in the shell on lane_base:

  • With a base it exits 0 at once.
  • With no base it scans the whole tree.

The ci-status ordered-skip special case for check-tests is removed. The matching comments, the changelog fragment and the Not applicable notice are updated. The suite gains a case that runs the real check-tests step body.

Checked, and consistent:

  • Same condition on both jobs. check-plugins and check-tests both read needs.select-tests.outputs.lane_base (workflow line 288). Whenever check-plugins prints "no diff base; check-tests scans the whole tree", check-tests really does scan it. There is no state where neither job scans.
  • Skips match the other lanes. check-tests now skips only on a contract-only event or a draft. Those are the same two cases where the other lanes skip and ci-status already handles them (the ci-lanes status, and treat-skipped-as on a draft). Removing the check-tests special case therefore leaves no unhandled skipped on a normal run.
  • Test extraction works. The new awk extraction in scripts/check-cant-fail-scan.test.sh:143-146 matches the real step: the env: block comes before run: |, the body is indented 10 spaces, and the next step's blank line ends it. The suite fails closed if the body is not found (-s check, then bad). bash -e is fine because step captures $? outside the subshell, and the suite runs under set -uo pipefail without -e.
  • No stale reference in the tests. scripts/ci-ordered-skips.test.sh has no check-tests or EVENT reference left after the jq change.

Note, not a finding. The PR description is now out of date on two points. It says check-tests runs "on the schedule and on dispatch only", and it says the ordered-skip step turns its skipped into success on pull_request and merge_group events. Neither holds at this head. The changelog fragment and the workflow comments are already correct, so only the PR body needs editing.

Cost. Every non-draft, non-contract-only run now starts one extra ubuntu-24.04 job, which costs about its setup and checkout when there is a base. The workflow comment states this and the reason: a skip in if: would be red in ci-status. This is not a model-spend or infrastructure-as-code change, so I set no hold.

@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 f3fb50c8c9168d66fb7c768f07c7530d2ce0be89; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

Comment thread .github/workflows/pr-require-checks.yml Resolved
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4519d05c5d5332a70a44f3ff5229f3cc878031ce: 0 finding(s), 0 as inline comments.

Incremental security review of the four files changed since 8f0d9f7. I found no security issues.

  • check-tests narrowing (.github/workflows/pr-require-checks.yml). The job now runs on pull requests and merge groups, and it skips the whole-tree scan when lane_base is non-empty. The diff base is non-empty only when select-tests resolved one, and that case is exactly when check-plugins scans the changed test files. The two jobs have identical if: gates (contract-only and draft), so a base never reaches a run where the per-file scan is absent. If select-tests fails or returns no base, the output is empty and check-tests scans the whole tree, so the gate fails closed. check-tests still needs select-tests and is still in ci-status's needs.
  • ci-status skip handling. The diff removes the special check-tests skip-to-success mapping, which also drops the EVENT env var. A check-tests skip now passes through as skipped. A skip happens only on a contract-only event or a draft, the same as the other lanes, so I see no way to bypass the gate with the removed mapping.
  • Injection. DIFF_BASE reaches the shell through env:, not through ${{ }} interpolation inside run:. The new check-tests step reads only that variable.
  • New test (scripts/check-cant-fail-scan.test.sh). It extracts a run: body from the repository's own workflow file and runs it in a temp fixture. Both the input and the fixture are repository-controlled and the test runs locally, so I see no trust-boundary issue.
  • Changelog and notice strings. These are text-only changes and have no security surface.

No plugin manifests changed and no standing instructions were removed, so there are no manifest <field> lines. The diff touches no trust-gate path.

critical-findings: 0

kyle-sexton and others added 2 commits October 23, 2026 09:13
…s skip

The gate's own suite runs it against the real scanner in throwaway
repositories: not applicable, a clean changed test, a hollow one, a
deletion, pruned directories, an unreadable test and the whole tree.
ci-ordered-skips pins that check-tests' skip passes only on a pull
request or merge group. The gate joins the check-script registry and
suite-seconds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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: 1 inline finding(s) on 5764a8c9f6eff0409929af4f9cf98eab7a2b787e; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread scripts/test_cant_fail_demo.py Resolved
kyle-sexton and others added 2 commits October 23, 2026 09:17
… base

A merge group that select-tests resolves to the whole tree (a manifest
change, or no usable base) had an empty lane_base: the check-plugins gate
returned at once, and check-tests, gated to the schedule and dispatch,
skipped and was counted as success, so nothing scanned it. check-tests now
runs under the standard contract-only and draft gates and branches in the
shell: with no diff base it scans the whole tree, with one it returns at
once. The ci-status skip rule for it is gone; the suite runs the job's step
for both cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 0c37f9e Oct 23, 2026
59 checks passed
@kyle-sexton
kyle-sexton deleted the ci/9184-cant-fail-scan-step branch October 23, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: gate changed test files on the can't-fail scan in ci-status and run mutation testing post-merge only

1 participant