Repository navigation
feat(metadata): add startOf to relative report dates - #466
Merged
Merged
Conversation
…week, month) A relative date filter value can carry startOf, truncating the shifted instant to the start of a UTC calendar unit. Lowered in the report view SQL for Postgres, SQLite/D1 and MySQL; validated in all four loaders; pinned by shared conformance fixtures and the persistence report-relative-date scenario. metamodelVersion 1.1 -> 1.2.
…ed 1.1.3 into [Unreleased]; other stale metamodelVersion and startOf docs already current.
dmealing
force-pushed
the
fm/mo-report-calendar-windows
branch
from
October 26, 2026 10:53
ef8db56 to
49fba60
Compare
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 Changed
startOf(day,weekISO Monday, ormonth):{ "now": "-P90D", "startOf": "day" }truncates to midnight UTC after the duration is applied. The loader refuses any otherstartOfvalue or extra key withERR_BAD_ATTR_FILTER, in every port's validator (TS, C#, Java, Python). The registry manifest andmetamodelVersionmove1.1to1.2.time-sql.ts) emits the truncation for Postgres, SQLite/D1 and MySQL. SQLite month and year shifts now clamp to the last day of the target month, matching Postgres and MySQL. This changes the SQL for existing SQLite relative dates that carry a month or year component, someta migrateproposes recreating those views.reporting-relative-startof,error-relative-date-bad-startof,error-relative-date-extra-key), a persistencereport-relative-datescenario, the cube-model fixture update, and the docs, CHANGELOG and roadmap updates for the new form.Validation
Risk Assessment
✅ Low: The change adds one optional value key,
startOf, with a closed three-unit set. All four ports validate it the same way, and fixtures pin that. I traced the lowerings on Postgres, SQLite and MySQL (after the round-1 and round-2 fixes) on concrete dates: ISO-Monday weeks, month clamping and the UTC wall clock all come out right. A model that does not usestartOfis unaffected, apart from the SQLite month clamp that was decided earlier and is documented.Testing
Baseline ci-local ts-fast/ts-unit already green. Drove SQLite startOf emission live at fixed clocks: month overflow on 31st/29th/Feb-leap, -P1Y month, day, Sunday and Monday week starts all match calendar answers (8/8). Targeted and full codegen-ts + metadata suites pass. Not driven live: Postgres instant+startOf DST fix and MySQL arm (no engine in sandbox); covered by unit tests only. Full repo-wide suite not rerun here (previously timed out on Docker).
Evidence: SQLite fixed-clock live check output
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
CHANGELOG.md- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainscd server/typescript && bun test packages/codegen-ts/test/projection/time-sql.test.ts packages/metadata/test/reporting-validation.test.ts (224 pass)cd server/typescript && bun test packages/codegen-ts packages/metadata (6798 pass, 0 fail)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.