gunk-dev/the-valley

integrator-internals.md

source7d68f2d207ddmain's published tip history
3.5 KiB · Rendered
1# Integrator internals
2
3**Status: placeholder.** Initial framing and open questions; not yet designed in detail.
4
5This document will define how the integration automation actually performs its job once an `integration-requested` event arrives. The high-level controller pattern is established in [integration.md](./integration.md); this is the missing operational detail.
6
7## In scope
8
9- **Merge queue mechanics.** Serialization per protected ref, fairness, request ordering.
10- **Conflict detection.** When a topic doesn't fast-forward cleanly, how does the integrator notice, what does it try, and when does it give up?
11- **Agentic conflict resolution.** When auto-rebase or three-way merge fails, the integrator may dispatch an agent (klaus-shaped) to attempt a more intelligent resolution. The output is a new commit + new attestation; the contributor or the integrator on their behalf resubmits.
12- **Failure semantics.** How rejections, retries, and partial successes surface as events.
13
14## Initial framing
15
16- One **queue per protected ref** (typically `refs/heads/main` per repo). Strictly serial inside the queue; concurrent integration across different protected refs is fine.
17- For each `integration-requested` event the integrator dequeues:
18 1. Verify attestation signatures, contents, signer trust score (per [verification](./verification.md)).
19 2. Optionally wait for or fetch tlog inclusion proof and witness re-derivation confirmation, depending on the policy for this signer/path.
20 3. Try fast-forward integration into the target's current tip.
21 4. If non-FF: attempt automatic rebase. **But:** the rebased commits have different SHAs; the original attestation no longer applies. So either:
22 - Reject with `requires-rebase`; the contributor re-runs locally and re-attests. (Simpler, slower.)
23 - Or: integrator dispatches an agent to perform the rebase + re-attest in the contributor's identity context. (Faster, opens a trust question.)
24 5. If still conflicting: dispatch the conflict-resolution agent (optional, opt-in).
25 6. If all paths fail: emit `integration-failed` with structured reasoning.
26- On success: update the protected ref, emit `integration-succeeded`.
27
28## Open questions
29
30- **Rebase ownership.** Who signs the rebased commits? Possibilities:
31 - Only the original contributor can. Integrator rejects on non-FF and the contributor resubmits. (Architecturally pure.)
32 - The integrator's identity is acceptable for trivial rebases (no conflict). (Pragmatic.)
33 - A dispatched agent running under the contributor's delegated authority. (Touches agent identity.)
34- **Conflict resolution agent trust.** When an agent produces a conflict resolution, whose key signs the new commit and attestation? Inherits from [scenarios.md](./scenarios.md)'s agent identity question.
35- **Fairness.** Strict FIFO per queue is the obvious default. Are there cases where a queue should be priority-ordered (e.g., security fixes ahead of feature work)?
36- **Backpressure visibility.** Contributors should see queue depth and an estimate of when their request will be processed.
37- **Multiple integrators per protected ref.** Probably not — competing integrators racing for the same ref creates chaos. One integrator per protected ref.
38- **Recovery from a crashed integrator.** Integrator state should be derivable from the bus + git refs (the integration-request refs are durable; the bus carries the pending events). Restart should be safe.
39- **Cross-repo coordinated integration.** Two requests in two repos that must succeed together (e.g., a schema producer and consumer). Deferred to v2.