4 Commits

Author SHA1 Message Date
ea7d07b2c8 perf(db): composite index (account_id, name) + hide archived groups
Two related follow-ups for the 3 000+ groups-per-account scale path:

1. New B-tree index on whatsapp_groups (account_id, name) (migration
   0014). Covers the groups list page's
   `WHERE account_id=? ORDER BY name ASC LIMIT 200` query so PG
   streams pre-sorted from the index instead of pulling all rows
   then sorting. The unique (account_id, wa_group_jid) was the only
   prior B-tree on this table; it backed the WHERE prefix but not
   the ORDER BY.

2. listGroupsForAccount now filters `is_archived = false` in both
   the search and the no-search branch. Soft-archived groups
   (set when group-sync sees them disappear from the live
   participant list, or when an operator unpairs the account) used
   to leak into the wizard picker, letting operators pick a group
   the bot can no longer reach. Archived rows still exist in DB so
   reminders that target them keep working; a re-pair flips them
   back via the on-conflict upsert.

README "Deferred" entry for the composite index removed (it's
shipped). Search-as-you-type in the wizard picker stays deferred.

482 web + 88 bot tests still green; typecheck clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 21:57:17 +08:00
c906a9fa3a docs: refresh README + add docs/runbook.md for v1 sign-off
- README rewritten to reflect v1 reality: auth bootstrap, AES-GCM
  cookies, three-layer rate limit, duplicate-pair detection,
  logout-before-delete, journal-monotonic guard, the new test
  counts (482 web + 88 bot), and the right scripts (set-password,
  create-user). Drops the telegram-era 'Status' paragraph and the
  earlier 'Auth deferred' bullet.
- docs/runbook.md is a new manual end-to-end smoke checklist
  organised by section: pre-flight, auth bootstrap, user
  management, account pairing (incl. back→re-pair + duplicate-phone
  regression checks), reminder lifecycle (incl. triple-fire +
  reschedule regression checks), account lifecycle, sign-out +
  token-version kill, cross-tenant isolation, log sweep, plus a
  troubleshooting cheatsheet.

Closes P3/T23 + P3/T24.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 21:45:03 +08:00
29535d6bbc docs: refresh README for web-first state of the world (P3/T24)
The status section reflected the post-Plan-1 world where pairing
went through Telegram. Reality has long since moved on:

  - Plans 1, 2, and 3 are all complete.
  - The Telegram bot is gone (removed in P3/T4).
  - The web app at wabot.04080616.xyz is the primary surface.
  - The recurrence picker, multi-message stack, swipe rows, archive
    flow, HEIC fallback, and PWA install all shipped.

Other updates:
  - Quick-start no longer mentions Telegram tokens — replaced with
    the URL the operator opens to use the app.
  - Architecture paragraph swapped grammy mention for the LISTEN/
    NOTIFY consumer + SSE shape.
  - Pointed at the new design spec
    (2026-05-09-web-app-design.md) and manual test runbook.
  - Layout / scripts tables trimmed: dropped the publish.sh and
    link-account.sh stubs that were never implemented.
  - "Deferred" section lists honest gaps (media library, E2E tests,
    auth, multi-operator).

Test counts called out (249 web + 31 shared + 26 bot = 306) so the
status claim is verifiable in a single grep.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 13:23:04 +08:00
f613d83b40 docs: add top-level README 2026-05-09 17:10:48 +08:00