Skip to main content

Module attest

Module attest 

Source
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 covered found: 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 by rejected.

Enums§

PushFailure
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 prune on it would drop everything, and the main ref keeps its 1.x invariant that every key is real.
NAMESPACE
The ssh-keygen -Y namespace. Namespaces exist so a signature minted for one purpose cannot be replayed for another; an allowed_signers entry pinned to this namespace accepts nothing else.
NOTES_FULL_REF
The notes ref, fully qualified — update-ref -d needs 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 --ref wants 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, or None.
covered_in
covered for the tree checked out in dir: 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::forget draws.
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 None when there is nothing to say: only the old key exists under home. Whether greengate.attestKey points 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 something std can 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?