Session 56 — Legacy Cert Routing: Stephaney + Permits.Inspections CC

What was built

Dustin’s rule: every cert for a project completed on or before 2025-12-31 (the legacy backlog / triage cutoff) goes TO Stephaney.Bilyard@jeswork.com with permits.inspections@jeswork.com CC’d. An audit of CERTS/sent_log.json across /data/projects/ (sends since 2026-05-01, joined to Supabase completion dates via the triage date chain) found 20 legacy cert sends and zero matched — 12 reached Stephaney without the permits CC, 3 went to the full JES Manassas branch list with Stephaney absent, 4 were manually inverted (Permits TO / Stephaney CC), 1 Anne Arundel send missed the permits CC.

The fix (entirely-api e91866f)

  • CERT_ROUTES [JES_TRIAGE] now carries Permits.Inspections@jeswork.com in cc.
  • resolve_cert_route_account_id (config.py — single choke point for send path, portal display, preflight, cert-gen) gained a legacy-backlog rule: any JES account (JES_TRIAGE or TRIAGE_ELIGIBLE_ACCOUNTS) whose completion date via TRIAGE_COMPLETION_DATE_CHAIN is ≤ TRIAGE_COMPLETION_CUTOFF routes its cert to JES_TRIAGE. Takes precedence over the triage→originating-branch swap. Groundworks accounts excluded; post-cutoff/unknown-date behavior unchanged (MAN-9096 branch-owned-desk-review guard survives).
  • resolve_completion_date moved from services/triage_eligibility.py into config.py (circular-import constraint); triage_eligibility re-exports it.
  • 7 new tests in tests/test_cert_pipeline.py::TestTriageCertRouting.

Verification

All 20 previously-misrouted records re-resolved live: 20/20 now → Stephaney TO + permits CC (Anne Arundel county CC still applied additively by resolve_route). Three 2026-completion Manassas controls still resolve to the branch list.

Open

  • Dustin to decide on re-sending the 20 wrongly-addressed certs (3 never reached Stephaney: 2913 Crestview Ct, 6214 85th Pl, 4400 72nd Ave).
  • Invoice routing deliberately untouched — parallel legacy rule on the invoice side is a separate decision.

Related: legacy-cert-routing-cutoff, triage_eligibility, cert delivery pipeline