Skip to content

feat: event store snapshot architecture (ADR S0040 Phase 1)#102

Merged
hironow merged 2 commits intomainfrom
feature/event-store-snapshot
Apr 4, 2026
Merged

feat: event store snapshot architecture (ADR S0040 Phase 1)#102
hironow merged 2 commits intomainfrom
feature/event-store-snapshot

Conversation

@hironow
Copy link
Copy Markdown
Owner

@hironow hironow commented Apr 4, 2026

Summary

  • Extend EventStore interface with LoadAfterSeqNr and LatestSeqNr for snapshot-based recovery
  • Add SnapshotStore port + FileSnapshotStore implementation (atomic write pattern)
  • Add SeqCounter (SQLite WAL) for globally monotonic SeqNr allocation
  • Add SeqAllocator port for future use
  • Integrate SeqCounter into SessionRecorder (optional SetSeqCounter)
  • Implement one-time cutover logic (sentinel snapshot + system.cutover event)
  • ADR S0040 placed in shared-adr/ as Accepted

Test plan

  • FileEventStore LoadAfterSeqNr/LatestSeqNr tests
  • FileSnapshotStore save/load/overwrite tests
  • SeqCounter monotonic + concurrent + InitializeAt tests
  • RunCutover first run / idempotent / empty store tests
  • Codex review P1 findings addressed
  • go test ./... -count=1 -short PASS

🤖 Generated with Claude Code

hironow and others added 2 commits April 5, 2026 00:43
- Extend EventStore interface with LoadAfterSeqNr and LatestSeqNr
- Add SnapshotStore port and FileSnapshotStore implementation
- Add SeqCounter (SQLite WAL) for globally monotonic SeqNr allocation
- Add SeqAllocator port for future use
- Integrate SeqCounter into SessionRecorder (optional SetSeqCounter)
- Implement one-time cutover logic (sentinel snapshot + system.cutover event)
- Add SpanEventStore instrumentation for new methods
- Add EventSystemCutover event type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- LoadAfterSeqNr: add SeqNr > 0 guard to exclude pre-cutover aggregate-local SeqNr
- Cutover: clarify null snapshot body is Phase 1 sentinel (Phase 2 adds real state)
- Improve LoadAfterSeqNr doc with pre-cutover SeqNr overlap warning

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hironow hironow merged commit fc14e1b into main Apr 4, 2026
6 checks passed
@hironow hironow deleted the feature/event-store-snapshot branch April 4, 2026 16:04
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