Skip to content

[finding] driver-sql hardcodes the os migrate multi-value-columns CLI command id in an operator warning, and nothing fails if the command is renamed #12016

Description

@os-warren

Observational finding, filed from the #11535 engine round (PR #12012). ⛔ Not a defect anyone has hit — a missing guard on a coupling that #12012 introduced deliberately and commented, recorded so it is not re-derived later.

The coupling

packages/drivers/driver-sql/src/schema-drift.ts now carries:

exportconstMULTI_VALUE_COLUMN_REMEDY_COMMAND='os migrate multi-value-columns';

interpolated into the manual_column_type_change drift message, which an operator meets on every boot of an affected database and in os migrate plan. The string has to match the oclif command id derived from the path packages/cli/src/commands/migrate/multi-value-columns.ts.

Third copy: content/docs/deployment/cli.mdx spells the same command in its own table and examples.

Why it is only a finding

The value is a string, on purpose — the alternative is driver-sql importing from the CLI it is booted by, which is worse. The comment at the declaration says so. Renaming a shipped CLI command is already a breaking change that touches docs and a changeset, so the rename is not a quiet act.

What is nevertheless unenforced

Nothing mechanically ties the three spellings together. A rename that updated packages/cli and the docs but not the driver leaves the engine's warning pointing at a command that no longer exists — and the failure mode is a stale hint inside an otherwise correct warning, which no suite reads as wrong: driver-sql's own pin asserts the message contains the constant, and the constant would still match itself. Exactly the declared ≠ enforced shape, one layer out.

Scope of harm if it ever happens: an operator on a corrupted-column database is told to run a command that errors as unknown. They still get the hand-run SQL, which is printed after it and is separately pinned, so the remedy is not lost — only the good route is.

Possible shapes (⛔ not a recommendation — triage's call)

  1. A gate that asserts every CLI-command-id string literal appearing outside packages/cli resolves to a real command path. Cheap to state, and it is the general form: this is unlikely to stay the only such string.
  2. Narrower: a packages/cli test asserting its own command id equals MULTI_VALUE_COLUMN_REMEDY_COMMAND as imported from @objectstack/driver-sql — but the constant is deliberately not on that package's public index.ts surface, so this would mean widening it for a test, which was declined once already in fix(driver-sql): the stale multi-value column warning names os migrate multi-value-columns #12012.
  3. Accept it and do nothing; record the coupling in the docs-audit affected-docs ledger instead so a rename drags the docs page in.

Where it would land

scripts/ for option 1; packages/cli + packages/drivers/driver-sql for option 2.

Back-link: #11535 · PR #12012.

Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions