Repository navigation
Commit 802352d
committed
S4b (Zoo-Code-Org#1375): a committed publish is not undone by a cancellation
The guarded path already treats the commit as the point of no return - that is
what CommittedWriteBufferConflictError names - but revertChanges() did not. The
modify branch wrote originalContent back through an unguarded
updatedDocument.save(), the one writer left using the call the comment above
saveChanges says every other path avoids, and the create branch unlinked a file
the session had just published with no version check on either. A cancellation
that landed after the publish therefore replaced accepted content with the
pre-edit bytes, or deleted the accepted file, and the caller was told neither.
revertChanges() now keeps a committed publish: it clears the dirty flag from the
published bytes only while the buffer still holds exactly what landed (text typed
after the accept survives), tidies the session as before, and reports
CommittedWriteBufferConflictError with a detail line naming the window. The same
error now carries that detail at the two saveDirectly sites, the diff-view save
and the move, so one name and one set of no-retry instructions covers every
committed-write conflict instead of three windows describing it three ways.
saveChanges() stopped discarding revertDocument's verdict. A buffer that stays
dirty after close-and-reopen holds the bytes the guard published, so the save
closes it, reopens from the published bytes and reports the conflict instead of
proceeding into the save-over and returning ordinary success. saveDirectly already
honoured the verdict; the asymmetry was the bug.
open() creates the placeholder with wx: the absence above it is a classification,
not a reservation, and a plain write truncated a file that won the race, after
which the stat-matched observation described content open() never wrote. A lost
race is reported rather than absorbed.
apply_patch names the half-applied move: the destination committed, the source
unlink never ran, so both paths appear in the report and the shared no-retry
guidance stays attached, because the model's next instinct is to re-apply the patch.
Gates: DiffViewProvider 168 passed (5 rows new), applyPatchTool.execute 33 passed
(1 new), revertChanges callers (writeToFileTool, editFileTool, editTool,
searchReplaceTool) 113 passed | 5 skipped, applyDiff guardedWrite + failureReporting
+ apply-patch + guardedWrite 116 passed, task abort races 9 passed. No
it.runIf(win32) gate anywhere. eslint --prune-suppressions --max-warnings=0 exit 0
on all five touched files with src/eslint-suppressions.json identical to HEAD;
prettier --check clean; tsc --noEmit -p . shows only the local junction diagnostic
(activate/registerCommands.ts(88,102) TS2739).
Controls, each failing for the reason its row describes: committed rule forced
off -> the two new revertChanges rows report 'expected undefined to be an instance
of CommittedWriteBufferConflictError' and the three teardown-ownership rows report
'expected fulfilled to be rejected'; rule forced on -> the pre-commit restore row
plus 12 rows that depend on the restore path fail; verdict observed but ignored ->
only the new saveChanges row fails; placeholder written without wx -> the four
placeholder rows fail on the call shape, and dropping only the EEXIST translation
fails the new race row on the message; move wrapper removed -> the new apply_patch
row fails on the missing source path.
Three pre-existing rows changed by design rather than to make them green: the three
teardown-ownership rows now hold the cancellation's outcome (Promise.allSettled plus
an instanceof check) because their scenario is a cancellation landing after the
publish; their serialization, preview-restore and single-finalization assertions are
untouched. Three open() rows assert the wx call shape for the same reason.
Surfaced for the owner, not fixed here: Task.ts:3799 swallows revertChanges with
.catch(console.error) on the disposal path while Task.ts:4168 propagates it on the
abort path, so disposal will not see this signal. Whether disposal should swallow a
'committed, not undone' report is the disposal contract owner's call.
Review rows 4507760734, 4507764622, 4507851689, 4507851696, 4507851698, 4507855182.1 parent a150900 commit 802352d
5 files changed
Lines changed: 372 additions & 29 deletions
File tree
- src
- core/tools
- __tests__
- integrations/editor
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
623 | 624 | | |
624 | 625 | | |
625 | 626 | | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
639 | 656 | | |
640 | 657 | | |
641 | 658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
737 | 738 | | |
738 | 739 | | |
739 | 740 | | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
740 | 779 | | |
741 | 780 | | |
742 | 781 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
131 | 140 | | |
132 | 141 | | |
133 | 142 | | |
| |||
237 | 246 | | |
238 | 247 | | |
239 | 248 | | |
240 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
241 | 266 | | |
242 | 267 | | |
243 | 268 | | |
| |||
637 | 662 | | |
638 | 663 | | |
639 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
640 | 668 | | |
641 | 669 | | |
642 | 670 | | |
| |||
778 | 806 | | |
779 | 807 | | |
780 | 808 | | |
781 | | - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
782 | 828 | | |
783 | 829 | | |
784 | 830 | | |
| |||
976 | 1022 | | |
977 | 1023 | | |
978 | 1024 | | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
979 | 1034 | | |
980 | 1035 | | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
981 | 1056 | | |
982 | 1057 | | |
983 | 1058 | | |
| |||
1058 | 1133 | | |
1059 | 1134 | | |
1060 | 1135 | | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1061 | 1146 | | |
1062 | 1147 | | |
1063 | 1148 | | |
| |||
1788 | 1873 | | |
1789 | 1874 | | |
1790 | 1875 | | |
| 1876 | + | |
1791 | 1877 | | |
1792 | 1878 | | |
1793 | 1879 | | |
| |||
1848 | 1934 | | |
1849 | 1935 | | |
1850 | 1936 | | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
1851 | 1940 | | |
1852 | 1941 | | |
1853 | 1942 | | |
| |||
1867 | 1956 | | |
1868 | 1957 | | |
1869 | 1958 | | |
1870 | | - | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
1871 | 1963 | | |
1872 | 1964 | | |
1873 | 1965 | | |
| |||
1885 | 1977 | | |
1886 | 1978 | | |
1887 | 1979 | | |
1888 | | - | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
1889 | 1985 | | |
1890 | 1986 | | |
1891 | | - | |
| 1987 | + | |
1892 | 1988 | | |
1893 | 1989 | | |
1894 | 1990 | | |
| |||
0 commit comments