Consolidation Diagnostic — OLD → NEW Supabase

Generated 2026-04-22 · combines branch-triage findings, inventory audits (master-crm-web, claude-skills, SPLIT-MANIFEST), live row counts, and archive-load results. One page to decide what must migrate before OLD is deleted.

STATUS — 2026-04-22 17:46 PT · OLD DECOMMISSIONED

DELETE complete. rdnnhxhohwjucvjwbwch is gone. frozen hrcom-deal-room pipeline (5 write jobs) — import-time RuntimeError on OLD creds. Leaked Service Role JWT scrubbed from 3 public-facing files. Commits dfbaa23 + e31de20.

disabled Scheduled task old-supabase-drift-patch — was syncing OLD→NEW, now unnecessary.

scrubbed Every rdnn reference in ~/.claude/ memory + ~/repos/ docs rewritten to mark OLD decommissioned and point to NEW. Commits 09b1738 + e31de20.

leftover Three Lovable apps still hardcode OLD and will break at next load: Debbie Deal Room (a3bf07f3), Pixel Perfect Clone (01b7b849), Next Chapter Reports (70bfa70e). Repoint via VITE_SUPABASE_URL + VITE_SUPABASE_ANON_KEY in each Lovable env.
DELETEDOLD project
74,021Rows preserved on NEW
21Migrated live
43Archived
0Gap rows
3Lovable apps need repoint

TL;DR — What the audit proved (original finding)

The 2026-04-20 consolidation migrated 5 table SCHEMAS only — not data. Those 5 tables (deals, clients, timeline_events, client_documents, call_transcriptions) exist on NEW at 0 rows. Meanwhile OLD kept accumulating data. Inventory audits found this but were never merged into main, so nobody noticed.

Bottom line: 6 tables on NEW are missing rows that exist on OLD, and 37 entire tables on OLD have never been copied to NEW. Total rows at risk if OLD is deleted now: 65,837. resolved by 0007 + load_archive.py

1. Row-Level Diff — OLD vs NEW for the 27 overlapping tables

1a. Tables where NEW is MISSING rows OLD has migrate now

TableOLD rowsNEW rowsMissingImpact
companies3,7801,4632,317Company master records — source for TAM, dossiers, letters
call_log1,39501,395Entire dialer call history — Salesfinity outcomes, timestamps
list_assignments1,9851,533452List membership (persons × lists) — drives dialer queueing
tam_verifications6,3306,113217TAM phone/email verifications
deals87087Deal records — migration was schema-only
do_not_call1441431DNC list — 1-row drift, low impact

1b. Tables already matched safe

TableRows (both)Note
tam_businesses8,350Largest table — migrated intact
tam_final3,000TAM curated list
dossier_provenance2,322
call_analysis2,273Salesfinity scored calls
dossier_runs1,638
dialer_queue646
tam_owner_profiles306
tam_scrape_runs287
outreach_queue82
sent_log, skills_registry, harvests, stories27 / 23 / 21 / 11Small tables, intact

1c. NEW grew past OLD NEW is authoritative

TableOLDNEWGained
targets201303+102
deal_research67134+67
dossier_final1027+17
campaigns521+16
analysis1326+13
acquisition_targets918+9
audits26+4
pipeline_log1,3431,345+2

2. Tables only in OLD — never migrated at all

37 tables, 65,837 total rows. Plan: import to NEW as {name}_archive_2026_04_22 so they survive deletion of OLD without colliding.

TableRowsCategory
data_quality_issues19,884Pipeline QA log — biggest unknown
tam_cost_log11,421Cost tracking per TAM action
tam_cost_per_record8,350Cost rollup per business
persons6,508Person records — Phoenix TAM identities
phone_numbers4,574Person × phone (multi-number)
person_scores4,023Call priority scoring
linkedin_identifiers2,304LinkedIn URL ↔ person mapping
enrichment_log1,000Exa / enrichment events
tam_cost_summary835Cost summary by day/agent
dossier_cost_log549
boomerang_targets227"Bring back" lists
follow_ups184Follow-up tasks
rep_phone_numbers80
buyer_dossiers63
pipeline_inspections46
llm_benchmark_runs30
lists27Dialer list definitions
script_phrases, orchestrator_log22 / 22
opener_patterns17
pipeline_summary, registry_docs14 / 13
analysis_rules8
cost_sources, reps, rep_status, outreach_funnel7 / 6 / 6 / 6
messages, comp_plans, user_settings5 / 4 / 4
transcripts3
dossiers, script_templates, llm_benchmark_research, report_companies, operators, approval_settings1 eachTail

3. Why this wasn't caught at 2026-04-20 consolidation

Missed because the auditing machine couldn't see 4 repos. The schema-audit branch (consolidation/supabase-audit, commit 714607f) was opened as a draft PR and abandoned. It would have shown these tables existed.

Repos not scanned at migration time

Claude Skills audit surfaced a smoking gun

db-export/old-instance/*.json in claude-skills repo contains an earlier snapshot (14 files): companies=1068, persons=1844, list_assignments=1533. The list_assignments number exactly matches what's on NEW today (1,533) — proving the snapshot pre-dates the migration. NEW was seeded from that old snapshot, OLD kept going, and the delta was never re-synced.

4. Branch triage — what was shelved on GitHub

nextchapter-crm had 9 stale branches predating the 2026-04-09 main merge window. After today's clean-up there are zero stale branches on any of the 3 active repos.

BranchDispositionWhy
frontend-v2-auditMerged PR #5Only truly unique branch — pure docs file docs/frontend-v2-audit-2026-04-08.md
backend-v2-bc4-integration-post-mortemClosedmain already has commit e6f9e2a "BC4: integration_post_mortem section" (same title) + fix patches on top. File 27,065 B on main vs 21,324 B on branch.
worktree-agent-a23ace34Closedmain has commit 829bf9f "BC1: deal_killer section — Q5 ... (cherry-pick from worktree-agent-a23ace34)" — literally cherry-picked.
backend-v2-br8-wiringCloseddebbie-research JSONs regenerated on main via BX1 overnight regen (acb799f), C2 root fix (953cf81), dead-sections cleanup (0c273e7).
backend-v2-exa-verifyClosedSame dossier regen chain supersedes Rippling/UKG/SAP JSONs.
backend-v2-rebuildDeletedahead=0 (already fully merged)
frontend-v2-renderersDeletedahead=0
clawdBot/nifty-liskovDeletedahead=0, 147 commits behind
refactor/cross-domain-inventoryDeletedahead=0, 108 commits behind

5. Inventory audit results (consolidated from 3 PRs now merged)

5a. master-crm-web / nextchapter-crm

5b. claude-skills

5c. SPLIT-MANIFEST (cross-cutting)

6. Migration plan (what happens next)

Ewing's rule: "we want to move and keep the data, not delete it." No OLD deletion until every non-match row is archived on NEW and verified.

Execution order — status

  1. done Generated supabase/migrations/0007_archive_old_supabase.sql — 43 {name}_archive_2026_04_22 tables (jsonb original_row, bigserial PK, RLS enabled).
  2. done Applied directly via psql with SUPABASE_DB_URL. Ledger recorded in schema_migrations with sha256.
  3. done Loaded rows via scripts/load_archive.py: 73,921 rows across 42 tables on first pass; call_log short by 24 (snapshot itself was partial).
  4. done Drift-patched via scripts/patch_archive_drift.py: pulled 50 new call_log + 26 new persons rows live off OLD. Archive now holds 74,021 rows = OLD's 74,021.
  5. in progress Stop writers to OLD. Salesfinity call-ingest on MacBook-27 (per harvest) and Lovable frontend are still POSTing to rdnnhxhohwjucvjwbwch. A daily drift-patch cron on this Mac Mini keeps the archive current meanwhile.
  6. blocked Final verification — run compare_old_live.py one more time after writers are cut; confirm zero drift.
  7. manual confirm Delete OLD project rdnnhxhohwjucvjwbwch via Supabase Management API.

Scripts now in the repo

7. Decisions pending for Ewing