Skip to content

stash eql preflight ignores --database-url when stash.config.ts sets a database — let the flag win #1966

In review

Description

@auxesis

Background

stash is the CipherStash CLI, in languages/typescript/packages/cli. stash eql preflight is a read-only check. It connects to a PostgreSQL database and reports whether EQL can be installed there. EQL (Encrypt Query Language) is the SQL library CipherStash installs into the database. The check also reports which features the database supports.

For example, it reports whether the ORE operator class can be created. The Go SDK README tells users to run it before they choose an ORE column type.

A user names the database with --database-url. A project can also name a database in stash.config.ts, with databaseUrl.

Problem

When stash.config.ts sets a literal databaseUrl, stash eql preflight uses it and ignores --database-url:

  1. The CLI looks for stash.config.ts in the current folder and in every folder above it.
  2. If it finds one with a literal databaseUrl that differs from the flag, it prints a warning: "Ignoring --database-url: … Probing the config's database."
  3. It then checks the config's database, not the one the user named.

So a user who types --database-url for database B, from inside a project whose config names database A, gets the results for database A. The only sign is one warning line. In --json mode the warning goes to stderr, so the output a script reads from stdout contains no sign at all. A user can then choose a column type that the database they meant cannot support.

stash eql verify already does the opposite: an explicit --database-url wins there. The comment on resolveDiagnosticDatabaseUrl in languages/typescript/packages/cli/src/commands/db/resolve-diagnostic-url.ts says preflight's behaviour is deliberate, because it copies the config-loading path of stash eql install.

Nothing catches this today, because the behaviour is intended and a test may pin it.

Proposal

  1. Make an explicit --database-url win in stash eql preflight, as it does in stash eql verify: pass flagWins: true.
  2. Keep the current behaviour when no flag is given: use stash.config.ts if found, then the usual DATABASE_URL chain.
  3. Update the code comment, the tests, the stash-cli skill, and any CLI help text that describe preflight's precedence.
  4. Add a stash changeset, since this changes what the command does.
  5. Leave stash eql install as it is. Whether its config literal should also lose to the flag is a separate question.

Evidence

  • Verified: resolve-diagnostic-url.ts on next, the flagWins option, and its doc comment, read on 2026-11-27.
  • Found while writing the Go SDK README's "Choose a column type" section in docs(golang): add a guide to choosing a column type #1926. That section documents the current behaviour, so it needs one line changed once this is fixed.

Open questions

  • Do other stash commands give a config literal precedence over --database-url? This was not checked.

Metadata

Metadata

Assignees

Labels

JavaScriptStash CLIbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions