Repository navigation
Commit 6702cc0
abort-merge
fix(diff-view): give a recovery the edit it was asked to undo, not just its target
attemptRollbackRecovery() protected a live edit by comparing the target and the mode:
the resolved relPath against the record absolutePath, and editType against the record
editType. Those two fields say which file is being edited and in which mode. They do not
say which attempt is doing it, and that is the whole hole: a retry that reopens the same
file as the same kind of edit installs values identical in both, so a recovery waiting on
a refused rollback accepted that retry as its own install, restored its own baseline into
the buffer the retry had reopened, saved it, and reported a clean rollback over an edit it
was never asked to undo. Same loss the ownership guards were written to prevent, narrower
window, same missing information.
Every install now stamps a session. captureRollbackRecoveryContext() records the stamp of
the install it snapshots, attemptRollbackRecovery() carries the record stamp through its own
re-install - the install is that recovery performing the edit the record describes - and all
three ownership questions (the live edit, the failed acquisition, the settled acquisition)
require the stamp unchanged alongside the target and the mode they already compared.
originalContent and createdDirs differ in value between two sessions but neither is an
identity: comparing them would confuse same bytes with same session, so they stay out of
the ownership question.
Reverting the record own session is untouched, and the new same-session case pins it: the
live-edit branch still restores and saves exactly as before.
Tests: four cases in the recovery suite - a same-file retry live under a newer session is
left alone, a same-session live edit still reverts, a same-file reinstall during the
acquisition refuses and keeps its own editor, directories and baseline, and a same-file
reinstall followed by a rejected acquisition rethrows without writing this recovery own
captured fields over it. Control with DiffViewProvider.ts restored byte-for-byte from
e10d9d6 and the cases kept: the three newer-session cases fail (expected true to be false,
expected true to be false, expected false to be true); the same-session case passes either
way, so it is stated as a guard on what the stamp must not refuse rather than as proof of
the stamp.
Gates: focused spec 107 passed (107); integrations/editor 115 passed (115); misc shard 117
files 2128 passed | 13 skipped; core shard 198 files 4294 passed | 9 skipped; writeToFileTool,
writeToFileTool partial-state and stream-cleanup specs 78 passed | 5 skipped; tsc --noEmit -p
src/tsconfig.json clean; eslint --max-warnings=0 clean on the four touched files with
eslint-suppressions.json unchanged; prettier --check clean. Local Stryker preflight not run.1 parent e10d9d6 commit 6702cc0
4 files changed
Lines changed: 220 additions & 3 deletions
File tree
- src
- core
- assistant-message/__tests__
- tools/__tests__
- integrations/editor
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
206 | 209 | | |
207 | 210 | | |
208 | 211 | | |
| |||
1308 | 1311 | | |
1309 | 1312 | | |
1310 | 1313 | | |
| 1314 | + | |
1311 | 1315 | | |
1312 | 1316 | | |
1313 | 1317 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
| |||
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
110 | 122 | | |
111 | 123 | | |
112 | 124 | | |
| |||
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
120 | 136 | | |
121 | 137 | | |
122 | 138 | | |
| |||
582 | 598 | | |
583 | 599 | | |
584 | 600 | | |
| 601 | + | |
585 | 602 | | |
586 | 603 | | |
587 | 604 | | |
| |||
609 | 626 | | |
610 | 627 | | |
611 | 628 | | |
612 | | - | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
613 | 638 | | |
614 | 639 | | |
615 | 640 | | |
| |||
621 | 646 | | |
622 | 647 | | |
623 | 648 | | |
| 649 | + | |
624 | 650 | | |
625 | 651 | | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
626 | 656 | | |
627 | 657 | | |
628 | 658 | | |
| |||
651 | 681 | | |
652 | 682 | | |
653 | 683 | | |
654 | | - | |
| 684 | + | |
| 685 | + | |
655 | 686 | | |
656 | 687 | | |
657 | 688 | | |
| |||
661 | 692 | | |
662 | 693 | | |
663 | 694 | | |
| 695 | + | |
664 | 696 | | |
665 | 697 | | |
666 | 698 | | |
| |||
679 | 711 | | |
680 | 712 | | |
681 | 713 | | |
682 | | - | |
| 714 | + | |
| 715 | + | |
683 | 716 | | |
684 | 717 | | |
685 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2469 | 2469 | | |
2470 | 2470 | | |
2471 | 2471 | | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
2472 | 2475 | | |
2473 | 2476 | | |
2474 | 2477 | | |
| |||
2638 | 2641 | | |
2639 | 2642 | | |
2640 | 2643 | | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
2641 | 2647 | | |
2642 | 2648 | | |
2643 | 2649 | | |
| |||
2700 | 2706 | | |
2701 | 2707 | | |
2702 | 2708 | | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
2703 | 2712 | | |
2704 | 2713 | | |
2705 | 2714 | | |
| |||
2760 | 2769 | | |
2761 | 2770 | | |
2762 | 2771 | | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
2763 | 2940 | | |
2764 | 2941 | | |
2765 | 2942 | | |
| |||
2772 | 2949 | | |
2773 | 2950 | | |
2774 | 2951 | | |
| 2952 | + | |
2775 | 2953 | | |
2776 | 2954 | | |
2777 | 2955 | | |
| |||
0 commit comments