docs(adr): ADR-0053 — Phase 2 detailed design (reference-timezone model)#1975
Merged
Conversation
Adds a "Phase 2 — Detailed Design" section to ADR-0053 capturing the implementation plan now that Phase 1 (date-only storage, #1968) has landed: - Reframe into two axes — compute-tz (today()/daysFromNow, analytics bucketing, cron) vs render-tz (datetime display) — with distinct sources and risk profiles. - Reference-timezone resolver: precedence (user pref → tenant-scoped org default → UTC), the single resolveExecutionContext chokepoint, a new ExecutionContext.timezone field, and the three execution branches (interactive / scheduled job / flow). - Shared DST-safe primitive reused from preference-resolver's Intl.formatToParts pattern (no hand-rolled offset math). - Three decisions with rationale: D1 today() returns a Date at UTC-midnight of the reference-tz calendar day (forced by cel-js hydration; avoids the local-midnight-as-instant trap); D2 tz-aware analytics buckets in-memory uniformly, not dialect date_trunc (SQLite/MySQL have no tz support → cross-driver bucket skew); D3 wire report schedules onto the existing croner+tz adapter rather than delete the dormant cron_expression/timezone fields (liveness enforce). - The applyFormulaPlan read-time blind spot (no now/ctx/tz) to fix anyway. - Per-slice implementation map (file-level), open prerequisites (cel-js duration support; email rendering bypasses the formatter pipeline), and the "reference tz unset → UTC" feature-flag rollback. Refs ADR-0053, #1928. Builds on Phase 1 (#1968). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 16, 2026
Closed
Contributor
Author
Phase 2 implementation slices (tracked)Filed from the per-slice map in this ADR section. Each is independently revertable and gated behind "reference tz unset → UTC":
Cron day-boundaries ( |
This was referenced Jun 16, 2026
This was referenced Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Phase 2 — Detailed Design section to ADR-0053 now that Phase 1 landed (#1968 —
Field.dateis a tz-naiveYYYY-MM-DDstring at the driver boundary).This is the plan for review, not a commitment to ship. Each slice is independently revertable and gated behind "reference timezone unset → UTC" (today's behavior). Refs ADR-0053, #1928.
Highlights
compute-tz(today()/daysFromNow, analytics bucketing, cron day-boundaries) vsrender-tz(datetime display): distinct sources, distinct risk. Conflating them is the chief risk of Phase 2.resolveExecutionContextchokepoint, a newExecutionContext.timezonefield, and the three execution branches (interactive / scheduled job / flow).preference-resolver'sIntl.formatToPartspattern — no hand-rolled offset math.today()/daysFromNow()/daysAgo()return aDateat UTC-midnight of the reference-tz calendar day (forced by cel-js hydration; explicit callout of the "local-midnight-as-instant" trap that would re-introduce the silent-miss bug). Side-effect: fixes the "keeps wall-clock time" defect for free.date_trunc … AT TIME ZONE(SQLite/MySQL have no tz support → cross-driver bucket skew).cron_expression/timezonefields (the enforce resolution the spec-liveness gate wants).applyFormulaPlanblind spot — read-time formula fields evaluate with nonow/ctx/tz; worth fixing regardless of timezone.duration()support; email rendering bypasses the formatter pipeline), and the feature-flag rollback.Follow-up
The 6 implementation slices are being filed as separate tracked issues (linked under #1928).
🤖 Generated with Claude Code