Skip to content

Contacts — client companies showed blank address/phone/email (incomplete unification migration)

Symptom

Client companies on the Contacts page rendered with blank address / phone / email. Owner asked: bad migration, or wrong read path?

Diagnosis — routing is correct; the data was empty

  • The page reads aote-system/organizations with the right field names (org.contact.email, org.contact.phone, org.address.*) — verified in components/contacts/ClientCompanyContent.tsx, lib/individuals/crud.server.ts, lib/individuals/types.ts. No stale collection, no renamed field.
  • But 18 of 19 org docs had contact: null + address: null. The T-048 P3 contacts unification (2026-06-16, created.by == system:t048-p3) created the unified org docs but never copied contact/address across from the legacy per-subsidiary tebs-<sub>/clients records. The later T-081 UID re-key just re-keyed already-empty docs.
  • Source data survived in tebs-epl/clients (20) + tebs-mel/clients (1); each org records its origin in provenance (e.g. epl-clients/CALLI HORIZON LIMITED).

Fix — data backfill (owner-authorized)

  • scripts/backfill-org-contacts.ts resolves each empty org's source via provenance (deterministic), maps legacy→org schema (epl flat addressLine3district; mel already nested), merges only contact+address+updated, never overwrites a populated org.
  • Dry-run reviewed (one phone-format nit tightened) → executed: 18/18 backfilled; verified 0 orgs with null contact/address. Watch Music Limited (already populated) skipped.
  • Rollback: scripts/migration-backups/backfill-org-contacts-2026-07-02T05-44-56-056Z.json (local).
  • Owner authorization (2026-07-02, verbatim): "Draft and run the dry run, if works great and then proceed to the real run."

Notes

  • country left null (absent in the epl source — not fabricated); phone largely null in the source (only Ksana). Fill in the UI as needed.
  • Source: EOP Local Assistance (fork) · session edb0abc7-6373-449b-8e31-379fd38d391b