The running indexer's validation before take-in asks its own manifest validator (cmd/mesh-judge under the indexer entry's Go module, at the revision's head) over two cases and refuses only what the revision causes; mesh-judge reads the file MESH_RUN_INPUT names, where a run writes its input. Builds: design 47 G §712, A-213, A-232 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
62 lines
2.6 KiB
Go
62 lines
2.6 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 and the same rule of which module may define a seat), never by a reader
|
|
// of their own.
|
|
|
|
import (
|
|
"context"
|
|
"maps"
|
|
"slices"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/seatdefs"
|
|
"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) {
|
|
defs, err := ix.revisionSeatDefinitions(ctx, ready)
|
|
if err != nil || defs == nil {
|
|
return nil, err
|
|
}
|
|
return catalogue.SeatsFromDefinitions(slices.Collect(maps.Values(defs))), nil
|
|
}
|
|
|
|
// revisionSeatDefinitions are the definitions revisionSeats reads, by seat; nil where the indexer has no forge reader.
|
|
func (ix *Indexer) revisionSeatDefinitions(ctx context.Context, ready []PendingEntry) (map[string]seatdef.Definition, 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)
|
|
}
|
|
for seat, d := range got {
|
|
if why := seatdefs.Refusal(c.Module, d); why != "" {
|
|
ix.logf("the revision's definition of %s is left out: %s", seat, why) // as keepTrunk refuses it (ADR 0636 §5)
|
|
continue
|
|
}
|
|
defs[seat] = d
|
|
}
|
|
}
|
|
}
|
|
return defs, nil
|
|
}
|