📖
Replace, do not append

This page mirrors docs/SESSION_HANDOFF.md in the RMS repo, which is the authoritative, detailed handoff. Read that file first; this page is the short version for someone landing here from the portal.

Latest Session

Date: 2026-09-21 → 2026-09-24   Developer: Adnan   AI: Claude (Fable 5.1)   Reviewer: Grok (isolation / money reviews per checkpoint)

Objective

Deliver checkpoint L1 Inbound leads end-to-end (RMS + sonantech.com theme), harden runtime configuration (database first), and give the testing team a complete test plan inside the app.

Work Done

  • L1: migrations 20260921110000 (invariant repair), 20260921120000 (leads: sources, inbox, events, sequences, 13 RPCs), 20260922100000 (nearest store skips training stores); public endpoint /api/inbound/leads/<orgId>/<sourceKey>; lead page, claim / release / assign, POS marks Won; Lead sources panel (snippet, curl, Send test, Inbox with period / search / paging, key rotation); bell count + blue / red tones + "New lead received" toast; response target setting.
  • Theme (sonan-tech-shopify): snippets/sonan-rms-leads.liquid + Theme settings "SONAN RMS leads" (endpoint + public key); binds to every Shopify contact form without blocking hCaptcha; pushed to Dev Sandbox 2.
  • Config: mock card payments is an owner setting (Settings → Payments), production locked off; the three NEXT_PUBLIC_* flags are fallbacks and can be deleted from Vercel.
  • Fixes: sale-complete popup showed "Cash" for every tender; Locations Edit overwrote store kind / coordinates; dialog widths; field-map rows; stale auth-link test.
  • Testing: public/docs/test-plan.html generated from the QMS library (npm run docs:test-plan); Help → Test plan; owner switch Settings → Business profile → Testing; QMS TC-SET-013; smoke v1.17; product guide v1.19.

Key Decisions

  • Leads are organization-wide; the store is a routing hint; first claim wins; Won only when a ticket / sale / quote exists.
  • Website snippet never prevents the form submit (invisible hCaptcha); sends once with keepalive.
  • Non-secret configuration is database first, Vercel second; production locks mock card off regardless.
  • main stays frozen until the cutover runbook is executed in full — merging early would break production against the un-migrated prod database.

Open Items

  • Merge rule when a repeat submission has a different request type (currently merges within the dedupe window).
  • Contact-us form on Shopify has no return_to → no thank-you page (one-line CMS edit).
  • Vercel: delete NEXT_PUBLIC_MOCK_CARD_PAYMENTS, NEXT_PUBLIC_STRIPE_ENABLED, NEXT_PUBLIC_BLOCKCHYP_ENABLED.
  • Cutover date to be set after the testing soak.

Exactly What To Do Next

  1. Read docs/SESSION_HANDOFF.md → "Current status" (top entries) in the RMS repo.
  2. Confirm the dev database is at 20260922100000 (docs/system-setup/sql/prod-preflight.sql → 24 × APPLIED).
  3. Pick up defects from the team's test-plan run; keep every checkpoint's completion protocol (AGENTS.md).