Expand description
The signed successor to crate::gate_stamp: an attestation CI can trust.
gate_stamp answers a LOCAL question — “did the push gate already run on
this commit?” — and its notes deliberately never leave the machine, because
an unsigned note is only as honest as whoever can write the ref. This
module answers the REMOTE version of the same question: “may CI skip a
test job because the equivalent gate already passed here?” — and for that
the note has to travel, so it has to be signed.
§What is amont’s, and what is attest’s
The attestation FORMAT — the payload, a note’s blocks, the greensummit-inputs
spec, fingerprints, the canonical tree, the note keys, signing, the
fetch-append-push publish loop and the verifier — is attest’s, and amont
calls the greensummit library for every part of it (decisions ADR-0037).
There used to be a copy here, kept in step by hand; a fix to the format now
lands once.
What stays here is amont’s: WHEN to attest and WHICH gates a push vouches for (the dispatcher’s knowledge), its own config and key, the recursive-push guard below, every line it prints, and the provenance record amont-agent hands it (decisions ADR-0036), which it signs and publishes through the same library under its own namespace.
Every failure mode points the same direction as gate_stamp’s: no key, a
signer that errors, a note git refused, a notes push the remote rejected —
all mean “no attestation”, and no attestation means CI RUNS the tests.
Nothing here can let an untested tree skip CI; it can only cost a
redundant run.
One sharp edge is the notes push itself: git push from inside pre-push
runs pre-push again. The child carries PUSH_GUARD in its environment
and the dispatcher yields immediately when it sees it — checking a ref
list that is only ever refs/notes/greensummit would be work spent
proving nothing.
Structs§
- Covered
- What
amont attest coveredfound: the gates a valid attestation covers, and every attestation that exists for this tree but whose signature did not verify (amont#271). The two “nothing” cases, no attestation and a rejected one, are told apart byrejected.
Enums§
- Push
Failure - Why a push that exited non-zero failed, read from git’s stderr.
Constants§
- FORMAT
- First token of every payload written (see
WRITE). A verifier that does not recognise this string must treat the note as absent: an unknown version may mean anything, and “run the tests” is the only safe reading of anything. - INPUTS_
FULL_ REF - INPUTS_
REF - The second notes ref, keyed by input fingerprint rather than by object.
Every key there is a synthetic oid that is not an object, which is why it
is a separate ref:
git notes pruneon it would drop everything, and the main ref keeps its 1.x invariant that every key is real. - NAMESPACE
- The
ssh-keygen -Ynamespace. Namespaces exist so a signature minted for one purpose cannot be replayed for another; anallowed_signersentry pinned to this namespace accepts nothing else. - NOTES_
FULL_ REF - The notes ref, fully qualified —
update-ref -dneeds it. The one name set greensummit 2.0 reads and writes (ADR-0073): no other set is read. - NOTES_
REF - The notes ref, as
git notes --refwants it. - PROVENANCE_
FORMAT - PROVENANCE_
FULL_ REF - PROVENANCE_
NAMESPACE - PROVENANCE_
REF - The provenance record (decisions ADR-0036, amont
docs/provenance.md): what a push carried besides its tests, the plan and the verdicts on it. Its own ref, so CI’s attestation verifier never reads it, and its own namespace, so a provenance signature is never accepted as an attestation. The green names, which greenbelay writes and greengate signs. - PUSH_
GUARD - Environment marker carried by the notes push so the recursive pre-push invocation stands down. See the module doc.
Functions§
- attest_
push - pre-push, after every block gate has passed: attest each pushed tip and send the notes refs to the remote being pushed.
- attest_
push_ per_ tip attest_push, with the laptop’s gates asked per pushed tip:gates_for(tip)names only the gates whose run saw THAT tip’s content (#289). A gate that ran in a dirty working tree tested what was on disk, not the commit, and its pass must not be signed onto the commit’s tree.- classify_
push_ stderr - The markers behind
PushFailure. Raced wins over Unreachable: a message naming both is a race that happened on a reachable remote. A hook’s own output rides the same stream, so Unreachable is read only from the lines git and ssh themselves print. - covered
amont attest covered— the verifying side, as a one-liner for CI that is neither GitHub nor Forgejo: the gate names a VALID attestation covers for the tree checked out here, space-separated, orNone.- covered_
in coveredfor the tree checked out indir: a detached checkout of some other tree answers for that tree (amont stamps --tree). The verifier judges the tree it is pointed at and syncs the notes from origin, so a caller that can answer without it should not ask.- covered_
report covered_in, keeping the rejections. Each one is also said on stderr, whatever the caller does with it: a bad signature is the absence worth alarming about, and stdout keeps its covered-names-only contract.- default_
signers - Where the repository keeps its
allowed_signers, resolved from the repository root as attest resolves it. - enabled
- Has this repository opted in?
- forget
- uninstall: forget the local notes ref. The copies already pushed to remotes are
statements we made and stand by; only OUR bookkeeping is removed — the
same line
gate_stamp::forgetdraws. - forget_
in - The same, for a repository this process is not standing in.
- key_
move_ hint_ in - The one doctor line that names the key’s move, or
Nonewhen there is nothing to say: only the old key exists underhome. Whethergreengate.attestKeypoints elsewhere is the caller’s check. - platform
- Where a suite ran, as
<arch>-<os>. Coarser than a target triple on purpose: the libc flavour is not somethingstdcan answer, and the question a CI matrix actually asks is “did this run on MY leg”. - provenance_
push - Sign and publish the provenance record amont-agent left for each pushed
commit (ADR-0036). Opt-in, key and fail-open as
attest_push, with one difference: it does not wait for a gate to pass, because a push that changes only documentation or its plan still carries a plan and a review. - push_
guard_ active - Is the recursive-push marker set on THIS invocation?