Skip to content

feat: SBE v7 egressSeq — log-position order key on trade + status egress#119

Merged
emrebulutlar merged 1 commit into
mainfrom
feat/sbe-v7-egress-seq
Jul 9, 2026
Merged

feat: SBE v7 egressSeq — log-position order key on trade + status egress#119
emrebulutlar merged 1 commit into
mainfrom
feat/sbe-v7-egress-seq

Conversation

@emrebulutlar

Copy link
Copy Markdown
Member

Summary

  • Adds egressSeq (int64, sinceVersion=7, group tail extension) to OrderStatusBatch.orders and TradeExecutionBatch.trades: the Aeron cluster-log position of the producing ingress command, threaded Engine.currentLogPosition → MatchEventPublisher → PublishEvent → MarketPublisher entries → encoders.
  • Deterministic across replicas + monotonic across leaders (same source as bookVersion). One order key spanning both egress streams. Explicitly documented as ORDER KEY ONLY (sparse + non-unique — never a dense gap-detector; statusSeq/tradeId keep that job).
  • Mixed-roll safe both directions (v6 skip via blockLength; v7-on-v6 reads null → normalize 0).
  • This is the match half of Layer 2; it is also a prerequisite for the Assets Engine settlement journal (deterministic resume key). OMS-side consumption lands separately.

Test plan

  • make determinism: 67/0, zero golden changes
  • MatchEventPublisher/PublishEvent/MarketPublisher* suites: 45/0
  • SBE regen idempotent (schema ↔ committed codecs verified)

🤖 Generated with Claude Code

…ess (Layer 2, match side)

Stamps every OrderStatusBatch/TradeExecutionBatch entry with the Aeron
cluster-log position of the producing ingress command
(header.position() -> Engine.currentLogPosition, the bookVersion
source): deterministic across replicas, monotonic across leaders,
shared by all events of one command. Gives consumers one order key
spanning both egress streams (which flush trades-before-statuses).

ORDER KEY ONLY, and documented as such in the schema: the log position
is sparse (timers advance it) and non-unique (per command, not per
event) -- statusSeq/tradeId remain the dense gap-detect sequences.

Group TAIL extension sinceVersion=7; mixed-roll safe (v6 peers skip via
group blockLength, v7 readers of v6 streams get the null value ->
normalize to 0).

Determinism goldens unchanged (egressSeq invisible to the logical
MatchEventSink): corpus 67/0. Publisher/encoder tests 45/0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@emrebulutlar
emrebulutlar merged commit e7625e8 into main Jul 9, 2026
1 of 2 checks passed
@emrebulutlar
emrebulutlar deleted the feat/sbe-v7-egress-seq branch July 9, 2026 23:02
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