Skip to content

ci(ci-gate): pull_request start and tamper guard (stacked on the CI/gate PR) - #112

Closed
hyperpolymath wants to merge 11 commits into
mainfrom
claude/ci-gate-pr-start
Closed

hyperpolymath wants to merge 11 commits into
mainfrom
claude/ci-gate-pr-start

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Stacked on #106 (this branch descends from that PR's head, so its content is included). It adds, on top:

  1. The pull_request start (permanent). The reusable gate can be called from a pull_request workflow as well as workflow_run; the head SHA comes from whichever fired, any other event is refused. A pull_request run evaluates once, so it polls (bounded, wait_minutes default 30) while the verdict only means "not finished" (pending, never reported, never completed) and then gives the unchanged verdict; on timeout it fails naming what is missing. Same-repo branches only; fork and Dependabot PRs stay on the workflow_run job. No trust decision uses github.actor (Sonar S8232).
  2. A tamper guard. A pull_request_target workflow (runs from the default branch, never checks out or runs PR code, pull-requests: read + contents: read, no secrets) fails a PR that touches gate files unless the owner applied the label gate-change-approved after the newest commit. Agents must never apply that label.
  3. Callers re-pinned to suite c62c31a8ac4a8cce0c0c0c6c2258f2e3bc3e9f45.

Limits, stated plainly

  • The guard is tamper-EVIDENT, not tamper-proof: all agents act with the owner's account, so the label cannot tell owner from agent; and a commit date is written by the pusher, so backdating or a force-push of older commits can defeat the label-after-newest-commit comparison. Review-based approval is impossible (the owner cannot approve their own PRs). Stronger form, proposed not built: require gate-file commits to be signed by the owner's own key once the separate agent signing key exists.
  • The guard workflow runs only from the default branch, so it does not run on the PR that introduces it, and its check is NOT yet in any profile (it would read never reported on its own introduction). List {job: "guard / check", workflow: ".github/workflows/ci-gate-tamper-guard.yml"} once it is on main and one later PR shows its run under actions/runs?head_sha=<head>. Whether a pull_request_target run's head_sha is the PR head is unverified.
  • Not done here: actions.lock is NOT regenerated: this repo has no lock-sync-fix tool and gh actions-lock is not installed.

What the owner must do once per repo

  1. Merge the PR that adds the gate (the pull_request job posts the status on it; no ruleset edit).
  2. Apply gate-change-approved to any PR that touches gate files, after its newest commit, once you have read the change.
  3. After the guard is on main, confirm guard / check appears on a later PR, then add the profile entry above.
    Newly adopting repo: add its profile to the suite, copy templates/ci-gate-caller.yml and templates/ci-gate-tamper-guard-caller.yml with the suite SHA, and open that PR from a same-repo branch.

Branches here are NEW (the existing PR branches have auto-merge on with merge method squash, while the suite PR asks for a merge commit; pushing to them could have merged them unseen). If you want these commits on the existing branches, they are fast-forwards of them.


Generated by Claude Code

claude and others added 11 commits November 17, 2026 02:44
Thin caller of the reusable ci-gate workflow in proven-cicd-and-workflows.
It runs from the default branch via workflow_run (completed and in_progress,
so a rerun flips the status to pending) and posts the commit status CI/gate,
which the Branch-Floor ruleset requires. The required-check list lives in the
suite profile at the pinned SHA, not in this repository.

The caller is onboarded in actions.lock (workflow key plus a leaf dependency
record, ref main) as the lock-sync gate requires. The pin is the placeholder
__CICD_SUITE_SHA__ until the suite SHA is known.
Rename the in-workflow job CI/gate to "Proven suite verdict" (CI/gate now belongs to the suite publisher).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
Supersedes 7a5713b: profile schema v2 (typed workflow and job entries) and
the settled rule extended to superseded runs. Updates the ci-gate.yml pin,
the actions.lock workflow key, dependency key and commit, and any test row
or text naming the old SHA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
The suite reusable now re-fetches before every status write, so per-SHA
serialisation only delayed the in_progress pending status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
Replaces the 1d657fe pin in the ci-gate.yml caller, the actions.lock
workflow key, dependency key and commit, and resource-algebra's lock
case-table row. The suite profile for this repository is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
Replaces the c77a66d pin in the ci-gate.yml caller, the actions.lock
workflow key, dependency key and commit, and resource-algebra's lock
case-table row. The suite profile for this repository is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
…e checker

The CI gate caller gains a 15-minute schedule and workflow_dispatch, which
bounds (does not eliminate) a stale CI/gate status. It needs
pull-requests: read to list open PRs.

scripts/check-required-contexts.sh learns `<context> => status:<workflow>`:
the publisher must exist, trigger on workflow_run with a completed type, call
the suite ci-gate reusable at a 40-hex pin (or the local copy) and pass
with.context equal to the context. A plain mapping keeps its semantics.
Positive and negative tests are in tests/workflows/squabble_gate_test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
…YAML

The typed `status:` mapping spawned mikefarah yq once per mapping. That
doubled the checker's run time and failed the Six-Sigma benchmark
regression gate on resource-algebra#43 (required_contexts at 2.025x
against a 2.0x limit). The checker already parses pull_request
producers with Bun.YAML.parse, so the status path now does the same,
with the same `on` -> `true` YAML 1.1 fallback, and yq is no longer
needed.

Median of 15 runs on resource-algebra: 25 ms with the yq spawn, 12 ms
now, and 12 ms for the checker on main. The checker passes on the repo
itself, and squabble_gate_test.sh passes with unchanged counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDg8YzLVHtwwDfcY3J9
…mmit that has both

actions.lock NOT regenerated: no lock-sync-fix tool in this repo and gh actions-lock is not installed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDj7XpKyxE4WbsgTsTh
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 17, 2026 17:55
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3e29744 and 2ffbef0.

Files ignored due to path filters: 1

  • .github/workflows/actions.lock is excluded by !**/*.lock
Files selected for processing: 8

  • .github/workflows/README.adoc
  • .github/workflows/ci-gate-tamper-guard.yml
  • .github/workflows/ci-gate.yml
  • .github/workflows/proven-tests.yml
  • .machine_readable/required-contexts-allow.txt
  • CHANGELOG.adoc
  • scripts/check-required-contexts.sh
  • tests/workflows/squabble_gate_test.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Owner Author

Superseded by hyperpolymath/proven-cicd-and-workflows#139, which merged as 4e9e680 and carries this work. Closing on the owner's instruction (17 Nov: close the superseded gate PRs after #139 lands). The branch is left in place.

🤖 Generated with Claude Code


Generated by Claude Code

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.

3 participants