Skip to content
Closed
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
45 changes: 45 additions & 0 deletions .github/workflows/advisory-andon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: advisory-andon
# PMAT-5792: an advisory already on main is an andon and a P0 issue within 4h; it never blocks a PR.
# Scheduled and push-to-main only -- never a PR or merge_group job (C324: no third state on that path).
on:
schedule:
- cron: '17 */2 * * *'
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
issues: write
concurrency:
group: advisory-andon
cancel-in-progress: false
jobs:
andon:
runs-on: [self-hosted, Linux, X64, clean-room]
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Install cargo-deny (if absent)
env:
CARGO_INSTALL_ROOT: ${{ runner.temp }}/cargo-deny
run: |
if ! command -v cargo-deny > /dev/null 2>&1; then
cargo install cargo-deny --locked
echo "$CARGO_INSTALL_ROOT/bin" >> "$GITHUB_PATH"
export PATH="$CARGO_INSTALL_ROOT/bin:$PATH"
fi
cargo deny --version
- name: Scan main and open or age the P0 issues
env:
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ github.token }}
run: |
export GIT_TERMINAL_PROMPT=0 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.https://github.com/.extraheader
GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_VALUE_0
bash scripts/ci/advisory_andon.sh --self-test
bash scripts/ci/rearm_ready.sh --self-test
out="${RUNNER_TEMP:?}/andon.ndjson"
rc=0
cargo deny --locked --all-features --format json check advisories >/dev/null 2>"$out" || rc=$?
bash scripts/ci/advisory_andon.sh emit "$out" "$rc"
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ jobs:
contents: read
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Pin origin/main to this run's build base (PMAT-5792)
env:
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
MG_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: bash scripts/ci/pin_build_base.sh
- name: Install cargo-deny (if absent)
env:
CARGO_INSTALL_ROOT: ${{ runner.temp }}/cargo-deny
Expand All @@ -333,11 +340,31 @@ jobs:
- name: Advisories must pass, with deny.toml exemptions honoured
env:
GITHUB_TOKEN: ${{ github.token }}
MG_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: |
export GIT_TERMINAL_PROMPT=0 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.https://github.com/.extraheader
GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_VALUE_0
cargo deny check advisories
# The gate runs from the BASE ref, never the PR tree (PMAT-5792): a PR cannot edit its own judge.
# Bootstrap only: the merge that introduces the scripts has no base copy, so it uses its own.
S="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/advgate-scripts-$$"
if git cat-file -e refs/remotes/origin/main:scripts/ci/advisory_gate.sh 2>/dev/null; then
mkdir -p "$S"
git archive refs/remotes/origin/main scripts/ci | tar -x -C "$S"
G="$S/scripts/ci"
else
G=scripts/ci
fi
# One command per line under -e: the first non-zero exit ends the step with that status (no && chain, no saved rc).
trap 'rm -rf -- "${S:?}"' EXIT
set -e
bash "$G/advisory_diff.sh" --self-test
bash scripts/ci/check_sov_advisories_off.sh --self-test
bash scripts/ci/check_sov_advisories_off.sh
bash scripts/ci/advisory_gate_selftest.sh "$G/advisory_gate.sh"
bash scripts/ci/advisory_step_selftest.sh
bash scripts/ci/rearm_ready.sh --self-test
bash "$G/advisory_gate.sh"
- name: Every deny.toml exemption must still be live
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/rearm-ready.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: rearm-ready
# PMAT-5792 (ADG-INV-005): after main moves or on a timer, re-arm ready PRs whose head is the one that was approved.
# Never a PR or merge_group job. A PR whose head moved after approval is left alone (needs a fresh review).
on:
schedule:
- cron: '41 * * * *'
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
concurrency:
group: rearm-ready
cancel-in-progress: false
jobs:
rearm:
runs-on: [self-hosted, Linux, X64, clean-room]
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Self-test, then re-arm approved un-armed PRs
env:
GH_TOKEN: ${{ github.token }}
REARM_REVIEWERS: ${{ vars.REARM_REVIEWERS }}
run: |
set -euo pipefail
bash scripts/ci/rearm_ready.sh --self-test
bash scripts/ci/rearm_ready.sh run
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ publishing — all backed by YAML provable contracts that fail CI on drift.
| Metric | Count | Source of truth |
|-------:|------:|---|
| Workspace crates | **81** workspace crates | `cargo metadata --no-deps` (NOT `ls crates/` — 4 are `exclude`d, 1 has no Cargo.toml) |
| Provable contracts | **<!-- CONTRACT_COUNT_START -->1996<!-- CONTRACT_COUNT_END -->** provable contracts | `contracts/census.json` `.n_files` — the set `pv lint` walks (`pv census`, ONT-001 ONT-1; regenerated by `make contracts`, written by `make readme-sync`, guarded by `scripts/check_readme_claims.sh`) |
| Provable contracts | **<!-- CONTRACT_COUNT_START -->1997<!-- CONTRACT_COUNT_END -->** provable contracts | `contracts/census.json` `.n_files` — the set `pv lint` walks (`pv census`, ONT-001 ONT-1; regenerated by `make contracts`, written by `make readme-sync`, guarded by `scripts/check_readme_claims.sh`) |
| CLI commands | **113** CLI commands | `contracts/apr-cli-commands-v1.yaml` §`commands` (parse the list; `apr --help` also lists `help` itself, and `grep -c '^ - name:'` gives 119 — other same-indent `name:` keys exist in the file) |
| Book CLI chapters | **114** chapters | `ls book/src/cli/*.md` |
| Book lib chapters | **73** chapters | `ls book/src/lib/*.md` (parity with `pub mod`) |
Expand Down Expand Up @@ -403,7 +403,7 @@ falsification_tests:
prediction: apr validate bad-model.apr exits non-zero
```

The tree carries <!-- CONTRACT_COUNT_START -->1996<!-- CONTRACT_COUNT_END --> contracts across inference, training, quantization, attention, FFN,
The tree carries <!-- CONTRACT_COUNT_START -->1997<!-- CONTRACT_COUNT_END --> contracts across inference, training, quantization, attention, FFN,
tokenization, model formats, CLI safety — and this README itself.

## Migration from old crates
Expand Down
31 changes: 27 additions & 4 deletions ci/sections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
# The old `ci:` job, verbatim: `uses:` is the pin ci/vendor/sovereign-ci.yml was
# copied from (scripts/check_ci_reusable_workflow_pinned.sh checks both agree).
sovereign-ci:
uses: paiml/.github/.github/workflows/sovereign-ci.yml@f713290c86fcd70d6f26a0faab14e67e6713586f
uses: paiml/.github/.github/workflows/sovereign-ci.yml@9078879912d106237a38137dee06be6ac6c04ac7
with:
repo: ${{ github.event.repository.name }}
enable_sccache: true
use_nextest: true
coverage_on: 'tag'
# PMAT-5792: the guard-cargo diff gate is the scanner of record (check_sov_advisories_off.sh)
advisories_diff_only: true

# A matrix job becomes one section per pinned combination. workspace-test-shard
# runs as TWELVE shards (ONE count: the `shards:` pins below; ci.yml's matrix lists must match, check_shard_count_single_source.sh), each its own ci.yml job on its own runner: as one shard
Expand Down Expand Up @@ -1901,6 +1903,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ github.token }}
MG_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: bash scripts/ci_guards.sh guard-cargo

guard-cargo-steps:
Expand Down Expand Up @@ -2034,7 +2037,7 @@ jobs:
# `ci / security` from the reusable workflow runs `cargo audit`, which does
# NOT read deny.toml -- so this covers licences, bans and sources, which
# nothing else does.
- name: cargo-deny (licences, bans, sources, advisories)
- name: cargo-deny (licences, bans, sources)
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
Expand All @@ -2054,7 +2057,7 @@ jobs:
-e GIT_CONFIG_KEY_0=http.https://github.com/.extraheader \
-e "GIT_CONFIG_VALUE_0=AUTHORIZATION: basic $B64" \
"$IMAGE" \
cargo deny check
cargo deny check licenses bans sources
# check_apr_bin_pinned asserts CALLERS pin the binary; it says nothing
# about which binary the resolver hands them. apr_bin.sh returned
# target/release/apr whenever it existed, so a stale release build beside
Expand Down Expand Up @@ -2691,7 +2694,27 @@ jobs:
export GIT_TERMINAL_PROMPT=0 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.https://github.com/.extraheader
GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 | tr -d '\n')"
export GIT_CONFIG_VALUE_0
cargo deny check advisories
# MG_BASE_SHA comes from the process env of the outer guard-cargo step (the manifest runner resolves no merge_group context).
# The gate runs from the BASE ref, never the PR tree (PMAT-5792): a PR cannot edit its own judge.
# Bootstrap only: the merge that introduces the scripts has no base copy, so it uses its own.
S="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/advgate-scripts-$$"
if git cat-file -e refs/remotes/origin/main:scripts/ci/advisory_gate.sh 2>/dev/null; then
mkdir -p "$S"
git archive refs/remotes/origin/main scripts/ci | tar -x -C "$S"
G="$S/scripts/ci"
else
G=scripts/ci
fi
# One command per line under -e: the first non-zero exit ends the step with that status (no && chain, no saved rc).
trap 'rm -rf -- "${S:?}"' EXIT
set -e
bash "$G/advisory_diff.sh" --self-test
bash scripts/ci/check_sov_advisories_off.sh --self-test
bash scripts/ci/check_sov_advisories_off.sh
bash scripts/ci/advisory_gate_selftest.sh "$G/advisory_gate.sh"
bash scripts/ci/advisory_step_selftest.sh
bash scripts/ci/rearm_ready.sh --self-test
bash "$G/advisory_gate.sh"
# Separate from the check above on purpose: a newly-FIXED upstream must
# never fail anyone's build. It fails only this guard, whose remedy is
# deleting a line.
Expand Down
Loading
Loading