I-114 fix: a state held not there yet holds nothing to take in first

Before the state held is bound, hearing a source-moved read it to hold the event behind
earlier ones, failed and left every message unacknowledged, so nothing was taken in (two of
the indexer's integration tests, which make no held state). A state not there yet holds
nothing: the event is taken in; holding it still needs the state.

Builds: design 47 H H-A-114, H-A-118
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-20 05:24:20 +01:00
parent 12b48debe9
commit a94b275a9c
@@ -14,6 +14,7 @@ import (
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-indexer/takein"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/keys"
"git.novox.be/novox/mesh-sdk/go/process"
)
// HeldState is the indexer's state held (design 47 H §744, H-A-97, H-A-118): one key per watched branch, the branch escaped as
@@ -123,6 +124,9 @@ func (ix *Indexer) hold(ctx context.Context, e meshdelivery.SourceMovedEvent, wh
// taken in in their order (H-A-118); it answers whether it did. ErrHeldUnwritten when it is not written.
func (ix *Indexer) HoldBehind(ctx context.Context, e meshdelivery.SourceMovedEvent) (bool, error) {
hs, err := ix.HeldOf(ctx, e.Branch)
if errors.Is(err, process.ErrNotYet) {
return false, nil // a state held not there yet holds nothing to take in first
}
if err != nil {
return false, fmt.Errorf("%w: %v", ErrHeldUnwritten, err)
}