CRITICAL: Type registry not wired into stores — heterogeneous event deserialization broken #32
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ash/eskit#32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
EventStore[E] is generic with single type E. Stores deserialize directly into E via json.Unmarshal. This works for single-type streams but breaks for real-world heterogeneous event streams where one stream has OrderCreated, ItemAdded, OrderSubmitted, etc.
EventRegistry exists but is NOT integrated into the store read path. It's orphaned.
The Real Flow Needed
Options
Option A: E is an interface
Store uses registry to deserialize. Loses some compile-time safety.
Option B: E is a sum type / tagged union
Store deserializes into envelope. Ugly but type-safe.
Option C: E is any, registry does everything
Like Rita/Myrra. Maximum flexibility, minimum type safety.
Recommendation
Option A with registry integration. The store constructor takes a Registry, uses it on Load. Event type name stored alongside data (already in headers for NATS, need column for SQLite/Postgres).
Must Fix
Priority: CRITICAL
Without this, eskit can't handle real-world event streams.