Memory/Session Feed 403 In Dev Shows Empty/Error UI Instead Of Dummy Data
Metadata
- Date:
2026-04-05 - Status:
fixed - Severity:
high - Related issue/ticket:
N/A - Owner:
N/A
About
Overview: - Home feed image tiles and hamburger conversation list depend on /memories/feed and /sessions/feed. - In local/dev environments these calls can return 403, but the app currently has no fallback to dummy feed data for that failure path.
Technical Questions: - Is the failing path backend auth (403) rather than image rendering itself? - Does dev-mode fallback exist for both memories and sessions feed endpoints? - Are there existing mock data helpers that should be used here? - Which runtime flags should enable fallback safely (EXPO_PUBLIC_DEV, NODE_ENV)?
Resources: - main/app/lib/api/memory/listMemories.ts - main/app/lib/api/sessions/fetchSessions.ts - main/app/lib/api/memory/memoriesMock.ts - main/app/lib/api/sessions/sessionsMock.ts - main/app/__tests__/memory-feed-api.test.ts - main/app/__tests__/sessions-feed-api.test.ts
Steps to cause failure
flowchart LR
OpenHome --> FeedCalls["POST /memories/feed and /sessions/feed"]
FeedCalls --> Forbidden403["403 responses from API"]
Forbidden403 --> NoFallback["No dev dummy fallback path"]
NoFallback --> UIError["Feed tiles/menu show error or empty state"] System
flowchart TD
MemoriesScreen --> useMemoriesFeed
MemoriesScreen --> useSessionsFeed
useMemoriesFeed --> listMemories
useSessionsFeed --> fetchSessions
listMemories --> ApiClient
fetchSessions --> ApiClient
ApiClient --> AuthInterceptor Notes about the system can go here.
Reproduction Details
- Open memory feed screen.
- Return
403from/memories/feedand/sessions/feedin a dev-like runtime. - Observe no dummy fallback is used.
Reproduction test (unit preferred): cd main/app && npx jest __tests__/memory-feed-api.test.ts __tests__/sessions-feed-api.test.ts --runInBand
Notes for PR
Root cause: - listMemories and fetchSessions always called network APIs and surfaced 403 directly. - Although memoriesMock existed, no runtime fallback path used it. - No session/conversation mock existed for the hamburger menu feed path.
Fix summary: - Added dev-runtime (EXPO_PUBLIC_DEV=true or NODE_ENV=development) 403 fallback in listMemories to return paginated memoriesMock. - Added conversationsMock and dev-runtime 403 fallback in fetchSessions with pagination. - Added regression tests for both API modules proving fallback behavior and preserving pagination semantics.
Verification summary: - Before fix, new tests failed with Request failed with status code 403. - After fix, both tests pass and return deterministic mock payloads. - Existing screen tests (memory-feed-screen) still pass.
Audit Log
| ID | Action | Note | Context |
|---|---|---|---|
| 1 | Create audit log | Initialized systematic debugging record for 403 feed issue | issue created |
| 2 | Trace feed dependencies | Confirmed home tiles and hamburger list both depend on feed endpoints, not local image rendering logic | scope narrowing |
| 3 | Add failing repro tests | Added 403-in-dev fallback tests for memories and sessions feed APIs; confirmed failures pre-fix | reproducible failure |
| 4 | Implement root fix | Added dev-runtime 403 fallback to mock data for both feed APIs with cursor pagination | source fix |
| 5 | Verify with tests | Re-ran targeted API tests and memory-feed screen tests; all pass | validation |
| 6 | Code-review gate | Checked plan alignment and test coverage for changed feed paths | final check |
Verification
- [x] Reproduced failure before fix
- [x] Reproduction test fails before fix
- [x] Root cause identified with evidence
- [x] Fix applied at source (no workaround-only patch)
- [x] Reproduction test passes after fix
- [x] Reproduction path now passes
- [x] Regression test added/updated (or
N/Awith reason) - [x] Verified no duplicate solved-bug log exists for same root cause