You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
driver-sql on SQLite: a field declaring defaultValue NOW(), added to a table that already holds a row, fails the object's whole schema sync ("Cannot add a column with non-constant default") #37413
area:datadomain:datafindingRecorded observation — held, not dispatchable until the findings triage round grades itpm:dispatchedDispatched to a dev agent by /pm-dispatchpriority:p1High: required for production / M2
Filing gate: ① · Source: fleet (os-dev measurement while dispatched on #37345, report comment 7181087036) · finding class a · reach: named producer (SqlDriver.syncSchema / initObjects on every SQLite datasource: createColumn → applyDeclaredColumnDefault → nowColumnDefault, sqlite branch).
Grading: area:data · Bug · reach measured at origin/maine8740c5 through TursoDriver's local (knex) face · evidence: measured.
Suggested-grade: p2 · adding a NOW()-defaulted datetime/date/time field to an existing populated table fails that object's sync on SQLite; workaround is to add the field without the default.
What
On SQLite, ALTER TABLE … ADD COLUMN refuses a non-constant DEFAULT once the table holds a row. The local face's createColumn emits the declared NOW() default as an expression (strftime('%Y-%m-%dT%H:%M:%fZ', 'now') for datetime, strftime('%Y-%m-%d', 'now') for date, a CASE expression for time), so the statement fails and the object's whole sync fails:
alter table r_t add column added datetime [not null] default (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) - Cannot add a column with non-constant default
Fails for a nullable field and for a storage.notNull field.
An empty table accepts the same statement.
A literal defaultValue on a populated table is accepted (notnull=1, dflt 'd').
Why it matters beyond the local face
#37345 makes the hosted (remote) Turso/libSQL face emit the declared column DEFAULTs the local face emits. Today the remote face accepts a nullable NOW() field added to a populated table (it adds the column with no DEFAULT). Copying the local face's NOW() emission there would turn that working hosted sync into this refusal, so #37345 keeps the remote face's current answer for exactly that case and this card carries it.
Acceptance (proposed, for triage)
The local face adds a field declaring defaultValue: NOW() to a populated SQLite table without refusing the sync, nullable and storage.notNull alike, and the existing rows get a defined value (the route — e.g. add the column with no DEFAULT then backfill, or a table rebuild — is the dev's to measure; ⛔ never by silently dropping the declared storage.notNull).
The drift differ reads the result as zero drift on the next sync.
The remote face (driver-tursoremote-transport.ts) then gives that same answer through syncSchema and syncSchemasBatch; turso-remote-not-null.test.ts case 5's remaining NOW() note is removed.
Related: #37345 (literal half), #37258, #21241 (MySQL NOW() precision).
Dedupe: searched 'non-constant default', 'NOW() default add column populated', 'nowColumnDefault' — no open card on this path.
Triage: lands in area:data · domain:data · Bug · priority:p2 · pm:queue · size S; rationale: on SQLite, adding a field with defaultValue: NOW() to a populated table fails that object's schema sync. Builders on the build path hit it, and a workaround exists (add the field without the default, then set it). That is Impeded × builders, p2, the same grade as its sibling #37345.
Route: area:data p2, to seat 5 zone o5-D (it holds #37345 on the same emitter) or seat 7. finding stays.
Claim: area o5-D round 3 · 2026-11-26T05:34Z · area:data p2 (area order 「开一个专区 ,接 data 的 p1 p2」, 2026-11-25T23:33Z). Routed to o5-D by triage 7181830348; held until its sibling PR #37425 merged (same files), which it did as 7291c6f41a.
Area: o5-D
Session: session_01Utp6CbdHk3orAeensH6EzS
Account: os-bill
Branch: claude/issue-37413-sqlite-now-default-populated
Worktree: objectstack-issue-37413
Domain: domain:data (as triage labelled it)
Seat: repo:objectstack#5
File surface: packages/drivers/driver-sql/src/** (createColumn / applyDeclaredColumnDefault / nowColumnDefault sqlite path, the schema-sync add-column door, schema-drift.ts only if the result must read zero drift), packages/drivers/driver-turso/src/** (remote-transport.tsNOW() withholding on a populated ADD COLUMN, turso-remote-not-null.test.ts case 5 NOW() note, turso-remote-default-parity.test.ts), tests named for the card, root .changeset/. ⛔ packages/spec/**, packages/objectql/**. Stop on breach and report.
Container & model: S, mode:subagent, model: default, effort: medium
Clause-②: no
Metadata-protocol: none
Responsibility: driver-sqlcreateColumn on SQLite in objectstack emits a non-constant DEFAULT on ADD COLUMN | no platform path covers it; the workaround is adding the field without the default, then setting it | builders adding a NOW()-defaulted datetime / date / time field to a populated table on any SQLite datasource, and after PR #37425 the remote face's NOW() half
Thread-read: 7181830348
Premise: holds — measured at e8740c5 by the #37345 dev (report 7181087036: Cannot add a column with non-constant default for nullable and storage.notNull alike); nowColumnDefault unchanged at origin/main7291c6f.
Pre-claim lane: packages/drivers/**. No open PR touches sql-driver-column-creation.ts.
Pre-claim deps: none open (PR #37425 merged).
Serial constraints cleared: PR #37425 (merged, same files).
Scope: the card's acceptance — the local face adds the field to a populated SQLite table without refusing, existing rows get a defined value, ⛔ never by dropping storage.notNull; drift reads zero; the remote face then gives the same answer through both doors and case 5's NOW() note goes. Fixes #37413.
Scope amendment · area o5-D · 2026-11-26T05:44Z · on the A1–A3 readings of the dispatched dev (rebuild is the only local route to "DEFAULT + NOT NULL + zero drift" in one sync; libSQL ALTER COLUMN reaches it remotely but CI's stub cannot run it)
Governing text: FieldSchema.storage.notNull — "Declaring this over existing null rows is a destructive migration gated by the schema-drift ceremony"; createColumn (#37258) and the remote face (#37281) already answer a populated ADD COLUMN they cannot complete by adding the column nullable and reporting drift, never by a table rebuild inside an additive sync. A rebuild on the boot / sync path contradicts that text, so it is not an option here.
The route, both faces, one source:
Additive sync adds a NOW()-defaulted field to a populated table nullable and with no DEFAULT, then fills the existing rows in one statement from sqliteNowColumnDefaultSql (every row takes the sync instant, the value the DEFAULT would have given). The sync never refuses.
The drift differ reports what is still owed: tighten_not_null for storage.notNull (as today), and — new — set_column_default for a column whose declared NOW() DEFAULT is absent (the literal arm skips NOW() today, so the gap is invisible). Zero drift once the ceremony has run.
{
"issue": 37413,
"status": "done",
"branch": "claude/issue-37413-sqlite-now-default-populated",
"pr": "https://github.com/objectstack-ai/objectstack/pull/37469",
"head": "f83ae7cf",
"premise_still_valid": true,
"route": "scope amendment 7183761626: nullable add + one-statement backfill on both faces; differ reports set_column_default (+ tighten_not_null); local ceremony rebuild applies; remote answers needs-table-rebuild (#37430)",
"gates": "dispatch-gates --commands at f83ae7cf: 72 derived, 70 exit 0, 2 NOT MEASURED (exit 3 PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test needs unshallow; check:dual-build-cjs-loads needs whole-repo dist); --ran reconciliation exit 0. check:facade-delegation-only exit 0 after keeping sql-driver.ts untouched. PR check-runs: in_progress at report time.",
"line_budget": "n/a: no skills/** or ratcheted ledger touched; sql-driver.ts facade unchanged (at ceiling)",
"deviations": "Remote NOW() differ arm and backfill are SQLite-only by design (the differ arm is gated on dialect sqlite). Full dogfood battery not run (not owed: no ! and no narrowing arm). Package-wide driver-sql and driver-turso suites ran before the single origin/main merge and the facade fix (at ce1140ae); targeted files were re-run at f83ae7cf.",
"files_changed": [
".changeset/37413-sqlite-now-default-populated.md",
"packages/drivers/driver-sql/src/index.ts",
"packages/drivers/driver-sql/src/schema-drift.ts",
"packages/drivers/driver-sql/src/sql-driver-37413-now-default-populated.test.ts",
"packages/drivers/driver-sql/src/sql-driver-column-creation.ts",
"packages/drivers/driver-sql/src/sql-driver-rotation.ts",
"packages/drivers/driver-sql/src/sql-driver-schema-sync.ts",
"packages/drivers/driver-turso/src/remote-transport.ts",
"packages/drivers/driver-turso/src/turso-remote-default-parity.test.ts",
"packages/drivers/driver-turso/src/turso-remote-not-null.test.ts"
],
"security_findings": "none"
}
Triage: lands in area:data · domain:data · Bug · priority:p1 · pm:dispatched · size S; rationale: on SQLite, the default local driver, adding a NOW()-defaulted date/time field to a table that already holds rows fails the whole object's sync. That is a common authoring step that errors, so p1. A workaround exists: add the field without the default.
Regraded p2 → p1 on the maintainer's go in the triage session (「升级吧」), after a review of every open p2 card.
{
"issue": 37413,
"status": "done",
"branch": "claude/issue-37413-sqlite-now-default-populated",
"pr": "https://github.com/objectstack-ai/objectstack/pull/37469",
"head": "835c89df",
"round": "L1 rework (verdict 7185425576, contract record 7185397364): M1, S1, S2, S4, N1, N2 and the docs-drift item",
"gates": "dispatch-gates --commands at 835c89df: 103 derived. 99 exit 0, including 3 doc gates re-run after building @objectstack/lint. 4 NOT MEASURED, exit 3 PREREQUISITE NOT MET (check-plugin-teardown-shape --self-test; check:skill-examples, check:dual-build-cjs-loads and check:lean-entry-closure need a whole-repo dist). --ran reconciliation exit 0. CI at 835c89df: 41 success, 17 skipped. Test Core (10/10) failed on attempt 1: a 5000ms timeout in plugin-security insert-check-post-image.test.ts, the first sqlite-wasm boot, with the runner saturated (import 1608s). Locally that test takes 112ms and the file passes 25/25 at this head. The relay's run_rerun_failed made attempt 2 green, Test Core included. The one cancelled PR-body guards run was superseded by a success at 08:10:04Z.",
"line_budget": "n/a: no skills/** or ratcheted ledger touched; the sql-driver.ts facade is untouched",
"deviations": "Commit e635f5f8 (docs) captured an in-flight ablation's mutation of sqliteNowBackfillSql (COALESCE removed) and was pushed. The new two-column test caught it, and 835c89df restores the file byte-identical to eba10fd3. 9ab00851, eba10fd3 and e635f5f8 were intermediate pushes; their CI reds were cancellations. Docs: types.mdx edited (the NOW() section gains one passage); drivers.mdx, virtual-objects.mdx and kernel/lifecycle.mdx carry no such statement and were not edited.",
"files_changed": [
".changeset/37413-sqlite-now-default-populated.md",
"content/docs/protocol/objectql/types.mdx",
"packages/drivers/driver-sql/src/index.ts",
"packages/drivers/driver-sql/src/schema-drift.ts",
"packages/drivers/driver-sql/src/sql-driver-37413-now-default-populated.test.ts",
"packages/drivers/driver-sql/src/sql-driver-column-creation.ts",
"packages/drivers/driver-sql/src/sql-driver-rotation.ts",
"packages/drivers/driver-sql/src/sql-driver-schema-sync.ts",
"packages/drivers/driver-turso/src/remote-transport.ts",
"packages/drivers/driver-turso/src/turso-driver.ts",
"packages/drivers/driver-turso/src/turso-remote-default-parity.test.ts",
"packages/drivers/driver-turso/src/turso-remote-not-null.test.ts"
],
"security_findings": "none"
}
area:datadomain:datafindingRecorded observation — held, not dispatchable until the findings triage round grades itpm:dispatchedDispatched to a dev agent by /pm-dispatchpriority:p1High: required for production / M2
Activity
objectstack-fleet commentedon Nov 26, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: lands in area:data · domain:data · Bug · priority:p2 ·
pm:queue· size S; rationale: on SQLite, adding a field withdefaultValue: NOW()to a populated table fails that object's schema sync. Builders on the build path hit it, and a workaround exists (add the field without the default, then set it). That is Impeded × builders, p2, the same grade as its sibling #37345.Route: area:data p2, to seat 5 zone o5-D (it holds #37345 on the same emitter) or seat 7.
findingstays.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
Claim: area o5-D round 3 · 2026-11-26T05:34Z · area:data p2 (area order 「开一个专区 ,接 data 的 p1 p2」, 2026-11-25T23:33Z). Routed to o5-D by triage 7181830348; held until its sibling PR #37425 merged (same files), which it did as
7291c6f41a.Area: o5-D
Session:
session_01Utp6CbdHk3orAeensH6EzSAccount:
os-billBranch:
claude/issue-37413-sqlite-now-default-populatedWorktree:
objectstack-issue-37413Domain:
domain:data(as triage labelled it)Seat:
repo:objectstack#5File surface:
packages/drivers/driver-sql/src/**(createColumn/applyDeclaredColumnDefault/nowColumnDefaultsqlite path, the schema-sync add-column door,schema-drift.tsonly if the result must read zero drift),packages/drivers/driver-turso/src/**(remote-transport.tsNOW()withholding on a populatedADD COLUMN,turso-remote-not-null.test.tscase 5NOW()note,turso-remote-default-parity.test.ts), tests named for the card, root.changeset/. ⛔packages/spec/**,packages/objectql/**. Stop on breach and report.Container & model:
S,mode:subagent,model: default,effort: mediumClause-②: no
Metadata-protocol: none
Responsibility:
driver-sqlcreateColumnon SQLite in objectstack emits a non-constant DEFAULT onADD COLUMN| no platform path covers it; the workaround is adding the field without the default, then setting it | builders adding aNOW()-defaulteddatetime/date/timefield to a populated table on any SQLite datasource, and after PR #37425 the remote face'sNOW()halfThread-read: 7181830348
Premise: holds — measured at e8740c5 by the #37345 dev (report 7181087036:
Cannot add a column with non-constant defaultfor nullable andstorage.notNullalike);nowColumnDefaultunchanged atorigin/main7291c6f.Pre-claim lane:
packages/drivers/**. No open PR touchessql-driver-column-creation.ts.Pre-claim deps: none open (PR #37425 merged).
Serial constraints cleared: PR #37425 (merged, same files).
Scope: the card's acceptance — the local face adds the field to a populated SQLite table without refusing, existing rows get a defined value, ⛔ never by dropping
storage.notNull; drift reads zero; the remote face then gives the same answer through both doors and case 5'sNOW()note goes.Fixes #37413.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
Scope amendment · area o5-D · 2026-11-26T05:44Z · on the A1–A3 readings of the dispatched dev (rebuild is the only local route to "DEFAULT + NOT NULL + zero drift" in one sync; libSQL
ALTER COLUMNreaches it remotely but CI's stub cannot run it)Governing text:
FieldSchema.storage.notNull— "Declaring this over existing null rows is a destructive migration gated by the schema-drift ceremony";createColumn(#37258) and the remote face (#37281) already answer a populatedADD COLUMNthey cannot complete by adding the column nullable and reporting drift, never by a table rebuild inside an additive sync. A rebuild on the boot / sync path contradicts that text, so it is not an option here.The route, both faces, one source:
NOW()-defaulted field to a populated table nullable and with no DEFAULT, then fills the existing rows in one statement fromsqliteNowColumnDefaultSql(every row takes the sync instant, the value the DEFAULT would have given). The sync never refuses.tighten_not_nullforstorage.notNull(as today), and — new —set_column_defaultfor a column whose declaredNOW()DEFAULT is absent (the literal arm skipsNOW()today, so the gap is invisible). Zero drift once the ceremony has run.rebuildSqliteTablePatched, which re-emits the declared DEFAULT and NOT NULL; on the remote face the entries answerneeds-table-rebuild, carried by driver-turso remote: a changed or removed literal defaultValue on a column the remote face created is reported as drift it can never apply (set_column_default / drop_column_default answer needs-table-rebuild) #37430 (no hosted statement CI cannot run lands here).Acceptance, replacing "drift reads zero after the sync": the sync succeeds on both faces with every existing row filled; drift then lists exactly the owed entries; after the local ceremony the column carries the
NOW()DEFAULT (and NOT NULL when declared) and drift is empty; case 5 records the remote half with its pointer to driver-turso remote: a changed or removed literal defaultValue on a column the remote face created is reported as drift it can never apply (set_column_default / drop_column_default answer needs-table-rebuild) #37430.Fixes #37413.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
os-dev-report
{ "issue": 37413, "status": "done", "branch": "claude/issue-37413-sqlite-now-default-populated", "pr": "https://github.com/objectstack-ai/objectstack/pull/37469", "head": "f83ae7cf", "premise_still_valid": true, "route": "scope amendment 7183761626: nullable add + one-statement backfill on both faces; differ reports set_column_default (+ tighten_not_null); local ceremony rebuild applies; remote answers needs-table-rebuild (#37430)", "gates": "dispatch-gates --commands at f83ae7cf: 72 derived, 70 exit 0, 2 NOT MEASURED (exit 3 PREREQUISITE NOT MET: check-plugin-teardown-shape --self-test needs unshallow; check:dual-build-cjs-loads needs whole-repo dist); --ran reconciliation exit 0. check:facade-delegation-only exit 0 after keeping sql-driver.ts untouched. PR check-runs: in_progress at report time.", "line_budget": "n/a: no skills/** or ratcheted ledger touched; sql-driver.ts facade unchanged (at ceiling)", "deviations": "Remote NOW() differ arm and backfill are SQLite-only by design (the differ arm is gated on dialect sqlite). Full dogfood battery not run (not owed: no ! and no narrowing arm). Package-wide driver-sql and driver-turso suites ran before the single origin/main merge and the facade fix (at ce1140ae); targeted files were re-run at f83ae7cf.", "files_changed": [ ".changeset/37413-sqlite-now-default-populated.md", "packages/drivers/driver-sql/src/index.ts", "packages/drivers/driver-sql/src/schema-drift.ts", "packages/drivers/driver-sql/src/sql-driver-37413-now-default-populated.test.ts", "packages/drivers/driver-sql/src/sql-driver-column-creation.ts", "packages/drivers/driver-sql/src/sql-driver-rotation.ts", "packages/drivers/driver-sql/src/sql-driver-schema-sync.ts", "packages/drivers/driver-turso/src/remote-transport.ts", "packages/drivers/driver-turso/src/turso-remote-default-parity.test.ts", "packages/drivers/driver-turso/src/turso-remote-not-null.test.ts" ], "security_findings": "none" }Generated by Claude Code
objectstack-fleet commentedon Nov 26, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in area:data · domain:data · Bug · priority:p1 ·
pm:dispatched· size S; rationale: on SQLite, the default local driver, adding a NOW()-defaulted date/time field to a table that already holds rows fails the whole object's sync. That is a common authoring step that errors, so p1. A workaround exists: add the field without the default.Regraded p2 → p1 on the maintainer's go in the triage session (「升级吧」), after a review of every open p2 card.
objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
os-dev-report
{ "issue": 37413, "status": "done", "branch": "claude/issue-37413-sqlite-now-default-populated", "pr": "https://github.com/objectstack-ai/objectstack/pull/37469", "head": "835c89df", "round": "L1 rework (verdict 7185425576, contract record 7185397364): M1, S1, S2, S4, N1, N2 and the docs-drift item", "gates": "dispatch-gates --commands at 835c89df: 103 derived. 99 exit 0, including 3 doc gates re-run after building @objectstack/lint. 4 NOT MEASURED, exit 3 PREREQUISITE NOT MET (check-plugin-teardown-shape --self-test; check:skill-examples, check:dual-build-cjs-loads and check:lean-entry-closure need a whole-repo dist). --ran reconciliation exit 0. CI at 835c89df: 41 success, 17 skipped. Test Core (10/10) failed on attempt 1: a 5000ms timeout in plugin-security insert-check-post-image.test.ts, the first sqlite-wasm boot, with the runner saturated (import 1608s). Locally that test takes 112ms and the file passes 25/25 at this head. The relay's run_rerun_failed made attempt 2 green, Test Core included. The one cancelled PR-body guards run was superseded by a success at 08:10:04Z.", "line_budget": "n/a: no skills/** or ratcheted ledger touched; the sql-driver.ts facade is untouched", "deviations": "Commit e635f5f8 (docs) captured an in-flight ablation's mutation of sqliteNowBackfillSql (COALESCE removed) and was pushed. The new two-column test caught it, and 835c89df restores the file byte-identical to eba10fd3. 9ab00851, eba10fd3 and e635f5f8 were intermediate pushes; their CI reds were cancellations. Docs: types.mdx edited (the NOW() section gains one passage); drivers.mdx, virtual-objects.mdx and kernel/lifecycle.mdx carry no such statement and were not edited.", "files_changed": [ ".changeset/37413-sqlite-now-default-populated.md", "content/docs/protocol/objectql/types.mdx", "packages/drivers/driver-sql/src/index.ts", "packages/drivers/driver-sql/src/schema-drift.ts", "packages/drivers/driver-sql/src/sql-driver-37413-now-default-populated.test.ts", "packages/drivers/driver-sql/src/sql-driver-column-creation.ts", "packages/drivers/driver-sql/src/sql-driver-rotation.ts", "packages/drivers/driver-sql/src/sql-driver-schema-sync.ts", "packages/drivers/driver-turso/src/remote-transport.ts", "packages/drivers/driver-turso/src/turso-driver.ts", "packages/drivers/driver-turso/src/turso-remote-default-parity.test.ts", "packages/drivers/driver-turso/src/turso-remote-not-null.test.ts" ], "security_findings": "none" }Generated by Claude Code