Skip to content

Fix CI type errors and the business-day off-by-one bug they were masking - #105

Merged
mycomind4-arch merged 1 commit into
mainfrom
fix/ci-type-errors-and-business-day-bug
Sep 11, 2026
Merged

mycomind4-arch merged 1 commit into
mainfrom
fix/ci-type-errors-and-business-day-bug

Conversation

@mycomind4-arch

Copy link
Copy Markdown
Owner

Type errors (fixes the red CI from #104)

All pre-existing, none introduced by that merge — confirmed by comparing against the identical error list from before it landed.

  • PropertyMap.tsx: MapLibre's GeolocateErrorEvent doesn't expose the PERMISSION_DENIED/POSITION_UNAVAILABLE/TIMEOUT constants GeolocationPositionError does — compare err.code against the standard numeric codes instead.
  • AdminPanel.tsx, PublicRecordsRequestPanel.tsx (×3), roundtrip.test.ts: (await res.json()).error/.projectId on an untyped Response now types as unknown rather than any — added explicit casts at each call site.
  • records-request.test.ts (×4): StageContext gained a required actor field the test's hand-built context never picked up.

Real bug this uncovered

With type-check failing, CI's Unit tests step never ran, hiding a second, unrelated failure: two failing assertions in statutes.test.ts.

Root cause: businessDaysBetween() parsed "YYYY-MM-DD" dates (which new Date(...) treats as UTC midnight) and then read/advanced them with local-time getDay()/setDate(). On any server whose local timezone is behind UTC — most of the US — every date reads back as the previous local day, silently misclassifying weekdays as weekends and undercounting business days by up to one. This directly affects due-process deadline compliance checks — the thing this app exists to get right.

Fixed by using getUTCDay()/setUTCDate() throughout.

Verification

  • npx tsc --noEmit — clean, 0 errors
  • npx vitest run — 324/324 passing (was 322/324 before the date-math fix)
  • npm run build — clean production build

🤖 Generated with Claude Code

…asking

Type errors (all pre-existing, none introduced by the prior merge):
- PropertyMap.tsx: MapLibre's GeolocateErrorEvent doesn't expose the
  PERMISSION_DENIED/POSITION_UNAVAILABLE/TIMEOUT constants that
  GeolocationPositionError does; compare err.code against the standard
  numeric codes (1/2/3) instead.
- AdminPanel.tsx, PublicRecordsRequestPanel.tsx (x3), roundtrip.test.ts:
  `(await res.json()).error` / `.projectId` on an untyped Response now
  types as `unknown` rather than `any`; added explicit casts at each
  call site.
- records-request.test.ts (x4): StageContext gained a required `actor`
  field that the test's hand-built context object never picked up.
  Added it once on the base object; the three spreads of it pick it up
  automatically.

Real bug found by fixing the above: with type-check failing, CI's Unit
tests step never ran, so a second, unrelated failure was hidden behind
it — two failing assertions in statutes.test.ts. Root cause:
businessDaysBetween() parsed "YYYY-MM-DD" dates (which `new Date(...)`
treats as UTC midnight) and then read/advanced them with local-time
`getDay()`/`setDate()`. On any server whose local timezone is behind
UTC — most of the US — every date reads back as the previous local day,
silently misclassifying weekdays as weekends and undercounting business
days by up to one. This directly affects due-process deadline
compliance checks, the thing this app exists to get right. Fixed by
using getUTCDay()/setUTCDate() throughout, verified via the full test
suite (324/324 passing) and a clean production build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mycomind4-arch
mycomind4-arch merged commit b6069af into main Sep 11, 2026
1 check passed
@mycomind4-arch
mycomind4-arch deleted the fix/ci-type-errors-and-business-day-bug branch September 11, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants