Check append condition against events after a position - #921
Merged
Merged
Conversation
The append condition required the highest matching event to be exactly `highestSequenceNumber`. The DCB spec instead fails the append only if a matching event exists after the given position, which may be higher than the last matching event. A caller passing e.g. the global head got a false AppendConditionNotMet. AppendCondition now takes `after` (default 0) and both stores check that no matching event with a higher index exists. The query is required now, since an empty query matches all events.
|
Hello 👋 here is the most recent benchmark result:
This comment gets update everytime a new commit comes in! |
DanielBadura
approved these changes
Oct 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The append condition checked that the highest matching event is exactly
highestSequenceNumber. The DCB spec defines it differently: the append fails if an event matching the query exists after the given position, and that position may be higher than the last matching event. So passing anything other than the exact last matching index, like the global head, led to a falseAppendConditionNotMet.AppendConditionnow takesafterinstead ofhighestSequenceNumber, defaulting to 0 (no matching event may exist at all). Both stores check that no matching event with a higher index exists, on the dbal side as aNOT EXISTS (... WHERE events.id > :after). The query is now required, sincenew AppendCondition()would otherwise mean "the store must be empty". For decision models built withStoreDecisionModelBuildernothing changes.