Repository navigation
fix(driver-sql): a date field still on a date-time column filters as its calendar day on SQLite and MySQL; operator note for Postgres days stored early - #33270
Conversation
…ts calendar day on SQLite and MySQL
Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 14 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 597cbbf444588644d893910ece536afa0f7bff1c && git checkout 597cbbf444588644d893910ece536afa0f7bff1c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d4fbb4dbb655f1d1527eabeea0ef3af64f152663 654326d01f6321651ac9b31120001b5146824671 && git checkout -B drift-repro d4fbb4dbb655f1d1527eabeea0ef3af64f152663 && git merge --no-ff 654326d01f6321651ac9b31120001b5146824671
node scripts/docs-audit/affected-docs.mjs --json d4fbb4dbb655f1d1527eabeea0ef3af64f152663
|
|
domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC Request: review · area A4 · head 654326d Fixes #33002 #33001 · Clause-② no · Metadata-protocol none · 7 files, +139/−40. CI green at this head (Temporal Conformance runs on push to main only; the MySQL/Postgres cells are NOT MEASURED before merge — see the body). |
|
Contract-review-claim: session_016WV4czuuneAppDnJbrNejw · head 654326d · 2026-11-14T15:46Z review#2 (server area pilot, A4). |
Review: PASSHead: Clause-② no is right: no authorable key, value, type or refusal moves. #33002 makes an equality/range filter on a Checked:
Notes (no change needed):
|
|
domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC ACCEPT · area A4 · head 654326d · 2026-11-14T15:49Z
|
Requested by Elon · project thread
Fixes #33002
Fixes #33001
Clause-②: no
Metadata-protocol: none
维护者速读
packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts的filterColumnExpr新分支,其次sql-driver-rotation.ts登记这类列的那段,再看date-on-instant-column.ts。pnpm --filter @objectstack/driver-sql exec vitest run src/sql-driver-32851-date-on-instant-column.test.ts,预期 SQLite 格全绿(MySQL/Postgres 格在 CI 的 Temporal Conformance 任务里跑)。What changes
#33002. A
datetime→datepublish leaves the column's date-time type in place on every dialect (the narrowing would drop the time of day, so it is not applied). Postgres got a read rule in #33000; on SQLite (datetime, canonical UTC text) and MySQL (DATETIME, UTC session) the zone was never wrong, but a row written while the field was adatetimestill holds its time of day. It reads as its day, yetdue = '2026-11-12'compared the bare day with the whole instant and missed it, anddue > '2026-11-12'matched it.isPostgresInstantColumnTypebecomesisInstantColumnType(dialect, type): Postgrestimestamp with time zone; MySQLdatetime/timestamp; SQLitedatetime. The schema sync records suchdatefields on every dialect (sql-driver-rotation.ts), from thecolumnInfo()it already reads; a table created here still records none.filterColumnExprand its outside-the-builder twintemporalFilterColumnSqlread such a column as its calendar day per dialect: SQLitesubstr(CANONICAL_UTC_TEXT, 1, 10)(throughsqliteCanonicalDatetimeSql, so a legacy epoch value answers its UTC day too); MySQLdate(col); Postgres unchanged.strftime/date_format), unchanged.#33001 (maintainer ruling 15:05Z: no automatic repair; release-notes text on how an operator finds and corrects affected rows). A
patchchangeset on@objectstack/driver-sqlcarries the note: who is affected, a query that lists candidates, and theUPDATEthat moves a confirmed early day to its UTC midnight. No code.Tests
packages/drivers/driver-sql/src/sql-driver-32851-date-on-instant-column.test.ts(live dialect matrix): thedatetime-era row's read, equality filter and day bucket are now asserted on every cell, not Postgres only;$ltexcludes it and$gton the day finds nothing; the analytics filter door (temporalFilterColumnSql+temporalFilterValue) answers the same three rows on every cell (the bucket echo stays Postgres-only).Measurement and ablation (SQLite, local)
Before, at
e540baf8, a scratch probe (removed): aftersyncSchemaV1 (due: datetime) → rowdue: 2026-11-12T09:30:00.000Z→syncSchemaV2 (due: date) +applyPublishedColumnChanges(applied: []): column typedatetime, raw2026-11-12T09:30:00.000Z, read2026-11-12,where: { due: '2026-11-12' }→ only the row written after the publish; the day bucket already2026-11-12× 2.Ablation (registry population on SQLite/MySQL removed,
sql-driver-rotation.tsanddate-on-instant-column.tsrestored fromorigin/main): 3 failed — equality/range ($gtfoundera), thedatetime-era row (['created','updated']vs['created','era','updated']), the analytics filter door (same). Restored bygit checkout HEAD -- packages/drivers/driver-sql/src/,git status --porcelainempty, file green again.Suites and gates
pnpm --filter @objectstack/driver-sql exec vitest run: Test Files 253 passed | 13 skipped (266); Tests 4256 passed | 237 skipped (4493).pnpm --filter @objectstack/driver-sql typecheck: exit 0 (after a declaration build of the closure).node scripts/pm/dispatch-gates.mjs --commands→--ran: 64 families; 62 ran green locally. Not green locally:plugin-teardown-shapeself-test anddual-build-cjs-loads(exit 3, prerequisite not met: they need a full build),dts-closure(exit 1, same full-build prerequisite),query-options-erasureandtype-check-debt(stopped at a 300 s local timeout). CILint & Repo Gates,TypeScript Type CheckandBuild Coreare green on this head.Temporal Conformance (live PG + MySQL)job runs only onpushto main (it is skipped onpull_requestandmerge_group), so those cells are first measured by the post-merge main run.Acceptance notes
datetime→datepublish left behind are affected.datepath.Verification
Branch merged
origin/mainonce before the PR (44c8aa3b; nodriver-sqlchange came with it).Both cards carry a
Claim:namingclaude/project-thread-lta7t3(#33002, #33001).🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
Generated by Claude Code