Covers error recovery (re-init when no cursor was ever seeded, resume
from the existing cursor after a poll failure), subscriber exception
isolation, rev filtering and cursor advancement, and poll lifecycle
across background/suspend/resume and requested poll intervals.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Covers the recently fixed bugs (batch continuation on unknown convos,
accept status propagation to 'all'-status caches, rev guard against
stale writes) plus core per-log-type cache behaviors. Fixture builders
are shared for other chat test suites.
Stubs the bottom-sheet native module in jest setup: it reads
Platform.Version at import time, which jest-expo leaves undefined,
crashing any test that imports the chat/session chain.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pure refactor: move the log-event handling out of the
ListConvosProviderInner effect closure into an exported
handleConvoLogEvents function, so tests can drive it directly with a
QueryClient and a batch of logs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- use continue instead of return when a convo isn't found in cache, so
the rest of the event batch isn't dropped (the bus advances its
cursor past the batch, so dropped logs are never redelivered)
- on logAcceptConvo, flip status to accepted in every cache holding the
convo, including 'all'-status caches like the always-mounted unread
query; previously the stale copy kept status 'request' and the next
logCreateMessage could resurrect the convo in the requests inbox
- add a rev guard so log-driven updates skip when the log isn't newer
than the cached convo, preventing stale refetch snapshots and log
events from double-applying against each other
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- recovering from an error state now re-runs init() when latestRev was
never seeded (previously polled forever with an undefined cursor,
silently skipping all events), and resumes from the existing cursor
when one exists (previously discarded it and skipped the offline gap)
- emit log batches outside poll()'s try/catch so a throwing subscriber
is logged instead of being misreported as a network/poll failure
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>