Tracker: Stephaney’s Consolidated Workbook Upload

JES’s system update (~2026-07) removed Stephaney’s access to the Closed Permits report. She now maintains a single all-branches Excel workbook: six branch sheets (BALT/MAN/RICH/ROA/VA BEACH/WVA), a color-legend sheet, an OVERDUES sheet (all branches merged), and a CLOSED sheet (full population, closures marked by green row fill or Notes starting “CLOSED” — convention confirmed with Stephaney 2026-07-07).

Changes

  • unlikely-api routes/tracker.py (commits f4b57db, 4c83663):
    • POST /tracker/upload-closures gains workbook mode — any file with a CLOSED sheet. Dual-shape: if the CLOSED sheet mirrors the full OVERDUES population (≥50% of its Project Ids), closures are the green-filled (FF92D050/FF00B050) or “CLOSED”-noted rows (marked mode, today’s shape); a substantially smaller sheet is treated as a curated closed-only roster where every row is a closure (roster mode). Final Date used as close date when present. The sheet’s trailing CLOSED True/False column is her team’s internal recon flag (“verified it’s in Unlikely’s system” — Stephaney 2026-07-07) and is ignored. New response fields: closure_mode, missing_from_report_records (tracker-open permits absent from the OVERDUES sheet; report-only). Legacy single-sheet format unchanged.
    • POST /tracker/upload-overdue prefers the OVERDUES sheet by name, maps the Final Date header, returns workbook_mode.
  • entirely-portal TrackerPage.tsx (commit 8d80a0d): “Upload Steph’s Workbook” button — one file, runs overdue sync then closures pass, combined summary.

Dry-run vs 2026-07-01 workbook

118 marked rows → 64 close, 54 already closed, 0 review, 0 unmatched; 706 missing-from-report flagged for review.

Live run 2026-07-07 (commit 36c336c)

First live run hung and exposed two bugs, both fixed:

  • Junk text in date cells: Final Date “RTS” (project 188636) → Postgres 400. _fmt_date/_fmt_datetime/workbook close_date now emit only date-like values; per-row error capture (write_errors in response) so one bad row can’t abort a batch.
  • rate_limiter middleware hang: its catch-all wrapped call_next, so any app exception was mislabelled “Redis error” and call_next re-invoked on a consumed request → client hung with no response. call_next moved outside the try. (The session-55 IndexError is this middleware’s other, separate bug.)

Result: closures moved 64 (46 dated 2026-07-07 + 18 from Final Date), tracker closed 637→701, open 5,645→5,581. Verified in Supabase. The 706 missing-from-report list is pending review with Stephaney.

Related: Tracker, tracker_permits, JES Branch Expansion