Repository navigation
Commit 3159d0a
committed
test(apply-patch): cover the move refusal under both preventFocusDisruption settings
The reviewer on the move-refusal thread asked for a regression covering both
`preventFocusDisruption` settings and confirming that the rejection preserves the source file.
The product was re-measured first, because the answer is not the one the escalation that funded
this implied: the refusal (ApplyPatchTool.ts:594-:643) sits above the
`isPreventFocusDisruptionEnabled` split - guarded `saveDirectly` at :646, raw `fs.mkdir` +
`fs.writeFile` at :727 - so both settings already refuse, and the wording cannot diverge because
there is one statement of the condition. What was missing was coverage: every row in this file ran
with the flag armed on, which left the symmetry a claim about line numbers rather than something a
test had checked.
Three rows, all with the flag off:
- a destination that names the source's file is refused, and neither the mkdir, the writeFile nor
the unlink runs;
- an ordinary flag-off move still publishes through mkdir + fs.writeFile + unlink with the
saveDirectly double unused - that is what pins which branch ran, and it says the refusal has
not become a ban on flag-off moves;
- a destination that is not there reads as "absent", which is not the source, and the move
proceeds.
The harness arms the flag on, and the provider stub captures the getState function by value, so a
row has to change what that function resolves to (`mockGetState.mockResolvedValue`) rather than
re-point the `mockGetState` binding. Re-pointing it compiles, runs green and exercises the guarded
branch; the two must-move rows were green-but-wrong that way until the mechanism was measured, and
it is recorded here because a flag-off row that is secretly flag-on is the kind of green that
survives a review. `mkdir` joins `writeFile` in the `mockedFsPromises` cast, loosely typed for the
same stated reason - both carry overload sets that MockedFunction would collapse.
Controls, as run counts:
- gating the refusal on the flag (`moveRefusal !== undefined && isPreventFocusDisruptionEnabled`),
the asymmetry the row objects to, reddens 1 of 47 and the row it reddens is the flag-off refusal
row. That is a boundary control for this claim.
- removing the refusal statement reddens 5 of 47 (the three consequence rows, the
withheld-identity row and this file's flag-off row). That is a whole-feature revert, not a
control, and it is counted as such.
Shipped tree: 47 passed (47), exit 0. `tsc --noEmit -p .` reports one error, the junction artefact
at activate/registerCommands.ts(88,102), which is not this change. eslint --prune-suppressions
--max-warnings=0 exits 0 on the touched file; the prune also rewrote unrelated entries elsewhere in
src/eslint-suppressions.json, which is reverted here rather than shipped, because cleanup with
nothing to do with these rows belongs in its own commit. prettier --check clean.
No it.runIf added or removed, and nothing claimed about the platform: the geometry these rows drive
is the doubles' inode table, as in the rows landed in f653f86, so they run wherever the suite
runs. This does not close the separate finding that the flag-off destination write bypasses
`guardedWrite` altogether (thread bwM6z8Hy8): the identity refusal is not that guard, and closing
that changes write semantics for every flag-off user, which is the owner's call.1 parent 42077a2 commit 3159d0a
1 file changed
Lines changed: 107 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
899 | 903 | | |
900 | 904 | | |
901 | 905 | | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
902 | 1009 | | |
903 | 1010 | | |
904 | 1011 | | |
| |||
0 commit comments