Commit 9927147
committed
Tests: event-driven conflict responder, sink-derived prompt counts
- Replace both copies of the racy polling `spawn_conflict_responder` (in `volume_merge_tests.rs` and `volume_rename_merge_tests.rs`) with one shared `ConflictResponderSink` in `conflict_responder_test_support.rs`. The sink wraps a `CollectorEventSink`, forwards every event, and answers a Stop-mode prompt synchronously the instant it observes the `write-conflict` event — no 2 ms polling loop, no parallel `AtomicUsize` answer counter.
- Switch every `answered`-based assertion to sink-derived counts via `file_conflict_count(&events.inner)`. Counts are authoritative once the op future returns, and the assertions got stronger: the deep-clash test now pins the file-conflict count AND the path/flag shape, not just a counter.
- Make the responder design sound by storing the oneshot sender BEFORE emitting the `write-conflict` event in `volume_conflict.rs`'s Stop branch. Previously the emit ran before the store, so a sink taking the sender inside `emit_conflict` would miss; storing first makes the take race-free for both the test sink and the real FE responder.
- Drop the obsolete "spawn_conflict_responder must bump its counter before send" gotcha in `transfer/CLAUDE.md`; replace with a one-liner naming the responder-sink pattern.
- Determinism: the previously-flaky case-fold and stop-clash tests now pass 40x at `-j 8`; the design is order-independent.1 parent af25aa8 commit 9927147
6 files changed
Lines changed: 164 additions & 114 deletions
File tree
- apps/desktop/src-tauri/src/file_system/write_operations/transfer
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
Lines changed: 111 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
199 | 209 | | |
200 | 210 | | |
201 | 211 | | |
| |||
210 | 220 | | |
211 | 221 | | |
212 | 222 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
| |||
Lines changed: 23 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 97 | | |
128 | 98 | | |
129 | 99 | | |
| |||
169 | 139 | | |
170 | 140 | | |
171 | 141 | | |
172 | | - | |
173 | | - | |
174 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
175 | 151 | | |
176 | 152 | | |
177 | 153 | | |
| |||
190 | 166 | | |
191 | 167 | | |
192 | 168 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | 169 | | |
197 | 170 | | |
198 | 171 | | |
| |||
224 | 197 | | |
225 | 198 | | |
226 | 199 | | |
227 | | - | |
| 200 | + | |
228 | 201 | | |
229 | 202 | | |
230 | 203 | | |
| |||
457 | 430 | | |
458 | 431 | | |
459 | 432 | | |
460 | | - | |
461 | | - | |
462 | | - | |
| 433 | + | |
463 | 434 | | |
464 | 435 | | |
465 | 436 | | |
| |||
477 | 448 | | |
478 | 449 | | |
479 | 450 | | |
480 | | - | |
481 | 451 | | |
| 452 | + | |
| 453 | + | |
482 | 454 | | |
483 | | - | |
| 455 | + | |
484 | 456 | | |
485 | 457 | | |
486 | 458 | | |
| |||
491 | 463 | | |
492 | 464 | | |
493 | 465 | | |
494 | | - | |
| 466 | + | |
495 | 467 | | |
496 | 468 | | |
497 | 469 | | |
| |||
725 | 697 | | |
726 | 698 | | |
727 | 699 | | |
728 | | - | |
729 | | - | |
730 | | - | |
| 700 | + | |
731 | 701 | | |
732 | 702 | | |
733 | 703 | | |
| |||
749 | 719 | | |
750 | 720 | | |
751 | 721 | | |
752 | | - | |
753 | 722 | | |
754 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
755 | 726 | | |
756 | 727 | | |
757 | 728 | | |
| |||
790 | 761 | | |
791 | 762 | | |
792 | 763 | | |
793 | | - | |
794 | | - | |
795 | | - | |
| 764 | + | |
796 | 765 | | |
797 | 766 | | |
798 | 767 | | |
| |||
814 | 783 | | |
815 | 784 | | |
816 | 785 | | |
817 | | - | |
818 | 786 | | |
819 | 787 | | |
820 | 788 | | |
| |||
0 commit comments