Skip to content

Commit 358aa01

Browse files
heskewclaude
andcommitted
docs(DESIGN): document the startup version gate and downgrade-confirmation contract
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNbH9xnNHcd7V1a58ho2CJ
1 parent 588db78 commit 358aa01

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

DESIGN.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,3 +611,11 @@ runs pre-handshake there (auth is unaffected — it runs in the WS connection ch
611611
matching Node's upgrade-then-authorize order). No core component registers custom upgrade
612612
middleware; `onUpgrade()`/`installUwsWsHandler()` warn when one is registered for a uWS-served
613613
port so the gap is visible instead of silent.
614+
615+
## Version gate at startup: downgrades prompt, and only the minor direction is confirmable
616+
617+
`getVersionUpdateInfo()` (`dataLayer/hdbInfoController.ts`) compares the store's `data_version_num` (latest `system.hdb_info` record) against the binary's `packageJson.version` on every start. Data newer than binary by a **major** version → hard refusal. Newer by a **minor** version → `forceDowngradePrompt()` asks for confirmation; answering yes records the data version back down to the binary's version and boots (upgrade directives are deliberately additive/downgrade-compatible — see the struct-mode section above and `patchHdbSecretIsHashAttribute` in `upgrade/directives/5-2-0.ts`).
618+
619+
- The prompt's answer can be supplied non-interactively via `CONFIRM_DOWNGRADE` — env var or `--CONFIRM_DOWNGRADE` CLI arg; argv wins (`assignCMDENVVariables`). With no override and no TTY on stdin, the prompt throws instead of blocking on stdin forever (#2046 — services/CI hung with nothing in the log; the mismatch is also logged to hdb.log now).
620+
- Upgrades never prompt (see the rationale comment in `bin/upgrade.js`); only the downgrade direction confirms. `upgradeCertsPrompt()` on the 4.x upgrade path still has the block-on-stdin hazard.
621+
- Test-suite gotcha: `unitTests/dataLayer/hdbInfoController.test.js` pushes `--CONFIRM_DOWNGRADE yes` into `process.argv` in a `before()` without cleanup, so it leaks into every later test file in the mocha process; tests that exercise the prompt must scrub argv first (see `unitTests/upgrade/upgradePrompt.test.js`).

0 commit comments

Comments
 (0)