This document specifies the integration protocol: how proposed changes are evaluated and merged into protected branches.
Integration in the-valley uses optimistic concurrency control over content-addressed evidence.
The integrator runs no tests itself. Verification occurs hermetically where code is authored,
producing cryptographic attestations. At the commit point, the integrator evaluates the change's
delta against the target branch tip, validates the submitted attestations, and updates the branch
reference.
A contributor (whether human or autonomous agent) requests integration by pushing a single git reference:
refs/the-valley/integration-requests/<target>/<change> -> <commit-head>
<target> identifies the protected branch (e.g., main).<change> names the proposed change or feature branch.<commit-head> is the commit hash of the change.The git commit already contains its full history, parent tree, and merge base. Attestations are pushed alongside the request at:
refs/the-valley/attestations/<tree-digest>/<signer-key-hash>
The integrator identifies the relevant attestations by computing the content-addressed tree digest of the requested commit.
The integrator runs as a continuous reconciliation daemon over repository refs.
On each evaluation pass, the integrator:
The integrator reads ground-truth refs directly from git rather than subscribing exclusively to the event bus. Because event projections can drop messages or restart, level-triggered polling over durable git refs ensures reliable eventual consistency.
The integrator caches its last evaluation verdict at:
refs/the-valley/integration-outcomes/<target>/<change>
This memo stores the evaluated commit head, the target branch tip, and the attestation namespace digest. If none of these three inputs have changed, the integrator skips re-evaluating the request, preventing unnecessary CPU churn.
When evaluating an integration request, the integrator applies the following rules in strict sequence:
The integrator attempts a three-way merge between the target branch tip and the request commit against their common merge base.
The list of required verification checks is derived from the policy declared at the target branch tip, never from the incoming untrusted branch.
For deterministic derivations (e.g., nix flake check, unit tests, linters):
attest inputs) over the potential merged
tree.For non-deterministic checks (e.g., live network tests, benchmarks, external integration suites), the evidence transfers only if:
If all required checks remain valid on the merged tree:
refs/heads/<target>).integration-succeeded event to the NATS event bus.If any required check is invalidated by intervening changes on the target branch:
request-stale event naming precisely which checks require fresh evidence.The integrator emits structured events onto the NATS JetStream event bus under:
valley.git.<repo>.integration-succeeded: Emitted when a change cleanly lands on a protected
branch.valley.git.<repo>.request-stale: Emitted when a change requires re-attestation of specific
invalid checks.Publishing is best-effort and non-blocking. The repository itself remains the sole source of truth.