Repository navigation
Commit ff4686c
committed
test(tools): drive the guardedWrite double's abort through requestAbort
Task.abort became a get-only accessor on main. 5319fe9 ("refactor(task): read abort and abortReason
from run-state latches", landed 2026-11-08T16:18:32Z) declares main's Task.ts:3582 as
'get abort(): boolean { return abort(this.runState) }' fed by runState.ts:188, with requestAbort as the
write surface. compile typechecks the checkout CI produces, which is refs/pull/1408/merge - main plus
this branch - and in that tree this file's two 'task.abort = true' lines are assignments to a getter, even
though they are legal against this branch's Task, which still carries the mutable field at Task.ts:397. The
failing step was 'Check types' (pnpm check-types, exit 2) with 'Check formatting' and 'Lint' green ahead of
it, and the whole diagnostic set was:
core/tools/__tests__/guardedWrite.spec.ts(745,9): error TS2540: Cannot assign to 'abort' because it is a
core/tools/__tests__/guardedWrite.spec.ts(759,9): error TS2540: Cannot assign to 'abort' because it is a
The parent 0c07c5b ran the same step as a cache miss with zero TS errors because its merge ref predated
the 16:18 landing, so the file and its lines are unchanged between the clean run and the red one.
The double now carries requestAbort and both rows call it rather than writing the field, because that is the
entry point production calls and it does not depend on which of the two Task shapes the tree happens to
carry. guardedWrite.ts:420 reads task.abort and nothing in this file asserts abandoned, so the double's
method sets the flag guardedWrite consults and carries abandoned only to match the method it replaces; the
comment at :63-77 names the accessor and the kernel line so the next reader does not have to rediscover the
split between the two trees.
Control. With the double's requestAbort changed so it no longer sets the flag, the file is 2 failed | 40
passed (42): 'does not publish a queued write after the issuing task is disposed' red at spec.ts:763 with
'promise resolved "undefined" instead of rejecting', and 'refuses an already-cancelled task's write before
any I/O' red at spec.ts:775 with 'expected [Function] to throw error matching /was cancelled/'. So both
rows still prove the cancellation they name rather than trusting the call's name. Against the shipped
source the file is 42 passed (42) in the branch tree and 42 passed (42) in the merged tree, and
safeWriteText is 46 passed (46) in both.
Typecheck in both directions, because that is the proof this class of red needs. tsc --noEmit in the merged
tree before the change exits 2 with exactly the two TS2540 errors above; after the change it exits 0 with no
diagnostics. tsc --noEmit in the branch tree exits 0 before and after, which is precisely why a branch-tree
typecheck cannot catch this: the property is mutable in that tree by construction. The merged tree used here
is git merge-tree of main 5319fe9 and this branch - tree c7ee6ae, conflict-free - checked out into
a scratch worktree with the usual node_modules junctions, which is the content CI's merge ref holds.
+21/-6 in this one spec file - 7 executable lines, 14 comment lines, no blank lines, no production file
touched. Measured with .tmp-node22 node v22.23.4. eslint --prune-suppressions --max-warnings=0 on the file
exits 0 with src/eslint-suppressions.json restored byte-for-byte, and repo-root prettier --check on the file
exits 0.1 parent 8fff59a commit ff4686c
1 file changed
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
73 | 88 | | |
74 | 89 | | |
75 | 90 | | |
| |||
737 | 752 | | |
738 | 753 | | |
739 | 754 | | |
740 | | - | |
741 | | - | |
| 755 | + | |
| 756 | + | |
742 | 757 | | |
743 | 758 | | |
744 | 759 | | |
745 | | - | |
| 760 | + | |
746 | 761 | | |
747 | 762 | | |
748 | 763 | | |
| |||
756 | 771 | | |
757 | 772 | | |
758 | 773 | | |
759 | | - | |
| 774 | + | |
760 | 775 | | |
761 | 776 | | |
762 | 777 | | |
| |||
0 commit comments