VAB PPDR Branch Display + Invoice Numbering Fix
Date: 2026-07-30 (session 66) · Commits: entirely-api da3a5ef, entirely-portal b29ec6b
Symptom
Calendar day-sidebar showed “Client: Manassas” for the 11 Mathews County VAB desk reviews (Virginia Beach PPDR engagement, created via triage intake wizard 2026-07-29).
Root causes (two independent gaps, same underlying pattern)
- Frontend:
resolveBranchre-derived branch from the event title’s[UPR]account prefix with a hardcoded'UPR': 'manassas'fallback — a relic from when all UP-parked desk reviews were Manassas PPDR. It ignored the server’sbranchfield entirely. - Server:
calendar_eventsset branch from the owning account only (unlikely_pro), never consultingtriage_originating_branch. - Bonus find:
invoice_numbering’s originating-branch fallback used an inline 3-entry map (JES Baltimore/Manassas/Richmondexact strings) — “virginia beach” missed → 8 invoices numberedT-UPRO-INV-9178…9186instead ofT-VBEACH-INV-*.
What was NOT broken (verified via comm_log delivery evidence)
- Invoice delivery: Invoices@groundworks.com + Candice.Yi CC ✓
- Cert delivery: Stephaney TO, Permits CC filtered for non-Manassas origin ✓
- Reporting: branch-derivation-shared-helper (
derive_invoice_branch) already resolves these rows to VBEACH via originating branch ✓
Fixes
intake.calendar_events: new_origin_branch_slug()(all branches, all text variants); UP-parked rows resolve display branch from originating branch; triagesource_branchset widened; VAB/ROA/WV account codes mapped.invoice_numbering: fallback resolves viaconfig._TRIAGE_BRANCH_NAME_TO_ACCOUNT+INVOICE_BRANCH_CODES. First post-fix number came outT-VBEACH-INV-9188(VAB-9010, live proof).config: Roanoke/West Virginia added to_TRIAGE_BRANCH_NAME_TO_ACCOUNT.- Portal:
resolveBranchprefers serverev.branch;UPR→manassashack removed (UPR→unlikely_pro); Virginia Beach/Roanoke/West Virginia/ Hooksett display names;virginia_beach+unlikely_procolors.
Backfill
invoice_numbers.db ledger branch_code UPRO→VBEACH for the 8 issued rows.
Number strings deliberately unchanged — they are on delivered invoices
and payment reconciliation matches by invoice number. Backup:
/home/claude/.tmp/invoice_numbers.db.bak-20260730.
Pattern to remember
Every new JES branch must land in THREE maps or this recurs:
_TRIAGE_BRANCH_NAME_TO_ACCOUNT, INVOICE_BRANCH_CODES (both config), and
the calendar _branch_map/frontend BRANCH_DISPLAY_NAMES+BRANCH_COLORS.
Rule from session 63 stands: display-branch derivation goes through shared
config helpers, never inline maps.