gunk-dev/the-valley

contribute.md

source338bf6ca3fe9main's published tip history
6.6 KiB · Rendered
1# Contributor protocol
2
3Defines exactly what a contributor (human or agent) does to push a change and request its integration into a protected ref.
4
5This is the *protocol* that the trust model ([verification](./verification.md)) and the integrator ([integration](./integration.md)) both consume. It is intentionally tight; mechanisms for the integrator's queue, conflict resolution, and issue tracking are out of scope and have their own placeholder documents.
6
7## Goal
8
9A push that is:
10
111. **Cryptographically attributable** to the contributor.
122. **Accompanied by a signed promise** that the repo's canonical check set passed locally in a hermetic environment.
133. **Externally tamper-evident** via inclusion in a transparency log.
144. **Explicitly marked** as ready for integration into a target branch.
15
16These four properties are produced by one atomic `git push`, with no `git` wrapper command. The contributor uses native git verbs and one helper for attestation composition.
17
18## Steps
19
20### 1. Commit, signed natively
21
22The contributor commits as normal. The commit is SSH-signed using modern git's native commit signing — `git config gpg.format ssh` and a `commit.gpgsign = true` setting. No GPG. The signature establishes *who made this commit*.
23
24### 2. Run the canonical check set, locally and hermetically
25
26The repo's `flake.nix` declares a set of derivations as the canonical checks — `checks.<system>.unit`, `.lint`, `.integration`, whatever the repo wants. Each runs in the Nix sandbox; effectful checks are wrapped as `nixosTest` VMs so they are pure derivations from the outside.
27
28The contributor runs them via a single helper (e.g. `nix run .#attest`). All must succeed. If any fails, the helper exits non-zero and nothing is published.
29
30### 3. Compose the attestation
31
32The helper assembles a structured claim about what ran:
33
34```json
35{
36 "subject_commit": "<commit-sha>",
37 "issued_at": "<rfc3339>",
38 "checks": [
39 {
40 "kind": "pure",
41 "tool": "sha256:<attestation-tool-derivation>",
42 "inputs": ["sha256:..."],
43 "derivation": "sha256:...",
44 "output": "sha256:...",
45 "result": "success"
46 },
47 ...
48 ]
49}
50```
51
52The attestation makes no claim about *intent to integrate*. That is signaled by the ref namespace in step 6.
53
54### 4. Sign and publish to a transparency log
55
56The helper signs the attestation with the contributor's SSH key (same key as the commit signature). The signed attestation is submitted to a Tessera-backed transparency log; the log returns an inclusion proof. The proof is appended to the signed attestation as a sidecar field.
57
58The tlog gives the system *non-repudiation and external auditability*: anyone can verify the attestation was logged, when, with what content, and that the log itself is internally consistent. This is independent of and complementary to re-derivation witnessing (see [verification](./verification.md)) — the tlog proves *the attestation exists and is unchanged*; re-derivation proves *the computation it describes actually produces the claimed result*.
59
60### 5. Store the attestation in the repo's object store
61
62The signed attestation (with inclusion proof) is added as a git blob, and a ref is created:
63
64```
65refs/the-valley/attestations/<commit-sha> → attestation blob
66```
67
68This makes the attestation distributable by standard `git fetch` and trivially lookupable by commit SHA. The naming pattern mirrors gittuf's convention without adopting gittuf as a dependency.
69
70### 6. Signal integration intent
71
72A second ref is set, pointing at the topic commit:
73
74```
75refs/the-valley/integration-requests/<request-name> → topic-commit-sha
76```
77
78Pushing to this namespace is the contributor's signal: *please integrate this commit into the target branch declared by repository policy*. Without this ref push, the topic branch is just a backup; no integrator reacts.
79
80### 7. Atomic push
81
82```
83git push --atomic origin \
84 refs/heads/topic/<name> \
85 refs/the-valley/attestations/<commit-sha> \
86 refs/the-valley/integration-requests/<request-name>
87```
88
89Either all three refs land or none do. No wrapper command — this is native git.
90
91### 8. Server-side projection
92
93The bare repo's `post-receive` hook fires once. For each updated ref, it emits a corresponding event onto the bus:
94
95- `refs/heads/*` → `ref-updated`
96- `refs/the-valley/attestations/*` → `attestation-published`, carrying the attestation blob
97- `refs/the-valley/integration-requests/*` → `integration-requested`
98
99The hook is a pure projection from git to bus. It performs no policy and no verification — those are the integrator's job.
100
101## What protects the canonical refs
102
103The bare repo enforces *one* structural invariant via a `pre-receive` hook:
104
105- Only the integrator's SSH key may write `refs/heads/<protected>`.
106- Attestation refs are create-only (no updates) to keep attestations append-only-per-commit.
107- All other namespaces — topic branches, integration requests — are wide open to anyone with push access.
108
109The complex policy lives in the integrator. The git boundary enforces only the minimum needed for the controller pattern to work.
110
111## What ties this together
112
113| Property | Source |
114| --- | --- |
115| Who made the commit | SSH commit signature |
116| Who made the attestation | SSH signature on the attestation blob (same key) |
117| What checks ran and what they produced | Attestation content (derivation hashes) |
118| External tamper evidence | Tessera tlog inclusion proof |
119| Lookup by commit | `refs/the-valley/attestations/<commit-sha>` ref |
120| Intent to integrate | `refs/the-valley/integration-requests/*` ref namespace |
121| Atomicity | `git push --atomic` |
122
123## Out of scope
124
125- **Integrator internals** — how the merge queue works, conflict resolution, agentic fallback. See [integrator-internals.md](./integrator-internals.md).
126- **Issue tracking** — how bugs, feature ideas, and tasks are recorded and worked. See [issues.md](./issues.md).
127- **Per-repo policy file** — where the trusted-signer list and the canonical-checks declaration live, and how they are themselves authenticated and updated. To be designed; likely a `refs/the-valley/policy` ref carrying a signed configuration.
128- **Multi-signature attestations** — for higher-trust paths, requiring N signers on a single attestation. Gittuf demonstrates this is tractable; not in v1.
129- **Tlog deployment** — self-hosted Tessera on the same Tailscale box vs. a shared instance. An operational choice that doesn't affect the protocol.
130
131## Open questions
132
133See [openquestions.md](./openquestions.md) — items raised here live under *Identity & trust bootstrapping*, *Storage, retention, and evolution*, and *Verification specifics*.