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 }