G findings: the held writers of the stdio bundles are made once the runtime has its channel

The held writer reads the keys of its state when it is made, so it is made after Serve answers state calls; the keeper says a finding is not said before it exists.

Builds: design 47 G A-32, A-29, A-37
This commit is contained in:
2026-11-11 22:15:42 +01:00
parent 9f4d4eecba
commit fc83f204f4
4 changed files with 69 additions and 27 deletions
@@ -505,23 +505,22 @@ func tools(v *holder.Verbs, windows kept[holder.Window], callers func() (holder.
var findings = &holder.Findings{Logf: logf}
func main() {
// The tools bundle's findings go through the module's writer (design 47 G §689, A-16); it owns the transfers' kinds, the
// program's writer the driver's.
w, err := views.NewStdioHeldWriter(views.WriterConfig[meshconditions.Finding, meshconditions.FindingCleared, meshconditions.FindingsStated, meshconditions.FindingsAskedEvent]{
Asked: meshconditions.SubjectFindingsAsked, Module: holder.Self, State: stdio.State("findings"), Kinds: holder.TransferFindingKinds, Logf: logf})
if err != nil {
logf("%v", err)
os.Exit(1)
}
findings.Writer = w
// the runtime answers the writer's subscription only once Serve has its channel
// The tools bundle's findings go through the module's held writer (design 47 G §689, A-16, A-29, A-32); it owns the transfers'
// kinds, the program's writer the driver's. The runtime answers its state and subscription only once Serve has its channel,
// so it is made then.
go func() {
<-stdio.Served()
// the keys of the older form end in no kind the writer owns, so it does not clear them (A-31)
if err := holder.DeleteOldFindings(stdio.State("findings"), holder.Self, holder.TransferFindingKinds); err != nil {
logf("the old findings are not deleted: %v", err)
}
if err := w.Start(context.Background()); err != nil {
w, err := views.NewStdioHeldWriter(views.WriterConfig[meshconditions.Finding, meshconditions.FindingCleared, meshconditions.FindingsStated, meshconditions.FindingsAskedEvent]{
Asked: meshconditions.SubjectFindingsAsked, Module: holder.Self, State: stdio.State("findings"), Kinds: holder.TransferFindingKinds, Logf: logf})
if err == nil {
findings.Use(w)
err = w.Start(context.Background())
}
if err != nil {
logf("%v", err)
os.Exit(1)
}