Merge alt event store into core with JSON serialization and Prometheus metrics #36

Open
opened 2026-03-14 23:54:56 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: refactor(event-sourcing): consolidate ImmuDB event store with JSON serialization and Prometheus metrics
  • Branch: feature/m1-v12-consolidate-event-store

Background

Two ImmuDB event store implementations exist. The core version uses Marshal (insecure binary serialization) with no metrics. The alt version at lib/aethyr/event_sourcing/immudb_event_store.rb uses JSON/Oj with Prometheus counters and optimistic locking but is never wired in.

Expected Behavior

A single canonical event store at lib/aethyr/core/event_sourcing/immudb_event_store.rb that combines the best of both: JSON serialization via Oj, Prometheus metrics, optimistic concurrency, file-based fallback, and configuration via ServerConfig.

Acceptance Criteria

  • Core event store uses Oj JSON serialization instead of Marshal
  • Prometheus counters added: events_committed_total, event_commit_latency_seconds, snapshot_operations_total
  • Optimistic concurrency control with sequence number checking
  • All configuration reads from ServerConfig (no separate Configuration singleton)
  • File-based fallback uses JSON format matching the ImmuDB format

Subtasks

  • Replace Marshal.dump/load with Oj.dump/load in core event store
  • Port Prometheus metrics from alt implementation
  • Port optimistic locking from alt implementation
  • Update key format to evt/{id}/{seq} and snap/{id}/{seq}
  • Update sequent_setup.rb to use the consolidated store
  • Tests: Unit tests for store, load, snapshot, metrics, fallback
  • Run bundle exec rake unit, fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line matches the Commit Message in Metadata exactly.
  • The commit is pushed to the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged.
## Metadata - **Commit Message**: `refactor(event-sourcing): consolidate ImmuDB event store with JSON serialization and Prometheus metrics` - **Branch**: `feature/m1-v12-consolidate-event-store` ## Background Two ImmuDB event store implementations exist. The core version uses Marshal (insecure binary serialization) with no metrics. The alt version at `lib/aethyr/event_sourcing/immudb_event_store.rb` uses JSON/Oj with Prometheus counters and optimistic locking but is never wired in. ## Expected Behavior A single canonical event store at `lib/aethyr/core/event_sourcing/immudb_event_store.rb` that combines the best of both: JSON serialization via Oj, Prometheus metrics, optimistic concurrency, file-based fallback, and configuration via `ServerConfig`. ## Acceptance Criteria - [ ] Core event store uses Oj JSON serialization instead of Marshal - [ ] Prometheus counters added: `events_committed_total`, `event_commit_latency_seconds`, `snapshot_operations_total` - [ ] Optimistic concurrency control with sequence number checking - [ ] All configuration reads from `ServerConfig` (no separate `Configuration` singleton) - [ ] File-based fallback uses JSON format matching the ImmuDB format ## Subtasks - [ ] Replace Marshal.dump/load with Oj.dump/load in core event store - [ ] Port Prometheus metrics from alt implementation - [ ] Port optimistic locking from alt implementation - [ ] Update key format to `evt/{id}/{seq}` and `snap/{id}/{seq}` - [ ] Update `sequent_setup.rb` to use the consolidated store - [ ] Tests: Unit tests for store, load, snapshot, metrics, fallback - [ ] Run `bundle exec rake unit`, fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the first line matches the Commit Message in Metadata exactly. - The commit is pushed to the branch matching the Branch in Metadata exactly. - The commit is submitted as a pull request to `master`, reviewed, and merged.
freemo added this to the v1.2.0 milestone 2026-03-14 23:54:56 +00:00
freemo self-assigned this 2026-03-15 04:25:22 +00:00
freemo modified the milestone from v1.2.0 to v1.0.0 2026-03-15 23:19:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: aethyr/Aethyr#36
No description provided.