Repository navigation
Description
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:
- The CLI looks for
stash.config.tsin the current folder and in every folder above it. - If it finds one with a literal
databaseUrlthat differs from the flag, it prints a warning: "Ignoring --database-url: … Probing the config's database." - 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
- Make an explicit
--database-urlwin instash eql preflight, as it does instash eql verify: passflagWins: true. - Keep the current behaviour when no flag is given: use
stash.config.tsif found, then the usualDATABASE_URLchain. - Update the code comment, the tests, the
stash-cliskill, and any CLI help text that describe preflight's precedence. - Add a
stashchangeset, since this changes what the command does. - Leave
stash eql installas it is. Whether its config literal should also lose to the flag is a separate question.
Evidence
- Verified:
resolve-diagnostic-url.tsonnext, theflagWinsoption, 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
stashcommands give a config literal precedence over--database-url? This was not checked.
Activity
fix(cli): describe preflight's --database-url precedence in its help