perf(server): bootstrap engine from persisted projections#1648
perf(server): bootstrap engine from persisted projections#1648juliusmarminge merged 2 commits intomainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
2131e68 to
5c2fe46
Compare
f07a69d to
ed2220e
Compare
ApprovabilityVerdict: Needs human review This PR changes the orchestration engine's bootstrap mechanism from event replay to loading from persisted projection snapshots - a significant change to startup behavior that affects how the engine initializes its in-memory state. While the intent is performance improvement, the change to core initialization logic warrants human review. You can customize Macroscope's approvability policy. Learn more. |
ed2220e to
acc331e
Compare
5c2fe46 to
4a2c81a
Compare
acc331e to
f23d141
Compare
4a2c81a to
3938930
Compare
2d09204 to
362933c
Compare
f23d141 to
059ff5b
Compare
362933c to
8bb2822
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
8bb2822 to
379bef6
Compare
…1648) Co-authored-by: codex <codex@users.noreply.github.com>
…1648) Co-authored-by: codex <codex@users.noreply.github.com>
Summary
Stack
codex/backend-perf-message-projection)Validation
bun run test src/orchestration/Layers/OrchestrationEngine.test.tsbun run test src/orchestration/Layers/ProjectionSnapshotQuery.test.ts src/checkpointing/Layers/CheckpointDiffQuery.test.ts src/persistence/Layers/ProjectionThreadMessages.test.ts src/orchestration/Layers/ProjectionPipeline.test.ts src/orchestration/Layers/OrchestrationEngine.test.ts src/orchestration/Layers/CheckpointReactor.test.ts src/orchestration/Layers/ProviderRuntimeIngestion.test.ts src/orchestration/Layers/ProviderCommandReactor.test.tsbun fmtbun lintbun typecheck(currently fails inapps/webdue pre-existing@effect/atom-react/Layer.suspenderrors)Note
Medium Risk
Changes orchestration engine startup semantics to seed in-memory state from projection snapshots rather than replaying the full event log; incorrect/missing snapshots could lead to stale read models at boot. Also touches server layer wiring and multiple harness/test compositions, which can cause runtime DI/startup regressions.
Overview
Orchestration engine startup now initializes its in-memory read model from persisted projection snapshots by calling
ProjectionSnapshotQuery.getSnapshot()after projection bootstrap, removing the extra fullOrchestrationEventStore.readAll()replay pass.Wires
OrchestrationProjectionSnapshotQueryLiveas a required dependency throughout runtime composition: refactorsserver.tsorchestration layers to separate infrastructure vs engine, and updates integration/test harness layers to provide the snapshot query toOrchestrationEngineLive.Adds a new engine test asserting bootstrap uses snapshots (and fails if historical replay is attempted).
Written by Cursor Bugbot for commit 379bef6. This will update automatically on new commits. Configure here.
Note
Bootstrap orchestration engine read model from persisted projection snapshots instead of event replay
makeOrchestrationEnginenow callsProjectionSnapshotQuery.getSnapshot()at startup instead of replaying all historical events viaOrchestrationEventStore.readAll(), reducing bootstrap time proportional to event history.OrchestrationProjectionSnapshotQueryLivelayer is wired intoOrchestrationEngineLiveacross server.ts, integration harnesses, and all affected test modules.ProjectionThreadMessageRepositorygains agetByMessageIdmethod returningOption<ProjectionThreadMessage>, used by thethread.message-sentprojector in ProjectionPipeline.ts to look up messages directly instead of listing by thread.Macroscope summarized 379bef6.