Repository navigation
Commit c1e7d46
committed
fix(web/shell): #107 review — a command's change to the second of two folders called proj is not written into the first
The runtime tells same-named folders apart (planMounts mounts /a/proj and /b/proj each at its own root), but a
command's change reaches the review as `name/rel` (reviewPathFor), and the review finds a folder by name:
resolveWorkspacePathAsync takes the FIRST folder called proj. So a change to /b/proj/x.txt was compared with the right
file (readNow reads /b/proj/x.txt) and written into /a/proj/x.txt; a new file was created there too. The same holds
for two folders at one path — the scratch folder and a folder from the computer called scratch
(`levelcode-scratch:/scratch`, `file:///scratch`), whose change paths name neither — and for a folder whose name has a slash in it, which
the resolver reads as a path.
The smallest correct fix is to refuse: the review and the file tools address a file by `name/rel`, and teaching them
to take a folder is a change to the review that edit_file and the desktop share. commitShellChanges now refuses a
change in a folder the review would not find again (folderMixUp): one that shares its root with another folder, whose
name has a slash, or that is not the first folder of its name. The whole set is refused, as for every other refusal,
and the note says why ('another workspace folder is also called "proj", and the review finds a folder by its name: it
would apply this change there'). The first folder of a name is the one the review finds, so its changes go through as
before; folders of distinct names, nested ones included, are unchanged.
Tests: test/shellCommit.test.js "two folders the review cannot tell apart" (same name — a write, a delete and a set
with a change in each folder —, same root, a slash in the name; the first folder of a name, a lone folder with a slash,
and distinct nested names still applied). test/shellSeam.test.js "two workspace folders called proj", through the real
commit hook, with a review stand-in that finds the file exactly as reviewSession.applyEdit does
(resolveWorkspacePathAsync, then host.uriFor): on 187fd21 the two changes to b/proj are written to a/proj/new.txt and
a/proj/x.txt; here nothing is written, and a change to a/proj still lands in a/proj. Both fail before and pass after;
removing any one of the four checks fails one of them. (shellSeam's vscode stand-in gains workspace.fs.stat and
FileType, which the resolver's existence check needs.)1 parent 76a3b92 commit c1e7d46
3 files changed
Lines changed: 117 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
99 | 117 | | |
100 | 118 | | |
101 | 119 | | |
| |||
105 | 123 | | |
106 | 124 | | |
107 | 125 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 126 | + | |
113 | 127 | | |
114 | 128 | | |
115 | 129 | | |
116 | 130 | | |
117 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
118 | 152 | | |
119 | 153 | | |
120 | 154 | | |
| |||
164 | 198 | | |
165 | 199 | | |
166 | 200 | | |
| 201 | + | |
| 202 | + | |
167 | 203 | | |
168 | 204 | | |
169 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
50 | 87 | | |
51 | 88 | | |
52 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
265 | 303 | | |
266 | 304 | | |
267 | 305 | | |
| |||
0 commit comments