Repository navigation
Commit 23f42de
fix(u5): stop a recovery from rolling back an edit it no longer owns
#1930 row 4505100232 (src/integrations/editor/DiffViewProvider.ts:1182 at 22969c6).
attemptRollbackRecovery() installs the captured edit, awaits the buffer's re-acquisition, and then
runs revertChanges(). The install is not a reservation: while that acquisition is awaited, the retry
the refused rollback is waiting for can open a different target on the same provider, and open()
overwrites relPath, editType, createdDirs and originalContent. revertChanges() reads this class
fields rather than the record it was handed, so a recovery that finished its await unchecked restored
and saved the other edit's content into the other edit's target and tore a live edit down - the
recovery never stops on its own, it just stops being about the edit it started from.
The recovery is now bound to the edit it started from. Ownership - this edit's target still installed
as this edit's type - is re-checked when the acquisition settles, and a recovery that lost the
provider returns the same false the caller already keeps refusing on, leaves the live edit's state
alone rather than rolling it back to what this recovery found, and does not install the editor it
managed to acquire into that edit's slot. The baseline is not part of ownership: a later flow
replacing originalContent is the diff-side question the acquisition's own capture at :1182 answers,
so the guard names target and edit type and nothing else.
Two cases in DiffViewProvider.spec.ts: a retry taking the provider for another target mid-acquisition
(recovery reports false, nothing is restored or saved for either path, and the live edit keeps its own
target, baseline and editor slot), and the provider being cleared again mid-acquisition (recovery
reports false and drops the editor it acquired rather than installing it). With the component reverted
to 22969c6 those two are the only failures - the first resolves true because the rollback ran on the
other edit's state, the second leaves the acquired editor installed - and the other 97 pass; the
component was put back byte-for-byte afterwards.
Measured on the pinned runtime v22.23.4: 99 passed (99) in the focused spec, 107 passed across
integrations/editor, the misc shard 2120 passed / 13 skipped and the core shard 4294 passed / 9
skipped both exiting 0 with an empty FAIL-set, tsc --noEmit -p tsconfig.json clean, eslint
--max-warnings=0 clean on both touched files, prettier clean, eslint-suppressions unchanged at 265
files / 2870 entries and that file not dirty. NO local Stryker preflight ran for this commit.1 parent 22969c6 commit 23f42de
2 files changed
Lines changed: 111 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
600 | 606 | | |
601 | 607 | | |
602 | 608 | | |
| |||
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
| 638 | + | |
632 | 639 | | |
633 | | - | |
| 640 | + | |
634 | 641 | | |
| 642 | + | |
635 | 643 | | |
636 | 644 | | |
637 | 645 | | |
638 | 646 | | |
639 | 647 | | |
640 | 648 | | |
641 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
642 | 673 | | |
643 | 674 | | |
644 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2606 | 2606 | | |
2607 | 2607 | | |
2608 | 2608 | | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
2609 | 2688 | | |
2610 | 2689 | | |
2611 | 2690 | | |
| |||
0 commit comments