Repository navigation
Commit 89c1bd8
committed
test(write-to-file): pin the directory release against the reset on the early exits
The row asked for the removal-before-reset ordering on the teardowns that did not assert it: the cancellation teardown and the setup-window catch. What they can assert is not what the early-exit and validation-rejection paths can, and the reason is in the code. releaseEarlyDirectories() returns early while a session is editing (WriteToFileTool.ts:170-172). The early-exit release runs the removal and then the reset (:225 before :226) and the validation-rejection release does the same (:148 before :149), so there the pair really co-occurs and the order is the claim. teardownCancelledPreview() resets inside the isEditing branch (:197) and only then reaches the guarded release (:199), and the setup-window catch releases at :784 and resets only inside the same isEditing branch (:786-788). On those two paths the removal and the reset belong to opposite states: the reset runs only while the session edits, the removal only while it does not. What can be pinned there is that the tool never reaches past a live session for a list its provider still owns - which is now asserted at writeToFileTool.spec.ts:1160, :1193, :1762 and :1802, joining :1834, which already did it for the state-rejection variant of the setup window.
The order itself goes where it is observable and was uncovered: the missing-parameter exit. The two existing missing-parameter tests (:1009, :1050) both run with a session editing, so the removal never runs there. The new test at :1081 drives the same exit with no session and a non-empty adopted list, and asserts the removal once, the reset once, removal.invocationCallOrder[0] < reset.invocationCallOrder[0] (:1119), no discard on that branch, the stream state released and the model still receiving the missing-parameter result.
Controls, each installed alone and restored byte-equal (restore byte-equal reported true for both):
- Order flipped: swapping :225 and :226 in WriteToFileTool.ts so the reset precedes the release gives 3 failed | 73 passed | 5 skipped, and every failure is an ordering comparison - "expected 526 to be less than 525", "expected 555 to be less than 554" (this commit's assertion at :1119) and "expected 698 to be less than 697". Nothing failed on a count, a message or an incidental mismatch.
- Removal allowed to run after the reset: deleting the guard at :170-172 gives 5 failed | 71 passed | 5 skipped - the two cancellation tests, the two setup-window tests and :1834's test - each with "expected \u0022vi.fn()\u0022 to not be called at all, but actually been called 1 times". That is the shape of a release that runs after the reset has already dropped the list.
Production code is untouched: this commit changes only src/core/tools/__tests__/writeToFileTool.spec.ts. Gates on the tree as committed: prettier --check exit 0, eslint --max-warnings=0 exit 0 on the spec, tsc --noEmit -p tsconfig.json exit 0, focused spec 76 passed | 5 skipped (was 75 | 5). The core vitest shard was re-run against this identical tree after the commit; its result is in the round log rather than here.
Local Stryker preflight before this push: not run.1 parent 1670ac2 commit 89c1bd8
1 file changed
Lines changed: 71 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1081 | 1131 | | |
1082 | 1132 | | |
1083 | 1133 | | |
1084 | 1134 | | |
1085 | 1135 | | |
1086 | 1136 | | |
1087 | 1137 | | |
| 1138 | + | |
| 1139 | + | |
1088 | 1140 | | |
1089 | 1141 | | |
1090 | 1142 | | |
| |||
1100 | 1152 | | |
1101 | 1153 | | |
1102 | 1154 | | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1103 | 1161 | | |
1104 | 1162 | | |
1105 | 1163 | | |
| |||
1116 | 1174 | | |
1117 | 1175 | | |
1118 | 1176 | | |
| 1177 | + | |
1119 | 1178 | | |
1120 | 1179 | | |
1121 | 1180 | | |
| |||
1129 | 1188 | | |
1130 | 1189 | | |
1131 | 1190 | | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
1132 | 1194 | | |
1133 | 1195 | | |
1134 | 1196 | | |
| |||
1677 | 1739 | | |
1678 | 1740 | | |
1679 | 1741 | | |
| 1742 | + | |
1680 | 1743 | | |
1681 | 1744 | | |
1682 | 1745 | | |
| |||
1693 | 1756 | | |
1694 | 1757 | | |
1695 | 1758 | | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
1696 | 1763 | | |
1697 | 1764 | | |
1698 | 1765 | | |
| |||
1716 | 1783 | | |
1717 | 1784 | | |
1718 | 1785 | | |
| 1786 | + | |
1719 | 1787 | | |
1720 | 1788 | | |
1721 | 1789 | | |
| |||
1729 | 1797 | | |
1730 | 1798 | | |
1731 | 1799 | | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
1732 | 1803 | | |
1733 | 1804 | | |
1734 | 1805 | | |
| |||
0 commit comments