Repository navigation
Native iOS app: offline reading - #139
Conversation
offline-cache.ts reads through the network and keeps a copy in AsyncStorage under the user id; when the read fails, or expo-network says the device is offline, the copy answers. Copies are removed when the account changes, a slow answer never replaces a newer copy, and each group keeps its most recently fetched entries only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Current Debate and debates list, counts and recent work, Library sources with their text, saved cases, attacks, brainstorms, factoids, flowcharts and chats now fall back to their saved copies. Deleting a row drops its copy. The auth provider names the cache owner before it adopts a session, next to the session memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A notice leads the tabs, result documents and the flowchart while the device is offline or a read fell back to a saved copy: "Offline: showing saved copies. AI and saving wait for the connection." AI and saving keep failing with their existing network errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ONLY=offline signs in to staging, reads the Debate tab, the Library and a source, a saved case and a flowchart, then shows the same data under the offline notice twice: with the browser offline while navigating inside the app, and after a reload with every staging request failing. It also plants another account's copies and checks they are removed unseen, and that signing out removes every copy. The logout call is answered locally, so the shared staging session stays valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/07a-offline-read # Conflicts: # apps/mobile/AGENTS.md
Sparring landed after the offline cache, so its saved rounds and the Practice list now read through the same per-account cache, and a deleted round drops its copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Note 🎁 Summarized by CodeRabbit Free
Comment |
|
Codex review r1 at ad4ee4d (gpt-6.1-sol, high): 5 findings, all checked against the code and accepted; fixes in progress.
|
A read used to answer from its saved copy for any error, so an expired session, a policy refusal or a server error looked like being offline and showed old data. The cached loaders now throw readFailed(error, status), and cachedRead falls back only when supabase-js got no answer (status 0: no connection, DNS failure, timeout). Everything else is thrown as it is. The saved-copies notice now counts each copy a screen shows, and a copy stops counting only when that same data is read from the server again, so a successful read elsewhere no longer hides it. Also adds afterWrite and updateCopy, which the writers use in the next commit; forgetCopy now goes through afterWrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Writes left the saved copies as they were, so offline the app showed the Current Debate before a switch, a map before it was saved over, and Library lists, counts and recent work that still held deleted rows. Every write that succeeds now calls afterWrite with the copies it changed: one key, or the keys of a group that start with a prefix and name a debate. Those copies are dropped, and reads of them that started before the write cannot save their older answer. Where the new value is known, updateCopy stores it instead: switching or creating a debate updates the saved list and Current Debate, and saving a map stores the map as saved. Deletes read back the row's debate so its lists drop too. Judging a Sparring round and filing it in a debate drop the round lists it appears in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex review r2 at a587dae (gpt-6.1-sol, high): r1's five findings verified fixed (switch/create updates, map-save sequencing, HTTP-error rejection, owner isolation). Three new findings, accepted; fix in progress:
|
A delete that succeeds with no row (already deleted on the website) does not name the debate that held the item, so the copies of every debate's Library, maps, rounds, counts and recent lists of that kind are dropped instead of none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A read built from several queries rejected with whichever failed first, so one query that got no answer could hide another's 401 and serve the saved copy. The debates list, a chat, the debate counts and the recent and Prepare lists now wait for every query and throw the refusal when there is one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The offline notice tracked shown copies by key only, so a copy kept the notice up after reconnecting until that exact item was read again. Each screen now reads with a CopyHolder mark: a newer load lets go of what its older loads showed, a late read from a closed screen no longer counts, and closing a screen, leaving a tab or clearing its data releases its copies. The Flowchart screen shares its holder with the saved maps sheet that opens maps for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/07a-offline-read
…/07a-offline-read
|
Round-2 fixes: f7af0a0 (a delete that returns no row drops every list it may touch), 55433c9 (a server refusal wins over a missing answer in parallel reads, incl. loadChat), 7a45e57 (a saved copy stops counting once its screen closes or moves on). Tests for findings 1 and 2 fail without the fixes. Merged feat/native-ios (Sparring, dev-build prep, entitlements). Local at a846afc: npm run verify green (335 vitest, 30 smoke), mobile typecheck, eslint, knip pass. Codex r3 next. |
readAll held a refusal until every other query settled, so a 401 behind a query that never answered left the screen loading. A refusal now rejects as soon as it arrives; only queries that got no answer wait for the rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex review r3 at a846afc (gpt-6.1-sol, high): r2's three fixes hold (delete invalidation and refusal preference passed probes; both merges clean). Two findings:
|
|
Codex review r4 at 95313b1 (gpt-6.1-sol, high): no findings. readAll ordering, empty input, multiple refusals, mixed failures, later rejections and typing checked; no caller depends on waiting after a refusal. Merging into feat/native-ios. Not provable here: real airplane mode on a phone, expo-network's native reachability and AsyncStorage's native limits. |
Brings in Sparring (#138), development-build prep (#142), App Store entitlements (#141) and offline reading (#139). - The push migration becomes 20261014130000_push_tokens.sql so it sorts after 20261014123154_app_store_entitlements.sql. - auth.tsx and _layout.tsx keep both the push wiring (release on sign-out, refresh on launch and language change) and setCacheOwner/watchNetwork. - package-lock.json is feat's lock plus `npm install` for expo-notifications. - app.config.ts is unchanged: #142 already strips aps-environment from development builds. The mobile guide now says so, and that real push needs a profile with push and an APNs key from Adam's Apple Developer account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Offline reading for the iOS app. Debates, Library sources, saved results, flowcharts, chats and judged Sparring rounds stay readable without a connection. AI and saving wait for the network, as the plan says.
How it works
debates.ts,sources.ts,results.ts,flowcharts.ts,chats.tsandsparring.ts.setSessionpath that clears session memory. A copy is checked against its owner again on every read.OneOffNoticeand says what's happening: "Offline: showing saved copies. AI and saving wait for the connection." The string is in en, es and hu.Checks (local; GitHub Actions is out of minutes)
At this head, run under the shared memory lock:
npm run verify: exit 0. Vitest 320/320 (including the new cache tests for account isolation and stale answers), collaboration 30/30, edge 333, build OK, smoke 30/30.npm -w @debatelab/mobile run typecheckandnpx eslint apps/mobile: exit 0.ONLY=offline, iPhone light en and dark hu, 15 screenshots):Not provable here
navigator.onLine)Codex review rounds follow as comments.
🤖 Generated with Claude Code