Repository navigation
test(sync): SameValuePatchKeepsTheChainTest waits on conditions, not clocks (#3530 follow-up) - #3531
Conversation
…t parses Copilot's two nits: the fixed Task.Delay waits become bounded waits on the observable facts (a frame was posted; the subscription replayed) under TestTimeouts.Convergence, and Payload disposes its JsonDocument after cloning the root. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
It introduces an unsafe TaskCompletionSource construction (missing RunContinuationsAsynchronously) that can inline-resume continuations and create scheduler-holding/reentrancy hazards.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Follow-up test hardening for the sync regression covered in #3530/#3520, replacing clock-based sleeps with bounded waits on observable conditions and ensuring JSON payload creation doesn’t keep JsonDocument alive longer than needed.
Changes:
- Dispose
JsonDocumentinPayload(...)after cloning the root element. - Replace
Task.Delaysleeps with bounded waits on observable facts (postedadvancing / subscription replay completing) underTestTimeouts.Convergence.
File summaries
| File | Description |
|---|---|
| test/MeshWeaver.Data.Test/SameValuePatchKeepsTheChainTest.cs | Replaces fixed sleeps with condition-based waits and fixes JsonDocument lifetime in payload helper. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| using var emissions = mirror.Subscribe(_ => Interlocked.Increment(ref emitted)); | ||
| await Task.Delay(200); // the subscription replays the current value; count only what follows | ||
| Interlocked.Exchange(ref emitted, 0); | ||
| var replayed = new TaskCompletionSource(); |
Test Results (shard 1)492 tests 492 ✅ 31s ⏱️ Results for commit 3687eb6. |
Test Results (shard 0)251 tests 251 ✅ 2m 33s ⏱️ Results for commit 3687eb6. |
Test Results (shard 3)1 034 tests 1 034 ✅ 1m 11s ⏱️ Results for commit 3687eb6. |
Test Results (shard 4)1 600 tests 1 406 ✅ 2m 5s ⏱️ Results for commit 3687eb6. |
Test Results (shard 5) 5 files 5 suites 2m 7s ⏱️ Results for commit 3687eb6. |
Test Results (shard 2)1 079 tests 1 079 ✅ 3m 28s ⏱️ Results for commit 3687eb6. |
Test Results 16 files 16 suites 11m 56s ⏱️ Results for commit 3687eb6. |
Follow-up to #3530 (merged as b75f501 while the two Copilot review comments were still open — the queued branch refused the push).
Task.Delaywaits become bounded waits on the observable facts (a frame was posted; the subscription replayed) underTestTimeouts.Convergence.Payloaddisposes itsJsonDocumentafter cloning the root.No behaviour change; the test still fails on the pre-#3530 code with a second
SubscribeRequest.🤖 Generated with Claude Code