CLAUDE.md shrinks to rules + status + index (175 lines, down from 476). Dev setup, prod deploy, and per-phase build records move to docs/. Gotchas regrouped by domain (auth, frontend, PWA, testing, backend, deploy, platform) and unnumbered so they don't drift as new ones land. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.9 KiB
1.9 KiB
Fase 2b — what has been built
supabase/migrations/007_realtime_publication.sql— adds shopping_items + shopping_lists tosupabase_realtimepublication withREPLICA IDENTITY FULLapps/web/src/lib/stores/realtimeSync.ts—subscribeToList(listId, onEvent)postgres_changes subscription helper;applyItemEventreducer for INSERT/UPDATE/DELETE/lists/[id]/+page.svelte— wired to realtimeSync with pendingTempIds echo-deduplication. Mutations use client-generated UUIDs so offline retries are idempotent (PK-conflict = success)apps/web/src/lib/sync/queue.ts—SyncQueueclass (IDB-backed pending_ops, FIFO flush, MAX_ATTEMPTS retry, PK-conflict-as-success)apps/web/src/lib/sync/index.ts— app-wide SyncQueue singleton;enqueueOp,hydrateSyncState, auto-flush onwindow.onlineapps/web/src/lib/stores/syncStatus.ts— derived store:offline | syncing | syncedfromnavigator.onLine+pendingOpsCountapps/web/src/lib/components/SyncBanner.svelte— renders the offline/syncing indicator; mounted in list detail + session viewsapps/web/src/routes/(app)/lists/[id]/session/+page.svelte— Modo Compra full-screen view (fixed positioning overlays the sidebar), 56px toggles, flip animation, confirm modal, completeList → redirectapps/web/messages/*.json—sync_offline,sync_syncing,list_start_sessionpackages/test-utils/src/realtime-helpers.ts—subscribePostgresChanges(client, opts)withwaitFor(predicate, ms)— awaits SUBSCRIBED handshake, dedups events, leaks nothing between tests- Vitest unit harness in
apps/web/—vitest.config.ts(jsdom env) +vitest.setup.ts(fake-indexeddb/auto) +pnpm --filter @colectivo/web test:unit - Realtime config gotchas documented in
project_realtime_configmemory: tenant name, DB_USER=supabase_admin,SEED_SELF_HOST: "true", pre-createdrealtimeschema, publication + REPLICA IDENTITY FULL