Keep a merge a cut made history, and build a batch's walk at the branch (hq ADR 0276 review)
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without …
mesh/repo-check pass: its merge-check.sh passed

This commit is contained in:
jochen
2026-10-10 13:48:31 +02:00
parent 2887691414
commit 0e0e143055
6 changed files with 118 additions and 10 deletions
+16
View File
@@ -64,6 +64,22 @@ func (i *Inventory) LaterMergesOf(ctx context.Context, repository, branch string
order by merged_at desc`, repository, branch, after)
}
// KeptOnBranch says the controller keeps a merge of a repository's branch, and when it heard its first merge
// of any: a merge of a branch it keeps merges of, made since then, is the record's to answer, whatever a
// module's last look says (novox/hq ADR 0276).
func (i *Inventory) KeptOnBranch(ctx context.Context, repository, branch string) (bool, time.Time, error) {
var first *time.Time
var kept bool
err := i.store.Pool().QueryRow(ctx,
`select (select min(heard_at) from batched_merge),
exists (select 1 from batched_merge where repository = lower($1) and branch = $2)`,
repository, branch).Scan(&first, &kept)
if err != nil || first == nil {
return false, time.Time{}, err
}
return kept, first.UTC(), nil
}
// AloneMerges is every merge waiting to be walked on its own commit, the newest first (ADR 0276 decision 3).
func (i *Inventory) AloneMerges(ctx context.Context) ([]BatchedMerge, error) {
return i.merges(ctx, `where plan_id is null and alone order by merged_at desc nulls last, heard_at desc`)
+3
View File
@@ -152,6 +152,9 @@ type PlanDelivery struct {
TakenOverBy string `json:"taken_over_by,omitempty"`
// Batch is the window of a batch; nil once it is cut into a walk.
Batch *PlanBatch `json:"batch,omitempty"`
// Alone says the walk walks one merge on its own commit, after a failed walk carried it in a later one:
// built at that commit, not at the branch.
Alone bool `json:"alone,omitempty"`
}
// Waiting is whether the walk waits for its delivery's word.