| 1 | --- |
| 2 | type: idea |
| 3 | id: ida-93e4f91 |
| 4 | status: adopted |
| 5 | title: "Changes, not branches: the integration primitive is a change, not a ref" |
| 6 | created: 2026-07-14 |
| 7 | source: owner brainstorm during the S1 week |
| 8 | --- |
| 9 | |
| 10 | # Changes, not branches |
| 11 | |
| 12 | **Thesis.** What matters about a pending branch is the *diff targeting a particular version stream* — the branch is transport, not substance. A change is (target stream, delta, provenance, attestation over the resulting tree). Every branch in the S1 pending queue was created, reviewed as a diff, integrated, deleted: single-use packaging around the object that was actually under review. The integration primitive should be a change object, not a ref. |
| 13 | |
| 14 | **Demand signal.** The S1 week's staleness pain. A branch bakes its base into its identity, so every integration invalidated the rest of the queue — `valley review` grew a [b]ase verb (rebase onto main in a throwaway worktree) within a day of going sovereign. The queue's members were never "branches to merge"; they were diffs targeting main whose packaging kept expiring. |
| 15 | |
| 16 | **Staleness reframed, not eliminated.** A patch that applies cleanly to a moved stream yields a tree *nobody tested*. The architecture already answers this: attestations bind to trees, so reapplication on a new base demands re-verification. That is "staleness as the unified failure mode" and witness re-derivation — patch-shaped all along. The change model doesn't dodge the failure mode; it names it precisely. |
| 17 | |
| 18 | **Commutation.** Non-overlapping changes can land in any order (Darcs/Pijul patch theory). The pending queue stops being a race for the base and becomes a **partial order** — structurally rhyming with the outcome DAG ([[ida-eac723e]], [ida-eac723e-outcome-dag.md](./ida-eac723e-outcome-dag.md)). Changes are to code what outcome nodes are to intent: units with dependencies, not positions in a line. |
| 19 | |
| 20 | **Stable identity.** A change's identity is its intent + content, not its base. Prior art to study, all three: jj's change-ids surviving rebase (hardest study — git-compatible underneath), Gerrit's change/patchset model, the kernel's `format-patch` flow. |
| 21 | |
| 22 | ## Consequences by phase |
| 23 | |
| 24 | - **Phase 3 (integrator).** The integrator accepts changes targeting streams. Candidate encoding: `refs/the-valley/changes/*`, iterations reviewed via `git range-diff`; [contribute.md](../../design/contribute.md)'s integration-request ref is already nine-tenths of a change object. |
| 25 | - **Phase 2 (attestations).** Attestations bind (base, delta, tree) explicitly — the re-verification demand above falls out of the schema instead of being policy. |
| 26 | - **Phase 4 (dispatch).** Dispatch becomes symmetric: an agent consumes an outcome node and emits a change. klaus's budget-pause persistence gap (patflynn/klaus#282; the gap row in [[ida-594df79]], [ida-594df79-klaus-s3-requirements-oracle.md](./ida-594df79-klaus-s3-requirements-oracle.md)) is trivially a stored change object. |
| 27 | |
| 28 | ## Open design questions |
| 29 | |
| 30 | Unanswered on purpose: |
| 31 | |
| 32 | - The identity function of a change — what is hashed, over what, to survive rebase. |
| 33 | - The iteration/patchset model — what "a new version of the same change" is. |
| 34 | - Conflict semantics — what imposes order between overlapping changes. |
| 35 | - Signature/attribution binding across re-application — whose signature covers the rebased tree. |