From a10099ad4732647b87bc199b11ce6c7ec6cbf168 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 20:33:11 +0000 Subject: [PATCH 1/4] ci(gate): add the CI/gate caller, pinned to the suite at a0760ce The Branch-Floor ruleset requires the commit status CI/gate, but no workflow produced it. Add the thin caller from the suite template, with __CICD_SUITE_SHA__ replaced by a0760cea695a815a96b3944f3d03ee015da856d0. The caller is not added to actions.lock (de-onboarded, per the template). The pin is a placeholder: the echidnabot profile is not on suite main yet, so the gate fails closed until it lands and the caller is re-pinned. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01J4QvDhdhimKRSwCUoJyoKC --- .github/workflows/ci-gate.yml | 92 +++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/ci-gate.yml diff --git a/.github/workflows/ci-gate.yml b/.github/workflows/ci-gate.yml new file mode 100644 index 0000000..3accc5a --- /dev/null +++ b/.github/workflows/ci-gate.yml @@ -0,0 +1,92 @@ +# SPDX-License-Identifier: MPL-2.0 +# CI gate — thin caller of the estate's interim gate, which lives in +# hyperpolymath/proven-cicd-and-workflows as a reusable workflow. Do not copy +# its jobs in here: a copy freezes at one cicd-suite commit and never receives +# a fix. +# +# It emits the commit status `CI/gate`, which the Branch-Floor ruleset +# requires. It is a COMMIT STATUS, not a check run, because a job inside a +# reusable workflow gets the check-run name ` / ` +# (see rust-ci-caller.yml: `rust-ci / Cargo test`), which always contains +# " / " and can never equal `CI/gate`. +# +# It triggers on workflow_run, schedule and workflow_dispatch, all of which GitHub runs from the +# DEFAULT branch: a pull request cannot alter this file, its pin or its list. The consequence: +# the pull request that adds this caller can never receive `CI/gate` itself, and +# would be merged past the gate once (owner action) without the gate-pr job at the end. There is no +# pull_request start here except the gate-pr job at the end (docs/CI-GATE.adoc, "The pull_request start"), +# whose shape tests/ci-gate.sh asserts. +# +# `schedule` and `workflow_dispatch` run a SWEEP: the reusable lists the open pull requests and the +# default branch head and re-evaluates each distinct head SHA with the same guarded publisher. A stale state +# then normally lasts until the next sweep. It is still last-writer-wins, a sweep is itself an evaluator, +# and GitHub may delay or skip scheduled runs (docs/CI-GATE.adoc, "Residual limit"). The cron below runs at minutes +# 7, 22, 37 and 52 of every hour; keep the minutes off :00 and :30, where scheduled load is highest. +# The sweep reads open pull requests, so the caller must grant `pull-requests: read`. +# +# It also fires when a workflow run STARTS (`in_progress`, which GitHub also sends for a rerun): +# any active run makes the verdict pending, so a rerun replaces a stale success with pending, +# approximating a native required check. `completed` then re-evaluates it (last-writer-wins; see docs/CI-GATE.adoc, "Residual limit"). +# +# The required-check list is NOT in this repository: it lives in +# proven-cicd-and-workflows/profiles/ci-gate//.json at the pinned +# SHA below, selected by github.repository. A repository with no profile there +# fails the gate closed until one is added to the suite. +# +# The job id MUST stay `gate`. The pin is a full SHA, never `@main` or a tag: +# the account enforces sha_pinning_required. An A3 `estate-gate` replaces this +# interim gate by changing ONE pin and ONE context (`with: context`) here. +# +# ⚠ DE-ONBOARDED from actions.lock, deliberately, like the estate-audit and +# Rust CI callers: an onboarded cross-repo reusable startup-fails with zero +# jobs under sha_pinning_required. cicd-suite/scripts/deonboard-workflow.sh +# reverses a re-onboarding. +# +# There is deliberately NO `concurrency:` block here: serialising per SHA would delay the +# in_progress caller behind a running evaluation that then writes a stale success. The reusable's +# own job cancels a running evaluation of the same SHA instead, and re-reads the runs just before it +# writes (scripts/ci-gate-publish.sh; tests/ci-gate.sh asserts the template has no concurrency). +# +# API budget: "**" starts the gate for every workflow. If the profile's required checks come from a +# few workflows, naming them (workflows: ["CI", "Lint"]) cuts the events; keep that list in step with +# the profile (docs/CI-GATE.adoc, "API budget"). +# +# No `secrets:` line: the reusable consumes none. +name: CI gate + +on: + pull_request: + workflow_run: + workflows: ["**", "!CI gate"] + types: [completed, in_progress] + schedule: + - cron: "7,22,37,52 * * * *" + workflow_dispatch: {} + +permissions: + statuses: write + actions: read + contents: read + pull-requests: read + +jobs: + gate: + if: github.event_name != 'pull_request' && (github.event_name != 'workflow_run' || github.event.workflow_run.name != 'CI gate') + uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@a0760cea695a815a96b3944f3d03ee015da856d0 # cicd-suite ci-gate + with: + context: "CI/gate" + # timeout_minutes: 180 # how long a missing check keeps the gate pending + + # The pull_request start. workflow_run, schedule and workflow_dispatch run only from the default + # branch, so without this job the pull request that adds or changes the gate never gets the status + # and a ruleset requiring it blocks that very pull request. This job runs from the pull request's own + # branch and posts the same verdict, waiting (bounded) for the checks named in the profile to report. + # Same-repository branches only: a fork's or Dependabot's pull_request token cannot write statuses, + # and those are covered by the workflow_run job. No trust decision uses github.actor. + # Because a pull request can edit this file, the Gate tamper guard (ci-gate-tamper-guard.yml, run from + # the default branch) fails a pull request that touches gate files unless the owner has approved it. + gate-pr: + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@a0760cea695a815a96b3944f3d03ee015da856d0 # cicd-suite ci-gate + with: + context: "CI/gate" From 91e3d330d00fe0eb1749a5b3f5ada7391029ecb2 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 22:18:41 +0000 Subject: [PATCH 2/4] ci(gate): re-pin the CI/gate caller to suite d28d73e, which carries the echidnabot profile Suite main d28d73ef10c623b507e98ffddb040268e29b5443 (suite #165) has profiles/ci-gate/hyperpolymath/echidnabot.json, so the gate can now find the profile. Both reusable refs move from the placeholder a0760ce. Nothing else changes; actions.lock is untouched. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01J4QvDhdhimKRSwCUoJyoKC --- .github/workflows/ci-gate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-gate.yml b/.github/workflows/ci-gate.yml index 3accc5a..53bea7a 100644 --- a/.github/workflows/ci-gate.yml +++ b/.github/workflows/ci-gate.yml @@ -72,7 +72,7 @@ permissions: jobs: gate: if: github.event_name != 'pull_request' && (github.event_name != 'workflow_run' || github.event.workflow_run.name != 'CI gate') - uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@a0760cea695a815a96b3944f3d03ee015da856d0 # cicd-suite ci-gate + uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@d28d73ef10c623b507e98ffddb040268e29b5443 # cicd-suite ci-gate with: context: "CI/gate" # timeout_minutes: 180 # how long a missing check keeps the gate pending @@ -87,6 +87,6 @@ jobs: # the default branch) fails a pull request that touches gate files unless the owner has approved it. gate-pr: if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository - uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@a0760cea695a815a96b3944f3d03ee015da856d0 # cicd-suite ci-gate + uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@d28d73ef10c623b507e98ffddb040268e29b5443 # cicd-suite ci-gate with: context: "CI/gate" From 472e416270293b7cc8be1721c5f437e1ce24d64b Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 10:20:27 +0000 Subject: [PATCH 3/4] ci(gate): document required code owner review and run OpenSSF checks on PRs to all branches --- .github/workflows/ci-gate.yml | 4 +-- .github/workflows/openssf-compliance.yml | 1 - docs/CI-GATE-REVIEW.md | 40 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 docs/CI-GATE-REVIEW.md diff --git a/.github/workflows/ci-gate.yml b/.github/workflows/ci-gate.yml index 53bea7a..9385149 100644 --- a/.github/workflows/ci-gate.yml +++ b/.github/workflows/ci-gate.yml @@ -83,8 +83,8 @@ jobs: # branch and posts the same verdict, waiting (bounded) for the checks named in the profile to report. # Same-repository branches only: a fork's or Dependabot's pull_request token cannot write statuses, # and those are covered by the workflow_run job. No trust decision uses github.actor. - # Because a pull request can edit this file, the Gate tamper guard (ci-gate-tamper-guard.yml, run from - # the default branch) fails a pull request that touches gate files unless the owner has approved it. + # Because a pull request can edit this file, merge protection must come from + # GitHub's required code owner review on the base branch. See docs/CI-GATE-REVIEW.md. gate-pr: if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@d28d73ef10c623b507e98ffddb040268e29b5443 # cicd-suite ci-gate diff --git a/.github/workflows/openssf-compliance.yml b/.github/workflows/openssf-compliance.yml index 1d901fc..2da6b1c 100644 --- a/.github/workflows/openssf-compliance.yml +++ b/.github/workflows/openssf-compliance.yml @@ -8,7 +8,6 @@ on: push: branches: [main] pull_request: - branches: [main] workflow_dispatch: permissions: contents: read diff --git a/docs/CI-GATE-REVIEW.md b/docs/CI-GATE-REVIEW.md new file mode 100644 index 0000000..3b9e071 --- /dev/null +++ b/docs/CI-GATE-REVIEW.md @@ -0,0 +1,40 @@ + + +# Require code owner review for changes to the CI gate + +`gate-pr` publishes `CI/gate` from a workflow the PR can modify. Use GitHub's +code owner review requirement as a separate merge condition. The base branch's +`.github/CODEOWNERS` covers `.github/`, including the workflows and CODEOWNERS +itself. Its wildcard also assigns an owner to the rest of the repository, so +enabling this requirement applies beyond workflow changes. + +## Enable the rule + +1. GitHub uses CODEOWNERS from the PR's base branch and does not let authors + approve their own PRs. If the sole code owner also authors PRs, first arrange + for a second trusted code owner with write access to be listed on the base + branch for the paths they will review, including `.github/` for gate changes. + The PR that adds that owner must land before strict enforcement, or its own + owner-authored changes could become unmergeable. +2. In **Settings → Rules → Rulesets → Branch-Floor**, keep enforcement **Active** + and keep the default branch target and existing required checks. Under + **Require a pull request before merging**, enable **Require review from + Code Owners** and keep **Dismiss stale pull request approvals when new commits + are pushed** enabled. Remove any bypass entries that could merge without + this review. + +## Verify merge enforcement + +- Read the [live rules for main](https://api.github.com/repos/hyperpolymath/echidnabot/rules/branches/main). + The active Branch-Floor `pull_request` rule must have + `require_code_owner_review: true` and `dismiss_stale_reviews_on_push: true`. + Check the bypass list in Settings with admin access. +- Use a PR to `main` that makes a harmless change under `.github/workflows/`. + Once all other merge conditions pass (including `CI/gate`), confirm that + GitHub's merge box specifically blocks merging pending code owner review. + Confirm a non-owner approval leaves that block in place, an eligible code + owner's approval clears it, and a new commit that changes the diff restores + it. Close the test PR without merging. A workflow result alone does not + verify enforcement. + +See [GitHub's CODEOWNERS documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners). From 79e5d4f58b59e197f4e66855575738d018f48e45 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 10:30:46 +0000 Subject: [PATCH 4/4] Revert "ci(gate): document required code owner review and run OpenSSF checks on PRs to all branches" This reverts commit 472e416270293b7cc8be1721c5f437e1ce24d64b, CodeRabbit's unsigned autofix. Owner ruling: back to the caller-only scope verified at 91e3d33. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01J4QvDhdhimKRSwCUoJyoKC --- .github/workflows/ci-gate.yml | 4 +-- .github/workflows/openssf-compliance.yml | 1 + docs/CI-GATE-REVIEW.md | 40 ------------------------ 3 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 docs/CI-GATE-REVIEW.md diff --git a/.github/workflows/ci-gate.yml b/.github/workflows/ci-gate.yml index 9385149..53bea7a 100644 --- a/.github/workflows/ci-gate.yml +++ b/.github/workflows/ci-gate.yml @@ -83,8 +83,8 @@ jobs: # branch and posts the same verdict, waiting (bounded) for the checks named in the profile to report. # Same-repository branches only: a fork's or Dependabot's pull_request token cannot write statuses, # and those are covered by the workflow_run job. No trust decision uses github.actor. - # Because a pull request can edit this file, merge protection must come from - # GitHub's required code owner review on the base branch. See docs/CI-GATE-REVIEW.md. + # Because a pull request can edit this file, the Gate tamper guard (ci-gate-tamper-guard.yml, run from + # the default branch) fails a pull request that touches gate files unless the owner has approved it. gate-pr: if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate.yml@d28d73ef10c623b507e98ffddb040268e29b5443 # cicd-suite ci-gate diff --git a/.github/workflows/openssf-compliance.yml b/.github/workflows/openssf-compliance.yml index 2da6b1c..1d901fc 100644 --- a/.github/workflows/openssf-compliance.yml +++ b/.github/workflows/openssf-compliance.yml @@ -8,6 +8,7 @@ on: push: branches: [main] pull_request: + branches: [main] workflow_dispatch: permissions: contents: read diff --git a/docs/CI-GATE-REVIEW.md b/docs/CI-GATE-REVIEW.md deleted file mode 100644 index 3b9e071..0000000 --- a/docs/CI-GATE-REVIEW.md +++ /dev/null @@ -1,40 +0,0 @@ - - -# Require code owner review for changes to the CI gate - -`gate-pr` publishes `CI/gate` from a workflow the PR can modify. Use GitHub's -code owner review requirement as a separate merge condition. The base branch's -`.github/CODEOWNERS` covers `.github/`, including the workflows and CODEOWNERS -itself. Its wildcard also assigns an owner to the rest of the repository, so -enabling this requirement applies beyond workflow changes. - -## Enable the rule - -1. GitHub uses CODEOWNERS from the PR's base branch and does not let authors - approve their own PRs. If the sole code owner also authors PRs, first arrange - for a second trusted code owner with write access to be listed on the base - branch for the paths they will review, including `.github/` for gate changes. - The PR that adds that owner must land before strict enforcement, or its own - owner-authored changes could become unmergeable. -2. In **Settings → Rules → Rulesets → Branch-Floor**, keep enforcement **Active** - and keep the default branch target and existing required checks. Under - **Require a pull request before merging**, enable **Require review from - Code Owners** and keep **Dismiss stale pull request approvals when new commits - are pushed** enabled. Remove any bypass entries that could merge without - this review. - -## Verify merge enforcement - -- Read the [live rules for main](https://api.github.com/repos/hyperpolymath/echidnabot/rules/branches/main). - The active Branch-Floor `pull_request` rule must have - `require_code_owner_review: true` and `dismiss_stale_reviews_on_push: true`. - Check the bypass list in Settings with admin access. -- Use a PR to `main` that makes a harmless change under `.github/workflows/`. - Once all other merge conditions pass (including `CI/gate`), confirm that - GitHub's merge box specifically blocks merging pending code owner review. - Confirm a non-owner approval leaves that block in place, an eligible code - owner's approval clears it, and a new commit that changes the diff restores - it. Close the test PR without merging. A workflow result alone does not - verify enforcement. - -See [GitHub's CODEOWNERS documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners).