B1 floor-silent-retired: the builder's finding writer clears floor-silent at its start
Builds: design 47 H2 H-A-578 (1), H-A-247 (3)
This commit is contained in:
@@ -19,6 +19,10 @@ import (
|
||||
// A-29); its `findings-asked` subject is the seat's, from the generated contract (A-17).
|
||||
type heldWriter = views.HeldWriter[mcseat.Finding, mcseat.FindingCleared, mcseat.FindingsStated, mcseat.FindingsAskedEvent]
|
||||
|
||||
// retiredFindingKinds are kinds no code of the builder raises any more, which its writer clears once at its start (design 47 H2
|
||||
// H-A-578 (1), H-A-247 (3)): floor-silent went with the version floor.
|
||||
var retiredFindingKinds = []views.RetiredKind{{Kind: "floor-silent"}}
|
||||
|
||||
// findingWriter is the part of the held writer the builder's findings use; Held answers the findings it holds (design 47 G A-38).
|
||||
type findingWriter interface {
|
||||
Write(ctx context.Context, f mcseat.Finding) error
|
||||
|
||||
@@ -99,7 +99,7 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
|
||||
// The builder's findings are raised as they happen, so its one finding writer holds them (design 47 G A-29, §689): it
|
||||
// is started once the state is bound, and what is written before is stated at its start.
|
||||
fw, err := views.NewHeldWriter(views.WriterConfig[mcseat.Finding, mcseat.FindingCleared, mcseat.FindingsStated, mcseat.FindingsAskedEvent]{
|
||||
Module: cred.Module, State: calls.State("findings"), Node: cred.Node, Asked: mcseat.SubjectFindingsAsked, JS: js, Conn: conn, Logf: logger.Printf})
|
||||
Module: cred.Module, State: calls.State("findings"), Node: cred.Node, Asked: mcseat.SubjectFindingsAsked, Retired: retiredFindingKinds, JS: js, Conn: conn, Logf: logger.Printf})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -566,4 +566,8 @@ func TestTheBuildersFindingsAreObservedByItsCredentialsModule(t *testing.T) {
|
||||
if err != nil || got.Observer != "acme-builder" {
|
||||
t.Fatalf("the finding = %+v, %v; want the observer acme-builder", got, err)
|
||||
}
|
||||
// H2 H-A-578 (1): floor-silent, which no code of the builder raises any more, is cleared at the writer's start
|
||||
if !slices.ContainsFunc(retiredFindingKinds, func(r views.RetiredKind) bool { return r.Kind == "floor-silent" && len(r.IDs) == 0 }) || slices.ContainsFunc(retiredFindingKinds, func(r views.RetiredKind) bool { return r.Kind == BuildFailed }) {
|
||||
t.Error("the writer's retired kinds are not floor-silent alone")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user