Commit 192126e
authored
fix(aio): never lower a settled terminal cursor from a late hydration
Review finding: cloudHydrationPromises memoizes terminal-chain and
resume-chain hydrations under different mode keys, so both can be in
flight for the same run. If the run settles while a resume-chain
hydration's fetches are pending, the terminal-chain hydration records
the full chain as processed - and the late resume-chain write then
clobbered processedLineCount with its smaller leaf-only cursor
(updateSession is a blind assign with no monotonic guard).
Impact was bounded (the transcript content is identical and the next
terminal hydration self-heals), but it violated the invariant the
mode-keying fix set out to guarantee: the terminal transcript is
authoritative. Re-read the session at write time and floor a
non-terminal cursor at the settled value once cloudStatus is terminal.
The regression test resolves the resume-chain fetches after the run
settles and asserts the settled cursor survives; verified to fail
without the fix.
Generated-By: PostHog Code
Task-Id: 0c511836-2180-455a-9b58-45df2a0661ec1 parent 9284ebf commit 192126e
2 files changed
Lines changed: 97 additions & 1 deletion
File tree
- packages
- core/src/sessions
- ui/src/features/sessions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6220 | 6220 | | |
6221 | 6221 | | |
6222 | 6222 | | |
| 6223 | + | |
| 6224 | + | |
| 6225 | + | |
| 6226 | + | |
| 6227 | + | |
| 6228 | + | |
| 6229 | + | |
| 6230 | + | |
| 6231 | + | |
6223 | 6232 | | |
6224 | 6233 | | |
6225 | 6234 | | |
| |||
6229 | 6238 | | |
6230 | 6239 | | |
6231 | 6240 | | |
6232 | | - | |
| 6241 | + | |
6233 | 6242 | | |
6234 | 6243 | | |
6235 | 6244 | | |
| |||
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1929 | 1929 | | |
1930 | 1930 | | |
1931 | 1931 | | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
1932 | 2019 | | |
1933 | 2020 | | |
1934 | 2021 | | |
| |||
0 commit comments