# PURE Master Merger Plan — Completion / Gap Audit
**Source plan:** `lane-b/master-plan.html` ("PURE — Master Merger Plan", DRAFT v1 for approval)
**Audited:** 2026-06-24 · **Method:** plan + companions (`roadmap-review`, `MCP Roadmap`, `system-review`, `PURE Hierarchy`) cross-referenced against the live repo surfaces, the 39 migration files, the 18 edge functions, and the Lane B2 architecture snapshot. ⚠️ The canonical DB `mbnakfrkfwxinhxlisyq` (136–160 tables) is **not introspectable from this session** (permission denied), so DB figures are taken from the architecture doc + the plan's own enumeration, not verified row-by-row.

---

## Verdict
**The building blocks are largely built; the *merger* is not.** The plan is, by its own design, an **index + disposition of things that mostly already exist** as separate surfaces — then a program to compose them into one role-aware shell and launch publicly. So:

- **Assets / building blocks: ~75% built.** Backend is mature (≈136–160 tables, 30 edge functions, 22 MCP tools across 6 servers — MCP roadmap **100% delivered**, Auth live with MFA/passkeys, 21 cron jobs). All **8 canonical surfaces exist** plus ~50 supporting surfaces (177 HTML files in the repo).
- **The merger itself (convergence → launch): ~20–25% done.** The actual unification — one composed shell, collapsing the 177 surfaces to one-canonical-per-pillar, the public SSR search site, full per-hat RLS, and launch on acquistorealestate.com — is mostly **outstanding**.
- **Overall toward a launched, merged platform: ≈30%.**

In short: **almost everything is built once (often two or three times); almost nothing is merged yet.** That's exactly the problem the plan was written to solve — and the plan's §4 *decides* every disposition, but those decisions are not yet *executed*.

---

## Completion by rollout phase (the plan's §13 backbone)
| Phase | Goal | Status | ~% | Evidence |
|---|---|---|---:|---|
| **0 · Master index & freeze** | every surface → pillar → hat → keep/merge/archive; confirm spine + data rules | **Decided, awaiting sign-off** | **85%** | The plan doc *is* this: §4 dispositions, §3 spine, §6 data rules, PURE Hierarchy access matrix + vocabulary canon all done. Missing: Mike's approval (doc says "DRAFT v1 for approval"). |
| **1 · Identity & hats** | finalize hats/permissions; JWT claims via auth hook; multi-tenant stamps | **Built, not enforced** | **65%** | Auth/GoTrue live (MFA; passkeys staged via `pure-passkey`/`webauthn-verify`); `auth-email-hook` exists; `pure_nav_grants` access matrix + RLS helpers (`visible_org_ids`, `pure_my_email`…) exist. Gap: RLS still permissive (`using(true)`) — not real per-hat enforcement. |
| **2 · One shell + front door** | role-aware shell; mount surfaces as permissioned modules; hat-switcher; kill four-door splash | **Mostly not built** | **25%** | `sign-in.html` + a v5 shell exist, but the 177 surfaces are still **separate pages**, not composed into one hat-driven shell. This is the single biggest unbuilt piece. |
| **3 · Public IDX search** | Google Cloud feed → listings spine; rebuild public search SSR/ISR + schema.org; lead loop | **Planned only** | **10%** | This is the migration plan I wrote (`MIGRATION-PLAN.md`). `mls-intake` function exists; the public SSR site does **not**. Blocked on the acquistorealestate.com codebase + feed creds. |
| **4 · Collapse duplicates** | merge each pillar to its canonical surface; archive + 301 the rest | **Decided, not executed** | **10%** | §4 dispositions are set (8 Canon · ~35 Merge · ~4 Archive · 1 New) but no surfaces have been folded/redirected yet. (My git-level consolidation collapsed branches/PRs, not product surfaces.) |
| **5 · Billing & marketplace** | hierarchical billing (PURE merchant-of-record); Store upgrades; nested books | **Partial backend** | **35%** | `Pure Store.html`, Stripe `billing` function + `feat/billing-stripe` PR, `pure_subscriptions`/`pure_store_products`/`pure_books_ledger` tables. Gap: nested/hierarchical billing + revenue-share not wired end-to-end. |
| **6 · RLS lockdown** | flip tables to JWT/hat enforcement page-by-page | **Interim only** | **40%** | S1 interim lockdown done (6/13); the Zoho-dump project secured (6/24, my fix). Canonical RLS is on but permissive. Gap: real per-hat enforcement + tenant-isolation tests (the #1 launch gate). |
| **7 · Scale, SEO & launch** | caching, pre-render, indexes, redirects, PWA, pen-test; cut on acquistorealestate.com | **Not started** | **5%** | Improvement engines monitor perf/SEO; nothing launched on the production domain. |

---

## Pillar-by-pillar (§4) — canonical surface status
All 8 canonical surfaces **exist as built pages**; none have had their duplicates collapsed yet.

| Pillar | Canonical surface | Exists? | Merge backlog (supporting surfaces to fold in) |
|---|---|:--:|---|
| 1 · Search & Listings | **SearchPro** (+ **New: Public IDX Search**) | ✅ / ❌ new | Pure CMA, Saved Searches, MLS Data Checker, MLS Feeds & Analytics |
| 2 · Deal Room | **Deal Room Spine** | ✅ | Background Questions, TREC 20-18/39-10/40-11, Offer Comparison, Net Sheet, Pure Signature, Doc Trace, TC, Client/Buyer/Seller dashboards, Showings, Messaging |
| 3 · CRM / Office | **Office · Leads** | ✅ | Lead Routing, Contact 360, Partner Referrals, Open House, Activity Feed, Notifications, My Tasks, Global Search |
| 4 · Money | **Pure Clearing** | ✅ | Pure Books, Pure CDA, Billing/Subscriptions, Wallet, Pure Analytics |
| 5 · Services / Marketplace | **Pure Store** | ✅ | Appraiser, Home Inspector, Move-In Inspection, Disclosure Assist, Verified Capture, Vendor Partners, Media Day |
| 6 · AMS / Association | **Committee Governance** + **Nav Governance/Hierarchy** | ✅ | Pure Order, Dues Billing, MLS Money & Compliance, Compliance Center |
| 7 · Admin / Ops | **PURE Admin Console** | ✅ | Command Center, Status, Integrations Hub, Data Atlas, Ops Reports, Sessions Archive |
| 8 · Archive | (v4.8, 5B Fable, four-door splash) | n/a | Retire + redirect to `/archive/versions` |

**Disposition tally:** ~8 Canon · ~35 Merge · ~4 Archive · ~1–2 New. **Merges executed so far: 0** (at the product-surface level).

---

## What's genuinely DONE (the head start)
- **MCP platform — 100%.** 5/5 phases live (6/17): 22 tools, 6 servers, audited, approval-gated; `pure-mcp` v1.2.
- **Backend depth.** ≈136–160 tables, 30 edge functions, 21 green cron jobs, hash-chained audit, `mcp_guard`.
- **Auth.** GoTrue email/pw + MFA live; Google; passkeys/WebAuthn staged.
- **Org/governance model.** 6 orgs mapped, hats + access matrix (`pure_nav_grants`), vocabulary canon (4.8/5/5B → canonical), 11-step deal swimlane.
- **Convergence roadmap (`roadmap-review`):** 5/10 items executed (one-world demo, pre-push gate, ⌘K surface, fable close…); 5 gated on the backend/auth window.
- **Security interim:** S1/S3 fixed; the Zoho-dump PII exposure closed today.
- **All 8 canonical surfaces + ~50 supporting surfaces** already built.

## What's OUTSTANDING — ordered build queue
1. **Phase 0 sign-off (Mike).** Approve the §4 dispositions + hats + org spine. Unblocks everything; costs nothing.
2. **Phase 1 finish — real RLS + tenant isolation.** Move off `using(true)` to per-hat/org policies keyed on `auth.uid()`; JWT claims via `auth-email-hook`; **tenant-isolation regression suite in CI + nightly cron** (the #1 launch gate).
3. **Phase 2 — the one role-aware shell + hat-switcher.** Compose existing surfaces as permissioned modules; replace the four-door splash; de-lane chrome. *(Largest single effort; the actual "merge.")*
4. **Phase 3 — public IDX SSR site.** Execute `MIGRATION-PLAN.md`. **Needs: acquistorealestate.com codebase + Google Cloud feed creds.**
5. **Phase 4 — collapse duplicates.** Fold ~35 Merge surfaces into their canonical; archive + 301 the ~4 + the version doors.
6. **Phase 5 — hierarchical billing + marketplace** (merchant-of-record, revenue-share, nested books).
7. **Phase 6 — full RLS lockdown** table-by-table + the 12-point security/ops launch-gate register (see `MIGRATION-PLAN.md` §13).
8. **Phase 7 — scale, SEO, pen-test, launch** on acquistorealestate.com.

**Discrete "Build/Planned" items (not on the critical path):** Pure Social — 10 features (8 Build, 2 Planned: agent profile page, video reel); Calendar views + Google/Outlook sync; 4 roadmap syndication channels (Redfin, Rocket/Homesnap, Apartments.com, Broker VOW); 12 enrichment feeds.

---

## Caveats on this audit
- **Canonical DB not directly verified** (`mbnakfrkfwxinhxlisyq` is permission-denied to this session). Table/RPC counts come from the plan + Lane B2 architecture doc; grant me access to verify the 136-table / 59-RPC claims and the actual RLS posture.
- **%s are estimates** triangulated from repo artifacts + docs, not a task-by-task burn-down. The plan has no per-item status tracker; standing one up (a `pure_board` epic per phase) would make "% complete" exact going forward.
- I did **not** change any product surface — this is a read-only status audit.

*Companion to `MIGRATION-PLAN.md` (the §7 public-site execution plan). Generated from `lane-b/master-plan.html` + `roadmap-review.html` + `lane-b/MCP Roadmap.html` + `system-review.html` + `lane-b/PURE Hierarchy.html`.*
