Repository navigation
Commit dd060a4
committed
fix(tools): take the read version token before the read, and pin the review-raised cases
Both read paths computed the observation token after reading the file and after
awaiting trackFileContext, so a mutation in that window left the registry holding a
token newer than the bytes this read returned and the write guard would accept a stale
write. The token is now taken before the read and recorded only after the read
succeeds, on the native and the legacy path alike, through one file-local helper so the
two paths cannot drift apart - the two blocks were character-identical once comments
are stripped, which I diffed line by line before folding them together. The direction
is a deliberate choice: a mutation during the read now yields a token that mismatches
and blocks the guarded write, which is the conservative answer for a guard.
The pinning test mutates the file inside the read so the pre-read and post-read tokens
differ, and names which one the tool may record; with the stat moved back after the
read it reddens - expected '1:2:300:4000000000:5000000000', received
'1:2:300:9000000000:5000000000' - and the implementation is restored from a saved copy
(hash 7053a7861143cb42dd9a0dc0bd3f1a83115d0007 before and after the control).
Also strengthens the assertions review flagged, with no behaviour change: observe
assertions compare the resolved full path instead of a substring, so a call made with
the relative path can no longer pass (native site and both legacy sites); the
beforeEach stat mock now returns the BigIntStats shape the tool reads, because the
partial double made computeVersionToken throw a TypeError that its .catch swallowed,
laundering a mock gap into "no token"; the stale-entry test arms the stat failure on
the call that passes { bigint: true }, the only call that does, instead of on call
parity; and the registry test pins the exact observedAt under a fake clock instead of
accepting any number, which both 0 and NaN satisfied.
Measured: readFileTool.spec.ts + observationRegistry.spec.ts 102 passed, Task.spec.ts
201 passed, check-types 11/11 exit 0, root lint exit 0, eslint clean on the touched
files, and test:solheim-smoke-ci fails identically with these files reverted to the
merge commit, so its red is pre-existing on this merge and not caused here.
Addresses review feedback on #1394.
Related: #13751 parent 9fe680c commit dd060a4
4 files changed
Lines changed: 113 additions & 41 deletions
File tree
- src
- core
- task/__tests__
- tools
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 228 | + | |
235 | 229 | | |
236 | 230 | | |
237 | 231 | | |
| |||
782 | 776 | | |
783 | 777 | | |
784 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
785 | 782 | | |
786 | 783 | | |
787 | 784 | | |
| |||
814 | 811 | | |
815 | 812 | | |
816 | 813 | | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
| 814 | + | |
827 | 815 | | |
828 | 816 | | |
829 | 817 | | |
| |||
839 | 827 | | |
840 | 828 | | |
841 | 829 | | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
200 | 210 | | |
201 | 211 | | |
202 | 212 | | |
| |||
1726 | 1736 | | |
1727 | 1737 | | |
1728 | 1738 | | |
1729 | | - | |
| 1739 | + | |
1730 | 1740 | | |
1731 | 1741 | | |
1732 | 1742 | | |
1733 | 1743 | | |
1734 | 1744 | | |
1735 | 1745 | | |
1736 | 1746 | | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1737 | 1789 | | |
1738 | 1790 | | |
1739 | 1791 | | |
| |||
1813 | 1865 | | |
1814 | 1866 | | |
1815 | 1867 | | |
1816 | | - | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
1817 | 1871 | | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
1821 | 1875 | | |
1822 | 1876 | | |
1823 | 1877 | | |
| |||
1928 | 1982 | | |
1929 | 1983 | | |
1930 | 1984 | | |
1931 | | - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
1932 | 1988 | | |
1933 | | - | |
1934 | | - | |
1935 | | - | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
1936 | 1992 | | |
1937 | 1993 | | |
1938 | 1994 | | |
| |||
1948 | 2004 | | |
1949 | 2005 | | |
1950 | 2006 | | |
1951 | | - | |
| 2007 | + | |
1952 | 2008 | | |
1953 | 2009 | | |
1954 | 2010 | | |
| |||
1996 | 2052 | | |
1997 | 2053 | | |
1998 | 2054 | | |
1999 | | - | |
| 2055 | + | |
2000 | 2056 | | |
2001 | 2057 | | |
2002 | 2058 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
864 | | - | |
| 864 | + | |
865 | 865 | | |
866 | 866 | | |
867 | 867 | | |
| |||
0 commit comments