Merge pull request 'The gate's module check notes a seat another module declares, which it was not given (hq issue 364)' (#195) from fix/364-a-touched-manifest-uses-a-seat-another-module-declares into main
This commit was merged in pull request #195.
This commit is contained in:
@@ -543,6 +543,11 @@ func passedSoFar(ran []string) string {
|
||||
return strings.Join(ran, ", ") + " passed; "
|
||||
}
|
||||
|
||||
// SomeManifestsEnv tells the judge's module check that the manifests it is given are only those a change touches,
|
||||
// so a seat another module of the repository declares is a note there, not a refusal (novox/hq issue 364). A judge
|
||||
// that predates it reads nothing of it and refuses as before.
|
||||
const SomeManifestsEnv = "MESH_MODULE_CHECK_SOME=1"
|
||||
|
||||
// gateLayer runs the gate: the touched manifests through `module check`, every machine composed with the
|
||||
// change, and the replays of what the mesh runs. It answers the gate's verdict and summary.
|
||||
func gateLayer(ctx context.Context, spec CheckSpec, tree, root, gate, verdictFile string, env []string,
|
||||
@@ -562,7 +567,7 @@ func gateLayer(ctx context.Context, spec CheckSpec, tree, root, gate, verdictFil
|
||||
checked := func(dir string) (string, error) {
|
||||
var own tail
|
||||
cmd := exec.CommandContext(ctx, "docker", LabelledArgs("docker",
|
||||
inToolchain(dir, env, append([]string{gate, "module", "check"}, manifests...)...), spec.ID)...)
|
||||
inToolchain(dir, append(append([]string{}, env...), SomeManifestsEnv), append([]string{gate, "module", "check"}, manifests...)...), spec.ID)...)
|
||||
inItsOwnGroup(cmd)
|
||||
w := io.MultiWriter(out, &own)
|
||||
cmd.Stdout, cmd.Stderr = w, w
|
||||
|
||||
@@ -230,6 +230,14 @@ type Shelf map[string]Manifest
|
||||
//
|
||||
// Run at registration, which is the last moment the mesh can still refuse: after it, a caller is
|
||||
// bound to a seat and a refusal is an outage rather than a conversation.
|
||||
// UndeclaredSeat ends the problem of a `uses` or a claim naming a seat no manifest given declares: over the whole
|
||||
// catalogue (registration, the catalogue's own check) a refusal, and over some manifests alone a seat whose
|
||||
// declaring module was not given (novox/hq issue 364).
|
||||
const UndeclaredSeat = "which no module declares and the mesh does not define"
|
||||
|
||||
// IsUndeclaredSeat says whether a problem CatalogueProblems gave is a seat no manifest given declares.
|
||||
func IsUndeclaredSeat(problem string) bool { return strings.HasSuffix(problem, UndeclaredSeat) }
|
||||
|
||||
func CatalogueProblems(shelf Shelf) []string {
|
||||
var problems []string
|
||||
|
||||
@@ -282,7 +290,7 @@ func CatalogueProblems(shelf Shelf) []string {
|
||||
for _, u := range m.Uses {
|
||||
if !exists(u) {
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
"%s uses the seat %q, which no module declares and the mesh does not define",
|
||||
"%s uses the seat %q, "+UndeclaredSeat,
|
||||
module, u))
|
||||
}
|
||||
}
|
||||
@@ -290,7 +298,7 @@ func CatalogueProblems(shelf Shelf) []string {
|
||||
for _, c := range m.Claims {
|
||||
if !exists(c.Name) {
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
"%s claims the seat %q, which no module declares and the mesh does not define",
|
||||
"%s claims the seat %q, "+UndeclaredSeat,
|
||||
module, c.Name))
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user