Skip to content

Add strict replay, join sink cleanup, and update dependencies - #88

Merged
raphael merged 2 commits into
mainfrom
retained-position-replay
Sep 27, 2026
Merged

raphael merged 2 commits into
mainfrom
retained-position-replay

Conversation

@raphael

@raphael raphael commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Ordinary Reader can continue from available history after its requested position has been trimmed. Callers that need to detect that loss can now use Stream.NewReplayReader: it checks the existing stream generation, exact retained anchor, and first successor batch together before returning. 0-0 starts at available history without claiming earlier completeness. Replay creates or repairs no lifecycle state.

Callers provide positive event-count and copied-byte limits plus a blocking wait of at least one millisecond. Anchor returns the opening entry separately; one unbuffered Subscribe channel delivers complete successors. The caller context owns the observation lifetime. Done signals finished observation, Err preserves the terminal cause, and Close cancels and joins the current command and reader loop. Invalid IDs, missing lifecycles, unavailable positions, and oversized events have explicit error categories; malformed data and dependency failures terminate observation.

Previously, failed Redis detachment could leave Sink subscriptions and local map readers open, and public Close did not join automatic fatal-read cleanup. Sink now releases those local resources and joins cleanup while retaining the exact failed attachment for a later Close attempt. Pending events remain recoverable; IsClosed becomes true only after distributed detachment succeeds. Review closeResources and closeAfterRead alongside the replay script's admission checks.

The replay API is additive and uses the existing lifecycle format. Existing Reader behavior is unchanged; this diff adds no storage migration or mixed-version deployment sequence. Rolling back removes the new API and shutdown fix without converting stored data. Byte limits cover copied content, not raw Redis entry or wakeup materialization; deployments must separately admit those costs. Blocking duration is not a total operation deadline.

This PR also updates runtime and test dependencies on their existing module paths, including go-redis 9.22.0, Clue 1.3.0, Goa 3.32.0, Model 1.16.10, OpenTelemetry 1.46.0, and gRPC 1.84.0. Pulse now requires Go 1.26 because several selected dependencies require it. The README records that minimum, and CI is configured for Go 1.26 and 1.27.

Consumers using unset go-redis options inherit a five-second read/write timeout and changed retry backoff; explicitly configured values retain their meaning. Clue now isolates logging options in derived contexts. Consumers using OpenTelemetry’s HTTP WithEndpointURL should include the signal path when needed; Pulse’s examples use gRPC exporters. Redis caching and automatic pipelining remain opt-in and are not enabled by this change.

With the updated dependency graph, module verification, compilation of all packages and examples, and staticcheck passed on Go 1.26.8. Race tests passed for every test-bearing package: 273 tests and 147 subtests across streaming, replicated maps, semaphores, the worker pool, logging/goroutine helpers, and the weather poller. No tests failed or were skipped; generated example packages without test files were also compiled. The disposable Redis instance was removed after verification. These checks do not run the example services or establish production capacity; the two CI jobs remain to be confirmed.

@raphael raphael changed the title Add strict retained-position replay and join sink cleanup Add strict replay, join sink cleanup, and update dependencies Sep 27, 2026
@raphael
raphael merged commit 2caf870 into main Sep 27, 2026
6 checks passed
@raphael
raphael deleted the retained-position-replay branch September 27, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant