This document specifies the verification architecture for the-valley: check classifications,
content-addressed tree digests, canonical statement serialization, and cryptographic note envelopes.
Instead of relying on slow, synchronous CI gates on remote servers, the-valley uses signed
attestations with asynchronous re-verification. Contributors run checks in hermetic local
sandboxes and sign cryptographic statements attesting to the results.
A single generic "tests passed" badge is inadequate for robust verification. The system explicitly distinguishes between two types of checks:
nix build, nix flake check, unit tests, linters, type checks, and VM integration
tests with mocked networks.valley-tree-v1) #Attestations bind to git tree objects rather than commit hashes. Because the tree digest depends solely on the directory contents—and not on author names, timestamps, or parent commit hashes—an attestation remains valid even if a commit is rebased, provided the resulting file tree is identical.
To compute the valley-tree-v1 digest of a repository tree:
Traverse every file entry in the tree (blobs and symlinks).
For each entry, format a line containing:
<mode> <sha256-of-content> <path-byte-length> <path>
<mode>: Standard git mode (100644 for regular files, 100755 for executables, 120000 for
symlinks). For symlinks, the content is the target path.<sha256-of-content>: Lowercase hex SHA-256 hash of the file contents.<path-byte-length>: Length of the relative path in bytes (decimal). Including the path length
prevents newline-injection attacks where a maliciously crafted filename could inject fraudulent
manifest lines.<path>: Relative path from repository root.Sort all lines in ascending lexicographical byte order.
Prepend the header valley-tree-v1\n.
Compute the lowercase hex SHA-256 hash over the combined bytes.
Submodules are disallowed in verified trees because their contents point to external repositories outside the tree's deterministic boundary.
Digital signatures cover exact byte sequences. To guarantee that independent implementations produce identical signatures for identical data, statements follow a strict line-based format.
the-valley/attestation/v1
subject.primary valley-tree-v1
subject.digest.git-sha1 99b5f2f7...
subject.digest.valley-tree-v1 73847e0b...
predicateType the-valley/check/pure/v1
predicate.check.name prose-format
predicate.check.runner nix
predicate.check.attribute prose-format
predicate.result passed
predicate.inputs.valley-inputs-v1 8df8c199...
predicate.derivation.sha256 ef69ed0c...
predicate.output.valley-tree-v1 cf1f5a9c...
provenance.harness klaus
provenance.model claude-sonnet-4-5
provenance.delegation.0.principal human:operator
provenance.delegation.0.grant land-changes
the-valley/attestation/v1).subject fields, followed by
predicateType, predicate attributes, and provenance..0,
.1, .2). Empty objects and empty arrays are omitted.Attestations use the signed note envelope format specified by Go's golang.org/x/mod/sumdb/note:
the-valley/attestation/v1
subject.primary valley-tree-v1
...
— laddie.gunk.dev/attestations sEDvC7HO4DfL5ZxbZPFvoVWq2Wt5eGTqZx2h...
— witness.gunk.dev/attestations lDb9C3YrmxnO0/YWsmWjiu2kteNvGqfQstCy...
—, Unicode U+2014), a space, the signer's identity
string, a space, and a base64-encoded payload (a 4-byte key hash prefix followed by the raw
Ed25519 signature).Signer identities use the format: <hostname>/<purpose> (e.g., laddie.gunk.dev/attestations).
Verifiers validate signatures against a known key list:
laddie.gunk.dev/attestations+1f9c40b2+AbUmzL2tCH0nR9...
The attest CLI helper (nix run .#attest) automates statement generation and verification:
attest run: Computes the current tree digest, runs repository checks in an isolated export,
generates statements, signs them, and stores them under
refs/the-valley/attestations/<tree-digest>/<signer-key-hash>.attest verify: Reads a signed note, verifies statement formatting against the CUE schema, checks
Ed25519 signatures against known public keys, and confirms that the repository tree matches the
attested digest.attest inputs: Evaluates and outputs the input-closure digest for pure checks without running
full builds, enabling the integrator to quickly test for staleness.attest render & attest sign: Helper commands for low-level statement formatting and note
signing.The verification architecture combines multiple layers of security:
| Mechanism | Protection Provided | Residual Risk |
|---|---|---|
| Ed25519 Signing Keys | Verifies that a trusted host or agent produced the attestation. | Host compromise allows forged claims. |
| Hermetic Nix Sandboxes | Prevents tests from capturing undeclared local state or network dependencies. | Local root can bypass sandbox, but leaves evidence. |
| Re-Derivation Audits | Pure checks encode all input hashes; verifiers can re-run and confirm identical outputs. | Not applicable to effectful checks. |
| Witness Sampling | Background nodes sample and re-verify pure attestations, maintaining trust scores. | Small window before divergence is detected. |
| Transparency Log (Tessera) | Attestations are appended to an immutable append-only log with inclusion proofs. | Provides tamper-evident non-repudiation, not semantic correctness. |
Combined, these mechanisms ensure that dishonest attestations are immediately detectable and result in automatic revocation of the offending signer's credentials.