fix(server): keep ready checkpoints when a later placeholder arrives - #8432
fix(server): keep ready checkpoints when a later placeholder arrives#8432Adolanium wants to merge 1 commit into
Conversation
The in-memory projector already refuses a missing placeholder over a ready capture. SQL always wrote the later status. Thread detail and diffs read SQL, so a concurrent placeholder could hide a finished checkpoint. Skip the SQL write when the stored checkpoint is not missing and the new event is.
|
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrow read-model consistency fix: only a later You can add or adjust custom eligibility rules. Learn more. |
What Changed
The SQL turns projector now refuses a later
missingplaceholder over a checkpoint that is alreadyreadyorerror.In-memory
projectEventalready had this guard. SQL always wrotecheckpointStatus: event.payload.status. Thread detail and diffs read SQL.Same-turn placeholder then ready is still the happy path. This only stops a later placeholder from wiping a capture that already landed.
Why
Ingestion and CheckpointReactor dispatch onto the same serial queue. If
readylands first, a latermissingwas a no-op in memory and a clobber in SQL.Checklist
Note
Low Risk
Narrow projection guard on duplicate turn-diff events; improves read-model consistency for checkpoints with limited blast radius.
Overview
Aligns the SQL turn projector with in-memory event projection so a later
thread.turn-diff-completedwithmissingcannot overwrite a turn that already has a real checkpoint (readyorerror).When
readyis projected before a trailing placeholder (e.g. shared serial queue ordering),projection_turnsused to always take the latest status, so thread detail and diffs could show missing even after a successful capture. The handler now no-ops that downgrade; placeholder-then-ready on the same turn is unchanged.Adds an integration test that projects
readythenmissingfor the same turn and asserts SQL still storesreadyand the checkpoint ref.Reviewed by Cursor Bugbot for commit c5e84c9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
ProjectionPipelineto keep ready checkpoints when a latermissingplaceholder arrivesthread.turn-diff-completedhandler in ProjectionPipeline.ts, adds an early return guard: if an existing turn projection already has a non-null, non-missingcheckpointStatus, incoming events with statusmissingare ignored for that turn.readycheckpoint followed by amissingevent for the same turn and asserts thereadystatus and originalcheckpointRefare retained.Macroscope summarized c5e84c9.