views: wire the unhandled-event count once, and prove it on the bus

The hub's hook, the path the live fault took, had no test that failed
without it, and each Start appended it again, so a second Start counted
every event twice. Start now wires it once per hub and keeps the time of
the first start; the shared-durable integration test holds the reader's
finding of the one event nobody takes, counted once across two starts.

Builds: design 47 H H-A-169
This commit is contained in:
2026-11-20 17:52:48 +01:00
parent e568e6dc63
commit a5225dfac3
2 changed files with 54 additions and 3 deletions
+12 -2
View File
@@ -77,6 +77,8 @@ type ProcessReader struct {
unheard int
lastUnheard string
startedAt time.Time
// hooked is the hub the count of unhandled events is wired on, so a second Start counts no event twice.
hooked *process.EventHub
}
// adoptedHear is one adopted follower's handler of its seat event, by its picture's bucket.
@@ -898,10 +900,18 @@ func (r *ProcessReader) Start(ctx context.Context, js jetstream.JetStream, cred
if r.Findings != nil {
// H-A-169: the events no handler of the module takes are its finding, cleared at each start
r.clearUnhandled()
hub.OnUnhandled(r.unhandled)
r.mu.Lock()
wire := r.hooked != hub
r.hooked = hub
r.mu.Unlock()
if wire {
hub.OnUnhandled(r.unhandled)
}
}
r.mu.Lock()
r.startedAt = r.now()
if r.startedAt.IsZero() {
r.startedAt = r.now() // the process's start; a second Start counts on from it
}
r.status = status
if !own {
// an event adopted after the start is handled on the module's hub (Adopt); the reader's own hub takes every one