Files
mesh-delivery/modules/mesh-delivery-indexer/internal/index/seatsof.go
T
jschoubben 03809d8d83 Merge origin/main into b7/registry: the group try and the successor validation take the group's contracts, clients and seat list (issue 1966, issue 1921)
The seat verb try gains members (ADR 0637 section 6); the try's group name and the missing-preview reason are one definition of mesh-delivery-sdk (ADR 0637 section 8).

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-05 20:41:41 +01:00

45 lines
1.9 KiB
Go

package index
// The seat definitions a revision carries (novox/hq ADR 0633 §1, ADR 0635 §3, ADR 0636 §4): when a take-in works out which
// indexer a revision names, or a group try's candidate is made, the manifests are judged against the seats of that revision
// on top of the seat list the indexer holds, since the manifest the revision names may serve or invoke what the revision's
// definitions add (a verb of a seat, an event). The revision's merges are not taken in yet, and a try has no pull request,
// so their definitions are not on the bus: they are read from the merges' trees as the indexer reads a merge's (readDefinitions
// of seatdefs.go, the same resolution of the parts), never by a reader of their own.
import (
"context"
"maps"
"slices"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/seatdef"
)
// revisionSeats are the seats of the definitions the ready merges carry, read at their merge commits, the newest merge
// of a repository governing; none where the indexer has no forge reader. A read the forge does not answer is an error
// (the take-in is tried again); a definition that does not parse is said and left out, as the indexer that keeps it
// would say it unparsed.
func (ix *Indexer) revisionSeats(ctx context.Context, ready []PendingEntry) ([]catalogue.Seat, error) {
if ix.ReadFile == nil || ix.Files == nil {
return nil, nil
}
defs := map[string]seatdef.Definition{}
for _, e := range ready {
if e.Covered || e.Forge.Merge == "" {
continue
}
for _, c := range contractsModules(e.Forge.Manifests) {
got, unparsed, err := ix.readDefinitions(ctx, e.Forge.Repository, e.Forge.Merge, c)
if err != nil {
return nil, err
}
for seat, why := range unparsed {
ix.logf("the revision's definition of %s (%s) does not parse and is left out: %s", seat, c.module, why)
}
maps.Copy(defs, got)
}
}
return catalogue.SeatsFromDefinitions(slices.Collect(maps.Values(defs))), nil
}