Keep a first merge whose manifest word the running build-agent does not read, and name it (issue 1173)

ADR 0482 section 5: a merged manifest the running reader refuses waits for the newer reader, never failed.
This commit is contained in:
2026-10-22 16:18:39 +02:00
parent b8f77577fe
commit 980d396d40
7 changed files with 203 additions and 1 deletions
+10
View File
@@ -114,6 +114,16 @@ func (i *Inventory) AnswerMerge(ctx context.Context, repository, commit, plan st
return i.chainSavePlans(ctx, c, nil, []MergeMove{{Repository: repository, Commit: commit, Plan: plan, Alone: alone}})
}
// HoldMerge puts a merge back to waiting, no plan answering it, with the event it is kept under replaced (novox/hq issue 1173:
// a first merge held for a build-agent that reads its manifest, the hold said in its event).
func (i *Inventory) HoldMerge(ctx context.Context, repository, commit string, event json.RawMessage) error {
c, err := i.theChain(ctx)
if err != nil {
return err
}
return i.chainSavePlans(ctx, c, nil, []MergeMove{{Repository: repository, Commit: commit, Event: event}})
}
// Batches is every batch not yet cut: assembling or queued, oldest first. One at a time is the rule; more
// are read so a fault is seen.
func (i *Inventory) Batches(ctx context.Context) ([]Plan, error) {
+3
View File
@@ -758,6 +758,9 @@ func (i *Inventory) chainSavePlans(ctx context.Context, c *chain.Chain, plans []
if m.Plan == "" {
f := w.m
f.Waiting, f.Alone = true, m.Alone
if m.Event != nil {
f.Event = m.Event
}
editOf(w.plan).flag[key] = f
continue
}
+3
View File
@@ -2,6 +2,7 @@ package inventory
import (
"context"
"encoding/json"
"errors"
"fmt"
"slices"
@@ -677,6 +678,8 @@ func (i *Inventory) SavePlan(ctx context.Context, p *Plan) error {
type MergeMove struct {
Repository, Commit, Plan string
Alone bool
// Event replaces the merge's kept announcement when it is put back to waiting (Plan empty); nil leaves it.
Event json.RawMessage
}
// SavePlansMoving writes plans, as SavePlan does each, and gives merges to the plans that answer them, all in one