Skip to content
forge-ciPublic

About

Proof marks for client builds: stamp local lint/test passes into commit trailers so CI and the merge queue skip what is already proven.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

prooft

Proof marks for client builds. A gun barrel gets a proof mark once it survives a test firing. prooft does the same for commits: run your lint and tests locally, stamp the passing commit, and CI and the merge queue skip the jobs that stamp already proves.

$ prooft run lint -- soldr lint          # runs it; on success stamps HEAD
attested lint on 3f2a9c1e0b7d
$ git push                               # CI reads the stamp and skips ci.yml:lint

No server, no signing keys, no artifacts. The proof lives in the commit message as one Ci-Attestation: trailer per gate, the format defined by ci.yml GATE-010. prooft's trailers are byte-compatible with ci-lint's.

The rules

Six rules. Everything else is detail.

  1. A gate is a check on a platform: <ecosystem>/<platform>/<check>, e.g. rust/x86_64-unknown-linux-gnu/clippy. A lane is the local command that proves one or more gates.
  2. A proof is bound to what the lane read. By default that is the exact tree and parents: change one byte, or rebase, and it no longer counts (wrong-tree, wrong-parents). A lane that declares its inputs is bound to those files instead, so it survives a rebase that left them alone. Edit the JSON and the stamp breaks (bad-stamp).
  3. Omission means "not run". A gate without a trailer runs in CI. There is no way to say "skipped".
  4. A job skips only when every gate it covers is proven and fresh (default 24 h per lane), and the head is trusted.
  5. The base decides. CI reads the policy from the PR base. A PR that touches the policy, workflows or ci.toml, a fork, or a title tag ([ci-full]) runs everything remotely.
  6. Releases trust nothing. A release recomputes every gate.

Rule 2 makes forgery visible rather than impossible: a trailer is an honesty contract, not a signature. A forged pass can skip a PR job, but the push to main runs the jobs on the merged commit, so a lie turns into a visible red main, never a silent green.

The merge queue

A queue commit is brand new, so its own trailers can never match. prooft credits the PR's proofs when the queue commit is a single commit on the base and either

  • its tree is identical to the attested PR head (the queue would test the proven bytes), or
  • the lane's declared inputs are unchanged at the queue commit: main moved, but not under anything the lane reads.

Otherwise the queue runs the job. prooft's own main merges through a single-PR merge queue whose verify job runs prooft queue from the base.

The policy: ci-attestations.yml

version: 1
lanes:
  lint:
    max-age-hours: 24                # optional; 24 is the default
    inputs: ["src/**", pyproject.toml] # optional: key the proof to these files
gates:
  python/all/fmt:        {lane: lint}
  python/all/types:      {lane: lint}
  python/linux-x64/test: {lane: tests}
jobs:                                 # <workflow file>:<job id> -> gates
  ci.yml:lint:           [python/all/fmt, python/all/types]
  ci.yml:test-linux-x64: [python/linux-x64/test]

It is a restricted YAML subset (no anchors, aliases, tags or block scalars) parsed by the standard library alone, so every host reads it the same way. fidelity: emulation (Wine, Darling) may prove unit, never test.

Supported gate ecosystems are rust, python, cpp, general, data and swift. For example, data validation can declare data/all/qt-xml, and Swift formatting can declare swift/all/fmt. Like general, these use the lane command you supply to prooft run; the ecosystem does not select a tool. All ecosystems share the default native fidelity and 24-hour proof lifetime unless the policy overrides them.

The runner: prooft

Run with no subcommand, prooft is the repository's gate runner, and ./push delegates to it (exec prooft --push "$@", ci.yml GATE-014):

prooft                  lint: run every lint-stage lane; stamp HEAD when the tree is clean
prooft --test           lint, then every test-stage lane
prooft --push           lint (and --test), then git push --force-with-lease and open or reuse the PR
prooft --no-pr          with --push: push only
prooft --no-lint ...    skip lint. Discouraged: nothing is attested for lint and builds stay refused
prooft --dry-run        print the steps in order and run nothing
prooft check-build      exit 0 only when lint passed on the current working tree, else 3

A lane is runnable when it declares run:. run: soldr is soldr lint in porcelain mode, stamping each Rust gate whose step passed; anything else is an argv list (block style: run: [./lint] under the lane's own key). Its stage is lint or test; when it is not declared, a lane whose gates are all lint checks (fmt, lint, clippy, dylint, types, check, static) is a lint lane and any other is a test lane.

lanes:
  rust: {run: soldr}
  tests:
    run: [soldr, cargo, test, --workspace]

Lint always runs first. It fails in seconds on a warm cache, while tests build and run the whole project, so a lint failure stops the runner before any test starts. A lane already attested on HEAD is not rerun.

No build before lint (ci.yml GATE-017). Every lint pass is also recorded in .git/prooft/lint-passes against the working tree (the tree git add -A would commit), dirty or not. prooft check-build answers whether the bytes about to be built were linted, so a build wrapper or an agent's command scanner can refuse cargo build/cargo test with instructions to run prooft first. A dirty tree is linted but not attested: attestations stamp commits. --push refuses a dirty tree, a detached HEAD and the base branch.

Exit codes: 0 ok, 1 a lane failed, 2 usage or policy error, 3 refused.

Command line

prooft run LANE -- CMD...      run CMD on a clean HEAD; on success stamp LANE's gates
prooft verify [REV]            every gate's state on REV  (--scope NAME, --require-signed)
prooft plan --base REV         which jobs a PR run may skip  (--github-output, --json)
prooft queue --base REV --pr-head REV [--queue-head REV]
prooft lanes                   lanes and the gates each proves
prooft soldr [-- CMD]          soldr lint (porcelain) -> per-target Rust gates
prooft emit [REV] [-o FILE]    REV's valid attestations as a JSON bundle
prooft apply FILE|-            stamp HEAD with the bundle entries valid for HEAD
prooft hook install [--force]  pre-push hook: warn (shadow) or refuse (enforce) an unattested head

run refuses a dirty tree, and refuses if the command changes tracked files or moves HEAD. Re-running a lane replaces only that lane's trailers.

Shadow or enforce

Top-level mode: in the policy decides what the pre-push hook does with an unattested head. shadow (the default) warns and pushes: CI simply runs the jobs. enforce refuses the push. The strictest mode between the pushed commit and the remote tip (or the default branch, for a new branch) wins, so a branch cannot flip itself back to shadow to escape.

Rust: soldr

A runner lane whose only gate is rust/all/lint stamps that gate after its entire soldr lint command exits successfully. Configure explicit arguments with run: [soldr, lint, --check]. To stamp per-target gates, declare the individual fmt, Clippy, and Dylint gates instead.

$ prooft soldr                          # SOLDR_PORCELAIN=1 soldr lint rust --check
attested rust/all/fmt
attested rust/x86_64-unknown-linux-gnu/clippy
attested rust/x86_64-pc-windows-msvc/clippy
attested rust/x86_64-unknown-linux-gnu/dylint

soldr's one-line porcelain report lists its steps; each passed step maps to a gate (fmt -> rust/all/fmt, clippy --target T -> rust/T/clippy, bare clippy/dylint -> the host triple). Only gates the policy declares are stamped. A failing step stamps nothing for itself, so CI runs it.

Python API

import prooft

repo = prooft.open(".")
repo.lane("lint").run(["ruff", "check", "."])  # run a lane, stamp its gates
repo.soldr()  # soldr lint -> per-target Rust gates
repo.verify().ok("python/all/fmt")  # True
plan = repo.plan(base="origin/main", title="Add x")
plan.skipped  # ("ci.yml:lint",)
plan.outputs()  # {"skip_lint": "true", ...}
repo.queue(pr_head="pr", queue_head="HEAD", base="origin/main").skipped

Lower level: prooft.Attestation, prooft.Trailers, prooft.Policy, prooft.verify(commit, policy), prooft.decide(policy, verdict).

Proofs from elsewhere

A build farm that cannot amend your commit can still prove it:

farm$ prooft run tests -- ./ci.py test && prooft emit -o proof.json
you$  prooft apply proof.json            # stamps only entries valid for YOUR HEAD

apply judges the bundle exactly as if its trailers were already on HEAD: same tree and parents, or (for a lane with inputs) unchanged inputs.

Scopes: which cache domain produced the proof

A proof made in one place is otherwise accepted anywhere the lane and key match. Pass --scope NAME to prooft run to stamp a record with a scope (record v:2, scope inside the stamped body), and --scope NAME to verify, plan or queue to require it:

prooft run lint --scope ci-linux -- ./ci.py lint
prooft plan --base B --scope ci-linux --ledger .prooft/ledger
  • a record from another scope is scope-mismatch;
  • a version 1 (unscoped) record, under a required scope, is unscoped;
  • with no --scope nothing changes: unscoped records are still written as version 1, byte-compatible with ci.yml GATE-010, and scoped ones verify too;
  • ledger entries are named per scope (prooft-v2-{scope}-{lane}-{key}; a custom --ledger-name must contain {scope}), so one scope can never satisfy another's lookup.

This is a correctness guard, not a security boundary. The stamp is not a signature: whoever writes the trailer or the ledger entry writes the scope. It stops an honest mix-up (a proof from one cache or runner pool reused in another), not a forger. A scope claim becomes trustworthy only with signing (below).

Signed scoped attestations (record v3)

The public main push workflow publishes a prooft-signed-<sha> artifact after the hosted lint and test lanes pass. Each lane directory contains attestation.json (an in-toto statement) and attestation.sigstore.json (the Sigstore bundle). The scope is the GitHub repository ID, and the statement binds the exact tested commit and the lane's check set. The CI signing step uses public Sigstore and Rekor.

To verify the test lane from a downloaded artifact, supply the repository, workflow, ref, full commit SHA and checks expected by your policy. Repeat --check for each expected check.

prooft verify-signed tests/attestation.json tests/attestation.sigstore.json \
  --repository forge-ci/prooft \
  --workflow forge-ci/prooft/.github/workflows/ci.yml@refs/heads/main \
  --ref refs/heads/main --head "$EXPECTED_SHA" --check python/linux-x64/test

Install prooft[sign] to verify a Sigstore bundle. Signal's policy will govern cross-tenant reuse. Local developer passes continue to use the existing unsigned trailers.

pip install prooft[sign] adds Sigstore keyless signing. In a GitHub Actions job with permissions: id-token: write:

prooft run lint --scope acme --sign --ledger .prooft/ledger -- ./ci.py lint
prooft verify --scope acme --require-signed --scope-policy owners.json --ledger .prooft/ledger

--sign signs the lane pass once with a short-lived Fulcio certificate minted from the job's OIDC token: a DSSE envelope over an in-toto Statement v1 whose subject is the git tree (git-tree:<tree>, plus git-parent:<sha>) and whose predicate (https://forge-ci.com/prooft/attestation/v3) is the scope, lane, input key and gates. The bundle goes in the ledger as prooft-v3-{sig}.sigstore.json; each trailer becomes v:3 with "sig":"<sha256 of the bundle>".

--require-signed trusts the bundle, not the trailer. Each gate is unsigned (no sig, or no bundle), bad-signature (wrong hash, wrong CA, or a signature that does not cover the payload), scope-not-owned (the certificate's repository_owner_id / repository_id / job_workflow_ref do not own the signed scope in the scope-owner policy), subject-mismatch (another tree, lane or gate), scope-mismatch (signed for another scope than the required one) or stale (the certificate, not the record's at, is older than the lane's max-age-hours). The scope-owner policy uses numeric ids:

{"version": 1, "scopes": {"acme": {"repository_owner_id": "100", "repository_ids": ["200"],
  "job_workflow_refs": ["acme/app/.github/workflows/ci.yml@refs/heads/main"]}}}

--trust-root is sigstore (the public-good Fulcio + Rekor, the default) or a CA certificate PEM (a private Fulcio; the tests use a self-signed one). Only a signed v3 record checked under --require-signed is a security boundary. Unsigned v1/v2 local passes are unchanged and still verify without the flag.

Ledgers: hosted proofs by input key

A trailer proves a lane on one commit. A ledger proves it for an input key, wherever that key turns up again: a merge-queue entry, a rebased head, or a PR whose author never ran the lane.

prooft queue --pr-head P --queue-head Q --base B --ledger github \
    --ledger-name 'lane-proof-v1-{lane}-{key}'     # GitHub artifacts, by name
prooft plan --base B --ledger .prooft/ledger      # a directory of JSON files

The rules are the same as for trailers:

  • only lanes with inputs have a key;
  • the entry must be fresh (within the lane's max-age-hours);
  • an untrusted head (fork, title tag, trust-surface edit) skips nothing.

A GitHub artifact also counts only if it is unexpired and was uploaded by the CI workflow (.github/workflows/ci.yml by default) on a pull_request or merge_group run from a branch of this repository. Any other workflow (a claim bot, a dispatch) can upload an artifact with the same name, so it proves nothing.

A repository that keys its lanes its own way passes the keys in: --lane-key rust-test=$(uv run ci/lane_proof.py key --lane rust-test --base B). prooft then judges only trust and freshness.

Simulating GitHub

prooft.sim.github.FakeGitHub is a bare origin plus pull requests, CI runs and a merge queue, all offline. tests/test_simulation.py drives it through every rule above: unattested, partial, stale, tampered, rebased, fork, title tag, policy edit, forged pass, queue credit and queue rerun.

Development

./install      # uv sync + dev tools
./test         # pytest
./lint         # ruff format --check (black style), ruff check (isort, ...), basedpyright
./lint --fix

Status

Alpha (0.2). prooft's own PRs skip fast and test-linux-x64 when their trailers prove them. The merge queue credits every entry of a multi-PR group whose lane inputs are unchanged, and it reads hosted proofs (--ledger) under the same trust rules. The real-world case is obs-rust/obs-studio (docs/CASE-OBS-RUST.md, obs-rust/obs-studio#4460). Next: a ci-lint adapter. See docs/ROADMAP.md.

License: BSD-3-Clause.

About

Proof marks for client builds: stamp local lint/test passes into commit trailers so CI and the merge queue skip what is already proven.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages