Commit 6c704ce
committed
fix: harden schema probe cache against concurrency and stale code versions
Two latent issues, both surfaced while populating new fields:
- The schema-file and probe-cache writers used a shared "<path>.tmp" and the
schema-file writer did not catch errors. Concurrent extraction workers that
all cache-miss and re-probe raced on that temp and one worker's rename failed
with FileNotFoundError, aborting the run. Each writer now uses a unique temp
file (tempfile.mkstemp) and atomically renames; failures are logged, not
raised. As the proper fix, convert_relationships now builds the canonical
write schemas once in the parent before forking, so workers inherit the cache
and never re-probe concurrently.
- A probe cache is keyed by the source-file set, which is unchanged across a
code change, so a stale cache silently shadowed updated extraction logic
(e.g. the new affiliation `years` field). The cache now records and validates
the schema version on load and is rejected on mismatch; bumped to v2.
Tests in test_probe_cache.py cover version rejection and concurrency-safe writes
(blocking the legacy shared temp name to deterministically distinguish the fix).1 parent 70a0e1d commit 6c704ce
3 files changed
Lines changed: 148 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1318 | 1318 | | |
1319 | 1319 | | |
1320 | 1320 | | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
1321 | 1327 | | |
1322 | 1328 | | |
1323 | 1329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
1767 | 1768 | | |
1768 | 1769 | | |
1769 | 1770 | | |
1770 | | - | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
1771 | 1779 | | |
1772 | 1780 | | |
1773 | 1781 | | |
| |||
1805 | 1813 | | |
1806 | 1814 | | |
1807 | 1815 | | |
1808 | | - | |
1809 | | - | |
1810 | | - | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
1811 | 1837 | | |
1812 | 1838 | | |
1813 | 1839 | | |
| |||
1905 | 1931 | | |
1906 | 1932 | | |
1907 | 1933 | | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
1908 | 1939 | | |
1909 | 1940 | | |
1910 | 1941 | | |
| |||
1929 | 1960 | | |
1930 | 1961 | | |
1931 | 1962 | | |
1932 | | - | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
1933 | 1969 | | |
1934 | | - | |
1935 | | - | |
1936 | | - | |
| 1970 | + | |
| 1971 | + | |
1937 | 1972 | | |
1938 | | - | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
1939 | 1977 | | |
1940 | 1978 | | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
1941 | 1985 | | |
1942 | 1986 | | |
1943 | 1987 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
0 commit comments