Skip to content

Merge offline-first PWA into web/ (keep configurable batch size) - #5

Merged
watchmesink merged 1 commit into
codex/flashcards-sm2pp-uploadfrom
merge-offline-pwa-web
Jul 14, 2026
Merged

watchmesink merged 1 commit into
codex/flashcards-sm2pp-uploadfrom
merge-offline-pwa-web

Conversation

@watchmesink

Copy link
Copy Markdown
Owner

What & why

The web app had diverged into two copies that were never merged:

  • crosspoint-flashcards-web (standalone) — the offline-first PWA (isomorphic engine + IndexedDB client + service worker), but fixed batch size.
  • web/ in this repo — an online-only SPA, but with configurable batch size.

This unifies them into a single source of truth under web/: the offline-first PWA plus configurable batch size. The app now studies fully offline and lets you set cards-per-batch (1–20).

Changes

  • engine.js — isomorphic (Node Buffer / browser Uint8Array shim). Batch size threaded through createNextBatch / restoreOrCreateBatch / selectNextCard / rateCard / loadDeck via normalizeBatchSize (clamped [1,20]; BATCH_SIZE=20 stays the device-bin ceiling so serialized batches remain firmware-compatible).
  • server.js — serves the app shell + engine.js for the browser PWA; keeps GET/POST /api/settings (batchSize) and threads settings.batchSize through openDeck / deckView (adds configuredBatchSize) / rate.
  • public/ — split into shell (index.html) + offline client (app.js over IndexedDB, running the shared engine) + service worker (sw.js, cache v4). Adds a Settings screen for batch size that applies locally immediately and syncs (dirty-flag push, else server pull).
  • test/test.js — keeps byte-parity + browser-path (PortableBuffer) tests, adds batch-size tests.
  • agent/sync_agent.py — ~/.crosspoint_sync/config.json credential fallback for non-interactive shells.

Verification

  • node test/test.js → 25/25 pass, including the real-device-bin byte-identical round-trip (engine stays firmware-compatible).
  • Local server smoke test: offline assets (/app.js, /sw.js, /engine.js) served 200; /api/settings clamps (999→20, 0→1) and persists to settings.json; rating via /api/decks/:deck/rate at a custom batch size (3) advances and refills the batch at the configured size.

Deployed to the Railway crosspoint-flashcards service; the standalone crosspoint-flashcards-web fork is being retired.

🤖 Generated with Claude Code

Unifies the two diverged web copies into a single source of truth under
web/: layers the offline-first PWA (from the standalone crosspoint-flashcards-web
repo) on top of the mono-repo's configurable batch-size feature. The app now
studies fully offline AND lets you set cards-per-batch (1-20).

- engine.js: isomorphic (Node Buffer / browser Uint8Array shim). Batch size
  threaded through createNextBatch/restoreOrCreateBatch/selectNextCard/rateCard/
  loadDeck via normalizeBatchSize (clamped [1,20]; BATCH_SIZE=20 stays the
  device-bin ceiling so serialized batches remain firmware-compatible).
- server.js: serves the app shell + engine.js for the browser PWA; keeps
  /api/settings (batchSize) and threads settings.batchSize through
  openDeck/deckView (adds configuredBatchSize)/rate.
- public/: split into shell (index.html) + offline client (app.js over
  IndexedDB, running the shared engine) + service worker (sw.js). Adds a
  Settings screen for batch size that applies locally at once and syncs.
- test/test.js: keeps byte-parity + browser-path tests, adds batch-size tests.
- agent/sync_agent.py: config.json credential fallback for non-interactive shells.

Verified: 25/25 engine tests incl. real-device-bin byte-identical round-trip;
local server smoke test (offline assets served, /api/settings clamp+persist,
rating at a custom batch size refills the batch at the configured size).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@watchmesink
watchmesink marked this pull request as ready for review July 14, 2026 08:46
@watchmesink
watchmesink merged commit 6960ca4 into codex/flashcards-sm2pp-upload Jul 14, 2026
1 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant