Repository navigation
Commit e36a779
committed
fix(tools,diff-view): decide adoption from the owned placeholder, and bind a relative alias to the workspace
A create session whose pre-open snapshot was a partial read lost adoption (CR thread
4474468493, minor). f95c7b4 gated the create-placeholder exception inside the null
branch, so the completeness check still ran first for a session whose
preOpenObservation describes a file that was already gone: the model read a slice,
the file was removed, open() took the create path and replaced the registry entry
with the verified empty placeholder marked complete, Auto Save wrote the accepted
bytes, the guard rejected with GuardStaleVersionError (the completeness gate never
ran, because the registry holds the complete placeholder observation), and adoption
was refused - a failure reported for a new file that already held the accepted
bytes, with no cleanup able to unlink a file that is no longer the empty placeholder.
Ownership is now decided first: a session that owns its placeholder adopts iff the
rejection is the moved compare-and-swap token, and the refusals apply to the sessions
that do not own one. Same reason gate as before; two consequences, both fail-closed:
a create session whose rejection is not the moved token now refuses even for an edit
kind or with no snapshot at all, which previously fell through to adoption.
- control: previous head's ordering restored -> 2 failed | 184 passed (186), the two
failures being the new trigger test and its predicate pin, "expected false to be
true"; ownership branch ungated -> 2 failed | 184 passed on the two not-a-moved-token
pins, "expected true to be false". Both mutants reverted byte-identically.
- new tests: the thread's trigger through saveChanges() (partial read -> file removed
-> create -> Auto Save -> accept resolves, unlinks nothing, observation moves to the
version on disk) and the predicate pin for the same combination.
Containment for a relative alias that canonicalizes outside the workspace (panel
Security Boundaries, third wording). A different objection from the one f95c7b4
answered: that row was the lexical fallback when realpath failed; this one is that an
alias which canonicalizes OUTSIDE - the ordinary shape is a link directory inside the
workspace whose referent is elsewhere - is read by the containment clause as an
intentional outside-workspace write, because the clause only binds the retained target
when the alias looks inside. For a path the caller named relative to task.cwd that is
not an authorization: the spelling is workspace-scoped, so the alias's own containment
is now checked and fails closed, naming the reconstructed canonical path the model has
to re-read. An absolute caller path keeps its own authorization and still publishes to
an outside referent, which is what the tool layer approved.
- control: fail-closed check removed -> 1 failed | 77 passed (78), the escaping-alias
test resolves instead of rejecting ("promise resolved \"'v1'\" instead of
rejecting") - the bypass, reproduced; the reconstruction joined without reverse() ->
1 failed | 77 passed, the rejection named the components in the wrong order.
Coverage for multi-component ancestor reconstruction (CR thread 4474468483, trivial):
rejection when only the canonical workspace root resolves and a retained target sits
outside it, acceptance for a retained target under the reconstructed
canonicalRoot/sub/deeper/new-file.txt, and the outside-referent case above, which is
what actually pins the ordered re-join.
Gates (split-1833/u8, verified real node_modules): tsc --noEmit 0; eslint
--prune-suppressions --max-warnings=0 clean on all four touched files with
src/eslint-suppressions.json unchanged from HEAD (the prune rewrites only line order and
endings - 1452 lines, identical sorted content - and HEAD's bytes were restored);
prettier --check clean; DiffViewProvider.spec 186, guardedWrite.spec 78, Task
dispose/observationRegistry/throttle 34. Mutation coverage still absent: the branch is
over the 500 changed-executable-line cap, so these carry negative controls only.1 parent f95c7b4 commit e36a779
4 files changed
Lines changed: 199 additions & 29 deletions
File tree
- src
- core/tools
- __tests__
- integrations/editor
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
1226 | 1339 | | |
1227 | 1340 | | |
1228 | 1341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
573 | 590 | | |
574 | 591 | | |
575 | 592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
731 | 739 | | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
| 740 | + | |
743 | 741 | | |
744 | 742 | | |
745 | 743 | | |
| |||
752 | 750 | | |
753 | 751 | | |
754 | 752 | | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | 753 | | |
761 | 754 | | |
762 | 755 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2634 | 2634 | | |
2635 | 2635 | | |
2636 | 2636 | | |
2637 | | - | |
| 2637 | + | |
2638 | 2638 | | |
2639 | | - | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
2640 | 2643 | | |
2641 | | - | |
2642 | | - | |
| 2644 | + | |
2643 | 2645 | | |
| 2646 | + | |
| 2647 | + | |
2644 | 2648 | | |
2645 | 2649 | | |
2646 | 2650 | | |
| |||
2699 | 2703 | | |
2700 | 2704 | | |
2701 | 2705 | | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
2702 | 2749 | | |
2703 | 2750 | | |
2704 | 2751 | | |
| |||
0 commit comments