Owe a merge to the record from its branch's first kept merge (hq ADR 0276 review)
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
mesh/delivery superseded: a newer head of the same pull request

This commit is contained in:
jochen
2026-10-10 13:54:40 +02:00
parent 0e0e143055
commit 065cfa0d1d
+2 -4
View File
@@ -64,15 +64,13 @@ 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
// KeptOnBranch says the controller keeps a merge of a repository's branch, and when it heard the branch's first: 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)`,
`select min(heard_at), count(*) > 0 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