Skip to content

fix(driver-sql): self-heal numeric type fidelity on legacy SQLite columns + extend dogfood matrix#2028

Merged
os-zhuang merged 1 commit into
mainfrom
fix/field-type-fidelity-followup
Jun 18, 2026
Merged

fix(driver-sql): self-heal numeric type fidelity on legacy SQLite columns + extend dogfood matrix#2028
os-zhuang merged 1 commit into
mainfrom
fix/field-type-fidelity-followup

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Follow-up to #2025. Two gaps that fix left open:

1. Legacy columns don't get the fix

#2025 mapped rating/slider/progress to numeric columns — but only for newly created columns. SQLite never alters a column's type in place, and the schema reconciler (sql-driver.ts initObjects) only ADDS missing columns. So a column created before the fix keeps its TEXT affinity and would still read back '4' instead of 4 forever. (toggle/record/video/audio already self-heal because their fix routes through the read-side booleanFields/jsonFields registries — the numeric scalars were the odd ones out, relying on column affinity alone.)

Fix: a read-side numeric coercion — the new numericFields registry, single-sourced from NUMERIC_SCALAR_TYPES — coerces numeric-looking stored strings back to numbers on read, mirroring how dateFields already repairs legacy timestamp-typed Field.date rows. Fidelity no longer depends on column affinity alone.

  • Only strings are touched — a fresh REAL/INTEGER column already yields a number (no-op).
  • null stays null (not 0); genuinely non-numeric junk is preserved (not NaN).
  • SQLite-gated (Postgres/MySQL return typed numerics natively).

2. progress/record/video/audio were only unit-tested

The audit in #2025 also fixed progress (numeric) and record/video/audio (object→JSON), but those were only covered by the driver unit test. Extended the dogfood field-zoo HTTP matrix to guard them over real HTTP too.

Verification

  • New unit test reproduces a legacy TEXT column (pre-create as TEXT → initObjects must not alter it) and proves a stored '4' reads back as 4; a sibling test asserts null/'n/a' are left intact.
  • Full driver-sql suite: 160 passed (was 158).
  • Dogfood field-zoo HTTP round-trip: 26 passed (was 22) — progress/record/video/audio now guarded end-to-end.

🤖 Generated with Claude Code

…ns + extend dogfood matrix

The #2025 column-affinity fix only governs newly created columns: SQLite
never alters a column's type in place and the reconciler only adds
missing columns, so a rating/slider/progress column created before the
fix keeps TEXT affinity and still reads back '4' not 4.

- add a read-side numeric coercion (numericFields registry, single-
  sourced from NUMERIC_SCALAR_TYPES) that coerces numeric-looking stored
  strings back to numbers on read — mirroring the dateFields legacy
  repair — so fidelity no longer depends on column affinity alone; null
  and non-numeric junk are preserved (not 0/NaN)
- unit test: reproduce a legacy TEXT column and prove it self-heals
- extend the dogfood HTTP matrix to guard progress/record/video/audio
  over real HTTP (previously only driver-unit-tested)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 18, 2026 6:59am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/m labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/dogfood, @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 d9508d1 into main Jun 18, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the fix/field-type-fidelity-followup branch June 18, 2026 07:01
os-zhuang added a commit that referenced this pull request Jun 28, 2026
fix(plugin-form): guard modal/drawer against accidental discard of unsaved input (#2028)

objectui@50fd513db6666d7261e8424e756c8fa03fa9f1c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant