Production Days Integer Cast Fix (2026-07-28)

Type: bugfix note Commit: entirely-api 6b5156e

Kilroy’s EOD closeout on MAN-9151 (534152, 5515 Charlcote Rd, Bethesda) surfaced a 22P02: projects.production_days is an integer column in Supabase, but both project-level write sites in services/field_inspection.py passed the reported float through (1.0 → PostgREST rejects the integer cast). SOW-line writes were unaffected (sow_lines.production_days accepts the value).

Affected paths:

  • eod_closeout (step 3b) — error was caught and returned in errors[], which is how Kilroy saw it.
  • mark_sow_inspected propagation — same bug, but swallowed with a detail-less warning (silent failure mode).
  • auto_calculate_and_write_production_days was already safe (returns int(ceil(...))).

Fix: new _project_days_int() helper — int(ceil(days)), partial days round up, matching the calculate_production_days convention. Applied at both write sites. MAN-9151’s rollup backfilled to 1 via the write service and verified.

Note: 26 projects have SOW-level production days with a NULL project rollup — that is the designed state (auto-calc defers to SOW-level; invoicing sums SOW lines first), not bug fallout. No backfill done.