Skip to content

Records → WOPCs tab shows no WOPCs after the WOPC field restructure

Symptom

The Records page WOPCs tab renders an empty list — no WOPCs at all — after the owner restructured the WOPC document fields.

Owner, 2026-06-24 (verbatim): "I have recently restructured the fields in WOPCs and I think that's probably why the WOPC tab on the Records page is now showing no WOPCs at all."

Root cause (proven against live Firestore)

The WOPC restructure (T-089, Phase 5 migration, 2026-06-24) moved the "created" timestamp from the top level (createdAt) into a group (WOPC.created.at), and the reference number from referenceNumberWOPC.refNumber. But getAllWOPCs (the function feeding the tab) still asked Firestore to sort by the top-level createdAt — and Firestore silently excludes every document that lacks the field you sort by. Post-migration 0 of 34 WOPCs have a top-level createdAt, so the query returned nothing.

  • Live data: payees/JC/wopc/* (33) + payees/JN/wopc/* (1) in tebs-epl; none carry top-level createdAt or referenceNumber.
  • This is not RBAC: the WOPC endpoint gates on ERL access, and the owner is super_admin (passes the gate). It's purely the stale query field.

Resolution

Structural → escalated to T-110 (fixed there): drop the stale .orderBy('createdAt'), reconstruct the ref number from WOPC.refNumber, sort on WOPC.created.at. Commit 6dfb0a1d.