Repository navigation
Commit 1ffdc2e
committed
test(webview): cover the profile-list re-derive failing at its write
ClineProvider.ts:2844-2847 re-derives the profile list cache on a dirty flag: it re-reads the list from
disk, writes it back, and clears the flag only after both halves land. The rows beside this one cover the
two ends - a re-derive whose disk read rejects, and a re-derive that succeeds all the way through - and
neither reaches the middle case, the read succeeding while the write that follows it rejects. A re-ordering
that clears the flag between the read and the write passes the whole existing file, so the contract that
the flag survives its own rejected write was untested.
The new row arms the two rejections separately - the switch tail's write, which is what sets the flag, and
the recovery's own write, which is what the row is about - and asserts that the state post still lands,
that the flag stays set, that the cache still holds the pre-switch list, and that a later assembly retries
and heals it. expect(recoveryWriteRejected).toBe(true) sits in the row so a reader can see the failure was
produced on the write rather than on the read.
Control. With the flag cleared one line earlier, between the re-read and the write (the re-ordering this
row exists to catch), the file is 1 failed | 35 passed (36), the single red being this row at spec.ts:891
on expect(provider["profileListCacheDirty"]).toBe(true) - expected false to be true. The same re-ordering
against the file as it stood before this row is 35 passed (35), which is the gap stated as a number.
Against the shipped source the file is 36 passed (36) and core/webview is 35 files, 1156 passed (1156).
+88/-0 in this one spec file - 70 executable lines, 14 comment lines and 4 blank lines, no production file
touched. Measured with .tmp-node22 node v22.23.4 and vitest.core.config.ts, run from src.
eslint --prune-suppressions --max-warnings=0 exits 0 with src/eslint-suppressions.json restored
byte-for-byte, repo-root prettier --check exits 0, and tsc --noEmit from src reports the same single error
before and after this change - activate/registerCommands.ts(225,2) TS2561 - in a file this commit does not
touch.1 parent dd76f1a commit 1ffdc2e
1 file changed
Lines changed: 88 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
815 | 903 | | |
816 | 904 | | |
817 | 905 | | |
| |||
0 commit comments