Repository navigation
Wait for the transition log row in timeline-driven gen.sync tests - #172
Merged
Merged
Conversation
On the ETS data layer, the precise timeline's sync action makes the new state visible before RecordEvent's after_action hook appends the log row. await_state/3 returned on the state alone, so the log read straight after it could miss the last row. Add await_log/4, which polls the log until it matches, and share the deadline loop with await_state/3. Use it in the two gen.sync tests that read the log after a timeline run.
C-Sinclair
marked this pull request as ready for review
November 16, 2026 12:20
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.
Mix.Tasks.AshWorkflow.Gen.SyncTestgainsawait_log/4, which polls the transition log until it matches the expected value. It shares a deadline loop,await/3, withawait_state/3.AshWorkflow.Scheduler.Precise.Timelinerun now use it: "returns a failed sync to syncing with a fresh set of attempts" and "an update during a push resyncs once the push succeeds".AshWorkflow.Changes.RecordEventappends the log row in anafter_actionhook, after the new state is already readable. With no transaction around the two writes,await_state/3could return on:syncedbefore the:syncedrow existed. CI hit this once: left[:failed, :syncing, :syncing], right[:failed, :synced, :syncing, :syncing].sequenceDiagram participant T as Timeline process participant E as ETS participant X as Test process T->>E: write state :synced X->>E: await_state sees :synced X->>E: read log (row missing) T->>E: RecordEvent after_action appends :synced rowA
Process.sleep(100)placed before the log append inRecordEventreproduces the CI failure onmainevery time. The same test passes with this change. The other recipe generator tests drive the timeline withTimeline.run_due/1in the test process, so their log reads are not affected.