[Issue #39] Handle malformed events during JetStream replay with proper error reporting #41

Merged
HugoNijhuis merged 3 commits from issue-39-malformed-events into main 2026-01-10 17:48:05 +00:00

3 Commits

Author SHA1 Message Date
2bf699909b Handle malformed events during JetStream replay with proper error reporting
Add ReplayError and ReplayResult types to capture information about
malformed events encountered during replay. This allows callers to
inspect and handle corrupted data rather than having it silently skipped.

Key changes:
- Add ReplayError type with sequence number, raw data, and underlying error
- Add ReplayResult type containing both successfully parsed events and errors
- Add EventStoreWithErrors interface for stores that can report replay errors
- Implement GetEventsWithErrors on JetStreamEventStore
- Update GetEvents to maintain backward compatibility (still skips malformed)
- Add comprehensive unit tests for the new types

This addresses the issue of silent data loss during event-sourced replay
by giving callers visibility into data quality issues.

Closes #39

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:47:59 +01:00
200dd5d551 Merge pull request '[Issue #35] Add mutex protection to ConsistentHashRing for thread safety' (#40) from issue-35-hashring-mutex into main
Some checks failed
CI / build (push) Has been cancelled
2026-01-10 17:47:52 +00:00
4666bb6503 Add mutex protection to ConsistentHashRing for thread safety
All checks were successful
CI / build (pull_request) Successful in 16s
- Add sync.RWMutex to ConsistentHashRing struct
- Use Lock/Unlock for write operations (AddNode, RemoveNode)
- Use RLock/RUnlock for read operations (GetNode, GetNodes, IsEmpty)

This allows concurrent reads (the common case) while serializing writes,
preventing race conditions when multiple goroutines access the hash ring.

Closes #35

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:46:38 +01:00