Skip to content

cli: a plain os dev (standalone stack) never runs autoMigrate 'safe' — the documented dev self-heal applies only to host configs, while plan and drift lines say "auto-applied at boot" #21733

Description

@objectstack-fleet

QA-source: #21721 · cli.dev-automigrate-policy · acceptance[5]

Clause A6 of cli.dev-automigrate-policy (rev 1) fails in the 17.7 pre-release run #21721 (subject 251a7dd4); verifier V6 reproduced it on fresh copies: CONFIRMED, medium. Predates 17.6.0.

Reproduction

  1. Blank scaffold: one object scaf_item with an org-scoped field qa_code: { unique: true }, no plugins, no datasources.
  2. os dev --no-watch -d file:A.db creates the NULL-safe index uniq_scaf_item_organization_id_qa_code … (COALESCE(organization_id,'__global__'), qa_code); stop.
  3. Replace it: DROP INDEX uniq_scaf_item_organization_id_qa_code; CREATE UNIQUE INDEX uniq_scaf_item_organization_id_qa_code ON scaf_item (organization_id, qa_code);
  4. os migrate plan --database-url file:A.db lists it as Safe: [recreate_index] … (auto-applied at boot under dev autoMigrate: 'safe').
  5. os dev --no-watch -d file:A.db (twice): only [schema-drift] … (auto-applied at boot under dev autoMigrate: 'safe') is logged — itself misleading — and the index stays bare.

Control: the same staged DB booted with OS_MODE=off logs [schema-drift] auto-reconciled recreate_index on scaf_item.organization_id and the index comes back NULL-safe (it also creates A.telemetry.db, which the default boot does not). Host configs (a plugins[] entry with init, e.g. the showcase) self-heal too, so a showcase-based run never sees this.

Mechanism

Every non-host config goes shouldBootWithLibrary (packages/cli/src/utils/plugin-detection.ts:47) → createStandaloneStack (serve.ts ~2763), which builds the SQLite datasource with driverConfig = { filename } and no autoMigrate (packages/runtime/src/standalone-stack.ts ~745-760); DefaultDatasourcePlugin's factory passes autoMigrate only when the config has it (service-datasource/src/default-datasource-driver-factory.ts:1140). Because a datasource plugin is present, shouldAutoRegisterStorageDriver (stack-collections.ts:276) is false, so the isDev ? { autoMigrate: 'safe' } injection (storage-driver.ts:370) never runs — nor the telemetry datasource's 'safe' (serve.ts:3283).

What declares the behaviour

content/docs/deployment/cli.mdx:966: "os dev runs the SQL driver with autoMigrate: 'safe' … applied … automatically on restart"; the clause; the CLI's own plan / drift text. (Side observation, not checked for intent: the standalone path also has no telemetry datasource.)


Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

Labels

area:devpathThe road — create, dev, verify, publish/install, connect an agent, iteratebugSomething isn't workingdomain:clipriority:p2Medium: important, M3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions