Clean up the session — bug fixes, dedupe, dead-code

Refactorkamolos
Shipped
May 16, 2026 at 11:43 PM UTC
Author
Kamo
Commit
e5762d9

Three-agent review surfaced real problems and copy-paste — addressing them: Bug fixes: - useEnsurePrimaryBorrower returned dead state (primaryUid, creating) and double-fetched the app (createPair + explicit refetch). Now returns just the ensure() function and reads the new BorrowerPair off the mutation result; useCreatePair's onSuccess keeps the cache fresh. - Six waypoints that wrote through mortgageAppsApi directly were missing the cache invalidation that the existing React Query hooks do automatically. Added qc.invalidateQueries({ queryKey: ['mortgageApp', uid] }) after every direct write; property-cards already used usePatchProperty so it was fine. - Sequential awaits in connect-first flows: startConn vs ensure()+borrower writes are independent. Now Promise.all'd in front-door, paystub-clipboard, bank-vault, credit-ledger. Dedupe: - New <StatusBanner tone="success|warn"> in lib/world/sheet/ replaces 24 copy-pasted teal/amber banner divs across 11 waypoints (driven by a Python sweep — verified output is identical). - 8 ceremony scene files (Ceremony*.tsx) collapsed into descriptor data on the registry; CeremonyClient renders the Ceremony primitive directly. Deleted lib/world/ceremony/scenes/ + the unused CeremonyStage.tsx. - Magic asset/liability type ids extracted to lib/los/urla-type-ids.ts. Dead code / stringly-typed: - Removed unused homeState/persona override props from JourneyShell, WorldShell, MobileCrest — no consumer ever passed them. Shells now just call useHomeState/usePersona once. - usePersona's hand-rolled persona Set replaced with PERSONAS_IN_ORDER (single source of truth — drift risk gone). - app/page.tsx now uses useAppUid instead of re-implementing the searchParams + onboarding-store lookup inline. - app/waypoints/[id]/page.tsx now returns notFound() instead of a stale M1 placeholder sheet (all 14 real slugs have static routes). Perf: - WorldScene wrapped in React.memo so r3f Canvas doesn't reconcile when unrelated parent state changes. Net: −300 lines in code we wrote, +1 reusable component, +1 constants file, 0 behavior regressions. tsc clean, 137 tests pass, build green.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing