Files
mesh-controller/internal/inventory/refused.go
T
jschoubben 0e0c775bfa
mesh/merge-gate head 0e0c775bfa5e merged into trunk f10fbda1f619 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 0e0c775bfa5e merged into trunk f10fbda1f619 — pass: its merge-check.sh passed
mesh/delivery delivered
Keep a refused registration left to the build records, in the store and the process, so the look fails the plan rather than settling it built; and forget a deleted module and say what was never sent when the records settle (issue 1708)
2026-10-21 15:03:23 +02:00

34 lines
1.1 KiB
Go

package inventory
import "context"
// RecordRefused keeps that the mesh refused to register a build's outcome, and why (novox/hq issue 1708): the build
// record says the builder's words, which worked, and the look that settles a plan from the records reads this to fail
// it instead. The first refusal of an id stands.
func (i *Inventory) RecordRefused(ctx context.Context, id, module, why string) error {
_, err := i.store.Pool().Exec(ctx,
`insert into build_refused (id, module, why) values ($1, $2, $3) on conflict (id) do nothing`, id, module, why)
return err
}
// RefusedOf is why each of these builds' registration was refused, by id; a build not refused is absent.
func (i *Inventory) RefusedOf(ctx context.Context, ids []string) (map[string]string, error) {
out := map[string]string{}
if len(ids) == 0 {
return out, nil
}
rows, err := i.store.Pool().Query(ctx, `select id, why from build_refused where id = any($1)`, ids)
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
var id, why string
if err := rows.Scan(&id, &why); err != nil {
return nil, err
}
out[id] = why
}
return out, rows.Err()
}