docs(sla): JSONB-vs-normalized decision for schedule/holidays (PMS-585) #414
Loading…
Reference in a new issue
No description provided.
Delete branch "docs/PMS-585-sla-jsonb-decision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PMS-585 (raised in PMS-567 SLA smoke)
Evaluate whether
business_hours.scheduleandholiday_calendars.holidays(JSONB) should be normalized into child tables. This is a design/research ticket; the deliverable is a recorded decision.Decision: keep JSONB
Adds
dev-docs/sla-jsonb-vs-normalized.md. Grounded in how the SLA module actually uses the data (verified acrosssrc/modules/sla/):->/->>/@>/jsonb_array_elements/ json-path WHERE anywhere). Every read SELECTs the whole column.clock.rs) loads each blob whole, parses toBusinessSchedule+HashSet<NaiveDate>, and computes deadlines in Rust, writing back plain timestamp columns.Normalizing would add a migration + backfill + read/write/editor rewrites for SQL queryability and constraints the app does not use. The layer that needs relational querying (
sla_policies/sla_targets) is already normalized. The doc captures the full trade-off table and the triggers that would justify revisiting (cross-tenant holiday reporting, DB-enforced per-day constraints, unbounded growth).One real gap (storage-independent)
Upserts validate only
name;schedule/holidaysaccept any JSON shape and malformed content is silently skipped at read time, which can distort SLA math. That is a validation gap, not a storage one - fix with Rust parse-and-reject on write (422), no normalization required. Filed as a separate follow-up ticket.No code/behavior change
Documentation only.
🤖 Generated with Claude Code