Skip to content

fix(driver-sql): present Field.time as a wall-clock time-of-day on read (SQLite) - #2347

Merged
os-zhuang merged 1 commit into
mainfrom
claude/sqlite-time-readnorm
Jun 26, 2026
Merged

fix(driver-sql): present Field.time as a wall-clock time-of-day on read (SQLite)#2347
os-zhuang merged 1 commit into
mainfrom
claude/sqlite-time-readnorm

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What

Closes the one residual from #2346: Field.time. Field.time is a tz-naive wall-clock time-of-day, not an instant (established in #2004). A defaultValue: 'NOW()' time column historically took the full SQLite CURRENT_TIMESTAMP default, so a defaulted/legacy row read back a full 'YYYY-MM-DD HH:MM:SS' timestamp instead of a time-of-day.

Fix

formatOutput now repairs a Field.time value to just its time portion via toTimeOnly:

  • a legacy full timestamp (or a full ISO value that leaked into the column) → sliced to HH:MM[:SS[.fff]];
  • a value already a bare time-of-day → left untouched.

Deliberately narrow and read-only (no formatInput/coerceFilterValue counterpart): it only transforms legacy full-timestamp values that were already filter-broken, and never touches a bare time-of-day — so it introduces no write/read asymmetry and preserves exact round-trips for bare time-of-day values, including the field-zoo f_time guard ('14:30:00', #2022). Runs for every dialect (a native PG/MySQL TIME column already returns a time-of-day → no-op). Adds a timeFields registry + registration mirroring dateFields/datetimeFields.

Why not full canonicalization (write + filter)? That would impose a single canonical form #2004 deliberately left lenient and risk the field-zoo round-trip — out of proportion for this niche type. The narrow read-repair closes the actual gap without that cost.

Testing

  • @objectstack/driver-sql: 233 passed (+6 new in sql-driver-time-of-day.test.ts: legacy full-timestamp repair, full-ISO repair, bare time-of-day untouched (field-zoo parity), NOW()-default reads a time-of-day, list-path parity, null).
  • @objectstack/service-analytics: 164 passed (CRM cube time dimensions unaffected).

Completes the temporal-field read normalization: datetime → canonical ISO-8601-Z, dateYYYY-MM-DD, time → wall-clock time-of-day.

🤖 Generated with Claude Code

…ad (SQLite)
Field.time is a tz-naive time-of-day, not an instant (#2004). A
defaultValue:'NOW()' time column historically took the full SQLite
CURRENT_TIMESTAMP default, so a defaulted/legacy row read back a full
'YYYY-MM-DD HH:MM:SS' timestamp instead of a time-of-day.
formatOutput now repairs a Field.time value to just its time portion (toTimeOnly):
a legacy full timestamp (or a full ISO value that leaked into the column) is
sliced to HH:MM[:SS[.fff]], while a value already stored as a bare time-of-day is
left untouched. Deliberately NARROW + read-only (no write/filter counterpart) so
it introduces no write/read asymmetry and preserves exact round-trips for bare
time-of-day values (the field-zoo f_time guard). Runs for every dialect (a native
TIME column already returns a time-of-day → no-op). Adds a timeFields registry +
registration mirroring dateFields/datetimeFields.
Completes the temporal read normalization alongside #2346: datetime -> ISO-8601-Z,
date -> YYYY-MM-DD, time -> wall-clock time-of-day.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 26, 2026 12:45pm

Request Review

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests tooling labels Jun 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/driver-sql.

8 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/core/plugins.mdx(via @objectstack/driver-sql)
  • content/docs/concepts/implementation-status.mdx(via @objectstack/driver-sql)
  • content/docs/concepts/terminology.mdx(via @objectstack/driver-sql)
  • content/docs/getting-started/glossary.mdx(via @objectstack/driver-sql)
  • content/docs/guides/driver-configuration.mdx(via @objectstack/driver-sql)
  • content/docs/guides/packages.mdx(via @objectstack/driver-sql)
  • content/docs/protocol/objectos/index.mdx(via @objectstack/driver-sql)
  • content/docs/protocol/objectos/lifecycle.mdx(via @objectstack/driver-sql)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit bc22a89 into mainJun 26, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the claude/sqlite-time-readnorm branch June 26, 2026 12:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@os-zhuang