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
44 changes: 44 additions & 0 deletions .github/workflows/advisory-andon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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
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"
35 changes: 34 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,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 @@ -335,11 +342,37 @@ 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 SCRIPTS run from the BASE ref copy (PMAT-5792); the workflow yaml and cargo config still come from the PR tree, so this is gate-content-reviewed, not self-judging-proof.
# Bootstrap only: the merge that introduces the scripts has no base copy, so it uses its own.
S="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/advgate-scripts-$$"
# merge_group: the base copy is taken only from the ref the merge queue named; a ref the PR tree re-pointed is refused, never used.
if [ -n "${MG_BASE_SHA:-}" ] && [ "$(git rev-parse -q --verify "refs/remotes/origin/main^{commit}" || true)" != "$MG_BASE_SHA" ]; then
echo "COULD-NOT-CHECK: refs/remotes/origin/main is not merge_group.base_sha $MG_BASE_SHA; the base gate is not taken from it" >&2
exit 75
fi
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
# The base gate runs FIRST: a PR-tree self-test below can write into $S, so none may run before it.
bash "$G/advisory_gate.sh"
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/advisory_positive_control.sh
- name: Every deny.toml exemption must still be live
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
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
37 changes: 33 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@dbd0488efe2463161b34b2f75002baee5e308d2a
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 @@ -1843,6 +1845,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 @@ -1976,7 +1979,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 @@ -1996,7 +1999,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 @@ -2633,7 +2636,33 @@ 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 SCRIPTS run from the BASE ref copy (PMAT-5792); the workflow yaml and cargo config still come from the PR tree, so this is gate-content-reviewed, not self-judging-proof.
# Bootstrap only: the merge that introduces the scripts has no base copy, so it uses its own.
S="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/advgate-scripts-$$"
# merge_group: the base copy is taken only from the ref the merge queue named; a ref the PR tree re-pointed is refused, never used.
if [ -n "${MG_BASE_SHA:-}" ] && [ "$(git rev-parse -q --verify "refs/remotes/origin/main^{commit}" || true)" != "$MG_BASE_SHA" ]; then
echo "COULD-NOT-CHECK: refs/remotes/origin/main is not merge_group.base_sha $MG_BASE_SHA; the base gate is not taken from it" >&2
exit 75
fi
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
# The base gate runs FIRST: a PR-tree self-test below can write into $S, so none may run before it.
bash "$G/advisory_gate.sh"
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/advisory_positive_control.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