Repository navigation
Commit ba7b046
committed
fix(web/shell): #107 review — a case-only rename on a folder that ignores case is refused whole, never a deletion
The bug. A folder on macOS or Windows (the usual File System Access folder) does not tell upper and lower case
apart, nor an accent written as one character from one written as a letter and a combining mark, and the base
answers for A.txt with what it has at a.txt. The overlay keys paths by their spelling, so `mv a.txt A.txt` staged
"A.txt, the bytes the base already has there" (judged no change) and "a.txt removed", and the change set was only
`delete a.txt`. The visitor's terminal deleted the file straight from the folder; an agent run sent the deletion
to the review. The commit layers' case checks could not see it: the write they compare with had already gone.
Reproduced through the real engine on a case-insensitive workspace before the fix: `mv a.txt A.txt` (file gone),
`mv src/a.txt SRC/a.txt`, `mv a.txt t.txt; mv t.txt A.txt`, `rm a.txt; echo new > A.txt`, `rm -r src; echo n >
SRC/new.txt`, NFD to NFC (all lose data); `mv d D` of a folder (the engine sees D as there and moves d into it:
applied 3 of 4, as d/d/f.txt); `cp a.txt A.txt` (nothing, status 0).
The fix (overlay-fs.js, spellingClash, asked by changes() before the set is worked out). The spellings a command
used (what it staged, what the base answered for, and every folder above them) are grouped by case- and
accent-folded text; only a group of two or more spellings, one of them changed by the command, is looked at, so a
command without such a pair asks the base nothing more. For those the base decides: each spelling is resolved name
by name against its folder's listing, and two spellings that are one entry there (or one that the base answers
for and that cannot be matched to exactly one listed name) refuse the whole set as `incomplete`, with both names
and how to do it instead (two commands). A folder that tells case apart keeps two names as two files, and its
case-only rename stays a write and a delete for the commit to judge. One spelling of an entry is not refused:
`echo x > A.txt` changes a.txt and `rm A.txt` removes it, as that disk does. Refused although a disk would have
managed: reading under one spelling and changing under another in one command (`cat A.txt; rm a.txt`).
Tests. shell-engine-overlay.test.js, over a base that ignores case and accent form: mv a.txt A.txt is refused and
names both; eight ways of reaching one entry by two spellings are refused and the disk is unchanged (one of them
names the folder two levels up, which only the folders-above part of the check sees); a name the
base answers for that matches no single listed name is refused ("may be"); and pins that must not move: one
spelling per entry, reads under two spellings, no extra base call without a pair, and a case-sensitive base.
shell-runtime-engine.test.js, the real engine core through the runtime and commit.js over the Map workspace with
the new `ignoreCase` (test/helpers/shell-runtime-fakes.js): the terminal's mv a.txt A.txt and mv d D are refused
and nothing moves, echo > A.txt lands in a.txt, the two-command rename works; the agent's review is never handed
the deletion. The five tests aimed at the bug fail on 187fd21 (the change set was `delete /w/a.txt`; in the
terminal the file was gone) and pass here; the pins pass on both. NOTES.md §5/§6/§8 and docs/WEB.md say what the
engine now refuses and what it still does not emulate.1 parent 6c57cef commit ba7b046
6 files changed
Lines changed: 302 additions & 9 deletions
File tree
- docs
- web
- shell/engine
- test
- helpers
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
539 | | - | |
540 | | - | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
541 | 554 | | |
542 | 555 | | |
543 | 556 | | |
| |||
654 | 667 | | |
655 | 668 | | |
656 | 669 | | |
657 | | - | |
658 | | - | |
| 670 | + | |
| 671 | + | |
659 | 672 | | |
660 | 673 | | |
661 | 674 | | |
| |||
679 | 692 | | |
680 | 693 | | |
681 | 694 | | |
682 | | - | |
| 695 | + | |
683 | 696 | | |
684 | 697 | | |
685 | 698 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1107 | 1107 | | |
1108 | 1108 | | |
1109 | 1109 | | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
1110 | 1116 | | |
1111 | 1117 | | |
1112 | 1118 | | |
| |||
1116 | 1122 | | |
1117 | 1123 | | |
1118 | 1124 | | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
1119 | 1203 | | |
1120 | 1204 | | |
1121 | 1205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| |||
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
105 | 123 | | |
106 | 124 | | |
107 | 125 | | |
| |||
121 | 139 | | |
122 | 140 | | |
123 | 141 | | |
124 | | - | |
| 142 | + | |
125 | 143 | | |
126 | 144 | | |
127 | 145 | | |
| |||
0 commit comments