Repository navigation
Commit 2fa500a
committed
fix(write-to-file): close the parse-failure and post-commit teardown gaps
This is the U3 unit content re-based onto main's tip 73931fe (sha from ls-remote of
upstream refs/heads/main at the moment of re-basing, not a rev-parse of a local ref), not merged into
it. The parent is main, so this branch is an ancestor of main and the PR diff is the unit's own work:
10 paths, no merge commit, no 105-file refresh riding along.
Why re-base rather than merge. The unit's nine spec hunks land inside src/integrations/editor/
__tests__/DiffViewProvider.spec.ts, which main rewrote onto its typed test harness (main's copy: 1780
lines, 71 titles, 0 'as any', 56 makeTextEditor calls; the branch's copy: 2670 lines, 99 titles, 293
'as any', 3 makeTextEditor calls). Merging forced the two harnesses to coexist; re-basing keeps main's
helper form and ports the unit's assertions onto it, which is what main's rewrite asks for.
What the port changed, so the diff is not a mystery:
- The shared double builder gained a construction-time dirty flag: buildActiveDiffEditor(docOverrides)
passes docOverrides.isDirty into makeTextDocument. The five tests that needed a dirty document now
build one with buildActiveDiffEditor({ isDirty: true }) instead of writing editor.document.isDirty =
true after the fact. That is main's own idiom for a dirty document (its spec passes { isDirty: true }
into makeTextDocument, and its harness has no setter because the type's isDirty is readonly), and it
is equivalent here: the double is not handed to the code under test until after the fixture lines, so
no read of isDirty can observe the difference between constructed-dirty and made-dirty.
- 29 'as any' casts on the branch's copy became bracket writes or typed doubles; the file now has 0.
- The 5 remaining type errors from the merge attempt (TS2540 on the readonly isDirty) are gone.
Verification on this head, all with the pinned pnpm 10.8.1 and hooks running:
- eslint --max-warnings=0 --no-warn-ignored over all 10 paths: exit 0 each, with src/eslint-suppressions
restored to main's blob and no --prune-suppressions, so the claim 'byte-identical to main's
suppressions' is a diffed fact and not an inference.
- pnpm --dir src exec tsc --noEmit: exit 0, 0 errors.
- DiffViewProvider.spec.ts 99 passed (99) - all 99 branch titles survive, 0 lost; writeToFileTool.spec.ts
64 passed | 5 skipped (69); writeToFileTool-partial-state-cleanup.spec.ts 9 passed (9);
removeClineFromStack-delegation.spec.ts 24 passed (24); ClineProvider.spec.ts 339 passed (339).
Branch intent, unchanged by the port - read from the unit's own commit subjects: fail the approved save
when document.save reports false (b97f68e), fail the rollback when the pre-stream restore edit is not
applied (3daf338), fail the existing-file rollback when the revert edit or save reports false
(23213ef), stop a post-commit failure from rolling back a landed write (2a9bfab), plus the
parse-failure and post-commit teardown gaps (5adf7ec).1 parent 73931fe commit 2fa500a
10 files changed
Lines changed: 3024 additions & 134 deletions
File tree
- src
- __tests__
- core
- assistant-message
- tools
- __tests__
- webview
- integrations/editor
- __tests__
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
205 | 246 | | |
206 | 247 | | |
207 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
580 | 589 | | |
581 | 590 | | |
582 | 591 | | |
583 | 592 | | |
584 | 593 | | |
585 | | - | |
| 594 | + | |
586 | 595 | | |
587 | 596 | | |
588 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
589 | 608 | | |
590 | 609 | | |
591 | 610 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| |||
166 | 180 | | |
167 | 181 | | |
168 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
169 | 206 | | |
0 commit comments