Add registered event source and stream definitions - #229
Conversation
Introduce @eventSource/@eventstream definitions registered through the EventSources wire service, AppendOptions.eventSource/eventStream and per-event routing, derived concurrency scopes, and EventContext.eventSource.
…its of work eventSources is now optional on IEventStore so custom implementations keep compiling. Transactional append accepts eventSource/eventStream and UnitOfWork forwards them on commit. Scenarios reject the options loudly.
Re-baseline fixtures against the 19.30.0 engine and contracts. The only semantic drift: a parent created by a child-only event stays uninitialized on later child-only events; the in-process projection processor now matches. The oracle reads the client's ambient causation through the new entry wrapper.
|
The "Projection oracle" CI failure on this PR (the fixture version/hash mismatch reported at run 37099328763) was caused by One thing worth a second pair of eyes while re-verifying: |
…ource id The Kernel keeps one concurrency scope per event source id. Every definition event now contributes its required guard: equivalent predicates share a scope, an unguarded event never suppresses a guarded one, and differing predicates throw before any wire append or unit of work group write.
|
Scope-guard fix pushed: batches needing differing concurrency guards for one event source id now fail before any write (client, and unit-of-work preflight). Verified: 3120 unit specs, build, standard-types, native, snippets, kernel integration on isolated 18700 (jobs flake once on cold start, passes on rerun). Core tracking: Cratis/Chronicle#4545. |
Event sources and streams can now be registered with the Kernel and used when appending. Existing appends, options and event contexts are unchanged.
Added
@eventSource({ name?, description?, concurrency? })and repeatable@eventStream(name, { description?, concurrency? })definitions, plusConcurrencyDimensions. Definitions are discovered and registered with the Kernel at startup, right after event types. Duplicate source or stream names are rejected. (part of Registered event source definitions and streams: client parity #228)AppendOptions.eventSource/eventStreamand the same per-event fields onEventForEventSourceIdforappendandappendMany, including mixed-source batches. The wireEventSourcekey and routing are set from the definition; unknown sources, undeclared streams, a stream without a source and contradicting explicit routing fail before anything is sent. (part of Registered event source definitions and streams: client parity #228)appendManyand a committing unit of work, one event source id that needs differing guards (for example two stream ids) is rejected before anything is written, because the Kernel accepts one scope per event source id; pass an explicit sharedconcurrencyScopesentry or split the batch. Tracked in core as Reject incompatible definition-derived guards in same-id batches Chronicle#4545. (part of Registered event source definitions and streams: client parity #228)EventContext.eventSourceon reads, reactor and reducer deliveries;undefinedfor events appended without a definition.IEventStore.eventSourcesexposes the discovered definitions. (part of Registered event source definitions and streams: client parity #228)Changed
@cratis/chronicle.contracts19.30.0 and a Chronicle 19.30.0 Kernel to use event sources.