Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,52 @@ files the contract rejects. The hooks are now thin wrappers over the same
canonical tools, run from a standards checkout (`STANDARDS_DIR`), and skip
with a notice when none is present. k9iser is retired estate-wide: contracts
are authored to `1-formats/k9/spec/K9-CONTRACT-SPEC.adoc`, never generated.

== `ci-gate.yml` publishes the `CI/gate` status (interim)

`ci-gate.yml` is a thin caller of the reusable of the same name in
hyperpolymath/proven-cicd-and-workflows. It emits the commit status `CI/gate`,
which the Branch-Floor ruleset requires. It is a commit status, not a check run,
because a reusable's check-run name is `<caller job> / <job>` and can never equal
`CI/gate`.

* It starts on `pull_request` (job `gate-pr`, same-repository branches only: a
fork's or Dependabot's token cannot write statuses) so the pull request that
adds or changes the gate gets `CI/gate` itself and waits, within a bounded
budget, for the checks the profile names. `gate-pr` runs from the pull
request's own branch, so the tamper guard below is what makes an edit to the
gate visible.
* It also runs on `workflow_run` (`completed` and `in_progress`: a rerun flips the
status to pending, so a stale success never survives), on a 15-minute
`schedule` sweep and on `workflow_dispatch`. GitHub runs those from the copy on
the default branch: a pull request cannot alter that job, its pin or its list.
The job `gate` skips the `pull_request` event. There is no `concurrency:` block,
as in the suite's template: the reusable re-reads the runs before it writes.
* The required-check list is not in this repository. It lives in
`proven-cicd-and-workflows/profiles/ci-gate/<owner>/<repo>.json` at the pinned
SHA.
* It is onboarded in `actions.lock` (workflow key plus a leaf record for the suite
reusable, `ref: main`), because the lock-sync gate requires it. An A3 `estate-gate` replaces it by changing the pin and the
context.

=== `ci-gate-tamper-guard-caller.yml`: the gate tamper guard

`ci-gate-tamper-guard-caller.yml` is a thin caller of the suite's reusable
`ci-gate-tamper-guard.yml`, pinned to the same commit as the gate. It runs on
`pull_request_target`, so GitHub uses the default-branch copy and a pull request
cannot edit the guard that judges it; it never checks out or runs pull request
code. A pull request that touches a gate file (`.github/workflows/ci-gate*.yml`,
and `scripts/check-required-contexts.sh`, among the suite's gate files) fails
`guard / check` until the owner applies the label `gate-change-approved`
after the newest commit, and only a repository admin's label counts.

* Only the owner applies `gate-change-approved`. An agent must never apply it.
It is tamper-evident, not tamper-proof; the suite's `docs/CI-GATE.adoc`,
"Tamper guard", states the limit.
* The guard has a fixed set of protected paths in the suite's script; the caller
takes no `paths` input. In this repository
`.machine_readable/required-contexts-allow.txt` (the `CI/gate => status:` mapping)
is not in that set, so a change to it is not flagged by the guard.
* It is onboarded in `actions.lock` like `ci-gate.yml` (its own workflow key, the
same leaf record for the suite). It is not yet a required context; listing
`guard / check` in the suite's profile is a later round, once the guard is on the default branch.
9 changes: 9 additions & 0 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ version: 'v0.0.3'
workflows:
'.github/workflows/build-notification.yml':
- 'actions/checkout@v7.0.1'
'.github/workflows/ci-gate-tamper-guard-caller.yml':
- 'hyperpolymath/proven-cicd-and-workflows@d2140a5a789e4ebec52f1bab0074181012660c3b'
'.github/workflows/ci-gate.yml':
- 'hyperpolymath/proven-cicd-and-workflows@d2140a5a789e4ebec52f1bab0074181012660c3b'
'.github/workflows/codeql.yml':
- 'actions/checkout@v7.0.1'
- 'github/codeql-action@9b3254085494b55a0f7c4c2b3d2d52cc712ce370'
Expand Down Expand Up @@ -194,6 +198,11 @@ dependencies:
commit: 'sha1-0f8e8c99d88aeb3fbfd523f1ef2c6f762d10d64d'
owner_id: 75048950
repo_id: 623796603
'hyperpolymath/proven-cicd-and-workflows@d2140a5a789e4ebec52f1bab0074181012660c3b':
ref: 'main'
commit: 'sha1-d2140a5a789e4ebec52f1bab0074181012660c3b'
owner_id: 6759885
repo_id: 1326697643
'hyperpolymath/smtp-notify-action@v0.5.1':
ref: 'v0.5.1'
commit: 'sha1-e384daf6167a7a7567642d6a62060106244d2413'
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/ci-gate-tamper-guard-caller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: MPL-2.0
# Gate tamper guard - thin caller of the suite's reusable guard; installed as .github/workflows/ci-gate-tamper-guard-caller.yml. pull_request_target runs this file from the
# DEFAULT branch, so a pull request cannot edit it; the job never checks out or runs pull request code
# (it reads the changed-file list through the API). The pin is a full SHA, never @main or a tag.
# A pull request that touches gate files fails this check until the OWNER applies the label
# `gate-change-approved` after the newest commit. AGENTS MUST NEVER APPLY THAT LABEL.
# No `secrets:` line, minimal permissions. See docs/CI-GATE.adoc, "Tamper guard".
name: Gate tamper guard

on:
pull_request_target:
types: [opened, reopened, synchronize, edited, labeled, unlabeled]

permissions:
pull-requests: read
contents: read

jobs:
guard:
uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/ci-gate-tamper-guard.yml@d2140a5a789e4ebec52f1bab0074181012660c3b # cicd-suite tamper guard
88 changes: 88 additions & 0 deletions .github/workflows/ci-gate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 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 `<caller job> / <called job>`
# (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/<owner>/<repo>.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.
#
# ONBOARDED in actions.lock (workflow key plus a leaf dependency record for the
# suite reusable) because this repository's lock-sync gate requires every
# job-level reusable ref to be keyed there; see the suite README, "Consumers
# with a lock-sync gate". The record's ref is the symbolic `main`, never the SHA.
#
# There is deliberately NO `concurrency:` block: serialising per SHA would delay the
# in_progress caller behind a running evaluation that then writes a stale success. Instead the
# reusable re-reads the runs just before it writes and re-evaluates when they moved
# (scripts/ci-gate-publish.sh; tests/ci-gate.sh asserts the template has no concurrency).
#
# 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@d2140a5a789e4ebec52f1bab0074181012660c3b # 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@d2140a5a789e4ebec52f1bab0074181012660c3b # cicd-suite ci-gate
with:
context: "CI/gate"
8 changes: 5 additions & 3 deletions .github/workflows/proofs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
name: Core proofs and expected rejections
runs-on: ubuntu-latest
timeout-minutes: 15
container: debian:trixie-slim

Check warning on line 32 in .github/workflows/proofs.yml

View workflow job for this annotation

GitHub Actions / Hypatia neurosymbolic scan

[hypatia] workflow .github/workflows/proofs.yml:32 pins container `debian:trixie-slim` by tag — tag is mutable; pin by sha256 digest instead
steps:
- name: Install the pinned prover
run: |
Expand Down Expand Up @@ -205,16 +205,18 @@
- name: Declared exemption is still true
run: bash scripts/check-coverage-exemption.sh

# The required status check `CI/gate` (live Branch-Floor ruleset 25434034).
# It aggregates every other job in this workflow with `needs:` and fails
# The in-workflow verdict `Proofs verdict` (NOT the required context: `CI/gate`
# of the live Branch-Floor ruleset 25434034 is a commit status published by
# ci-gate.yml, the only producer of it). It aggregates every other job in this workflow
# with `needs:` and fails
# unless ALL of them succeeded: failure, cancellation and skipping all fail,
# so it is never a rubber stamp. `if: always()` makes it run (and fail) when
# a needed job fails instead of being skipped, which a required check would
# report as passing-by-absence. tests/workflows/ci_gate_test.sh fails if a new
# job is added here without being added to `needs:`.
# Read-only permissions; the one `uses:` is the checkout already pinned in actions.lock.
gate:
name: CI/gate
name: Proofs verdict
needs: [proofs, lean-leg, rocq-leg, coverage-exemption]
if: ${{ always() }}
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .machine_readable/coverage-exemption.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: MPL-2.0
# Declared code-coverage exemption, verified by scripts/check-coverage-exemption.sh
# (job `coverage-exemption` in .github/workflows/proofs.yml, aggregated by CI/gate).
# (job `coverage-exemption` in .github/workflows/proofs.yml, aggregated by the `Proofs verdict` job).
#
# This repository is prover-only: Agda, rechecked in Rocq and Lean. It has no
# runtime code, so a line-coverage percentage is undefined, not 0%. The claim is
Expand Down
7 changes: 7 additions & 0 deletions .machine_readable/required-contexts-allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
# workflow files in `.github/workflows/` that produce them on `pull_request`.
#
# Format: <exact check context> => <.github/workflows/file.yml>
# or: <exact commit-status context> => status:<.github/workflows/file.yml>
#
# A `status:` mapping names a workflow_run publisher of a commit status (the
# estate's CI gate caller). The checker verifies that the file exists, triggers on
# workflow_run with a `completed` type, calls the suite's ci-gate reusable at a
# 40-hex pin (or the local copy) and passes `with.context` equal to the context.
#
# Verified by `scripts/check-required-contexts.sh` (3-outcome 0/1/2) so a
# renamed or path-filtered workflow can never silently strand pull requests
# behind an unsatisfiable ruleset check (issue #219 class).
scan / gitleaks => .github/workflows/secret-scanner.yml
CI/gate => status:.github/workflows/ci-gate.yml
38 changes: 38 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
== Changelog

== 2026-11-17 — `CI/gate` starts on `pull_request`; tamper guard

* `CI/gate` now also starts on `pull_request`, and a tamper guard is added.
`.github/workflows/ci-gate.yml` is rewritten from the suite's
`templates/ci-gate-caller.yml`: a same-repository `gate-pr` job on
`pull_request` posts `CI/gate` on the pull request that adds or changes the
gate, beside the existing `workflow_run`, `schedule` and `workflow_dispatch`
job `gate` (which skips `pull_request`). The new
`.github/workflows/ci-gate-tamper-guard-caller.yml` calls the suite's guard on
`pull_request_target`: a pull request that touches a gate file fails
`guard / check` until the owner applies the label `gate-change-approved`. The
guard is not a required context yet. Both callers pin
hyperpolymath/proven-cicd-and-workflows at `d2140a5a789e4ebec52f1bab0074181012660c3b`,
a provisional pin on a suite pull request branch (a placeholder until that pull request merges);
`actions.lock` is edited by hand to match (`gh actions-lock` v0.2.0 cannot lock
cross-repository reusable workflows) and `scripts/check-lock-sync.sh` is the
authority. `tests/workflows/squabble_gate_test.sh` section 5b asserts the new
triggers, the jobs and their pins, and the guard caller's shape.

== 2026-11-17 — `CI/gate` comes from the suite publisher; `Proofs verdict`

* `.github/workflows/ci-gate.yml` calls the reusable `ci-gate.yml` in
hyperpolymath/proven-cicd-and-workflows, which posts the commit status
`CI/gate` (the context the live Branch-Floor ruleset requires) from the
required-check list in that suite's `profiles/ci-gate/`. It runs on
`workflow_run` (`completed`, `in_progress`), on a 15-minute schedule and on
`workflow_dispatch`. Statuses are last-writer-wins, so a stale status can
stand until the next evaluation; the suite's `docs/CI-GATE.adoc` states the
limit.
* The `proofs.yml` job that was named `CI/gate` is renamed `Proofs verdict`
(job id, `needs:` and verdict logic unchanged). It is one of the checks the
publisher requires.
* `scripts/check-required-contexts.sh` accepts a typed mapping
`<context> => status:<workflow>`, verifying that the publisher triggers on
`workflow_run`, calls the suite reusable at a 40-hex pin and passes the
exact context. `.machine_readable/required-contexts-allow.txt` maps
`CI/gate` that way.

== 2026-11-17 — Proof receipt and grades at 47de4a8

* `verification/receipts/resource-algebra-proofs_praxis.deed` now describes
Expand Down
Loading
Loading