address-display-state-abbreviation

Notes

  • 2026-11-02 (MAN-9290): “California, MD” rendered as “CA, MD” across the portal. Root cause in /opt/portal-v2/src/lib/format.ts formatAddress: any part at index >= parts.length - 2 was run through the state abbreviation map, and in a three-part address “street, city, state zip” that index IS the city slot. The inline comment claimed to guard this exact case; the index math was one position off. Fix (entirely-portal 04a4b51, pushed, built): stateSlotIndex() designates the single part that may hold a state (the last part, or the one before it when a bare ZIP trails), and CITY_NAMES_THAT_ARE_ALSO_STATES blocks our state-named towns even when they do land in that slot (the “City, ZIP” shape with no state at all). Guard also applied to the state+zip branch and the final-pass regex. 5 new assertions, 208 portal tests green. Display-only: 0 of 6000 Supabase project rows carry an abbreviated city, and the project address of record is never overwritten by formatAddress output, so NO backfill is required. The bad string did leak outward through drag-reschedule’s address field, which feeds the field notification text and audit_log rows: 10 rows read “45920 Wild Rose LN, CA, Md 20619-3407”. Separate open flag: MAN-9290 is stored as California, MD 20634, but its permit placard reads GREAT MILLS, MD 20634-2441 and every other 20634 project in the book is Great Mills (California, MD is 20619), so the city/ZIP pairing on that record needs Dustin’s call.