test: retire stale connections scenario tests (command removed in #221) - #246
Conversation
The `hotdata connections` command was removed in #221 (all commands scoped to the active database), but two scenario tests kept calling it: - `tests/connections_read.rs` — calls the removed `connections list`/`<id>`. It only existed to satisfy scenario-parity's file-existence check and skips in CI (no `HOTDATA_SDK_TEST_CONNECTION_ID`), so it was dead. The scenario has no CLI equivalent; a companion www.hotdata.dev PR opts the CLI out of it. Deleted. - `tests/auth_unknown_workspace.rs` — a security scenario (a fabricated workspace id must be rejected, no cross-workspace leak). It also called `connections list`, so it exited non-zero at *arg-parse* — passing for the wrong reason and never actually exercising the server rejection. Switched to `databases list`, a real workspace-scoped listing that reaches the gateway with the fabricated workspace id, restoring genuine coverage. Depends on hotdata-dev/www.hotdata.dev#290 (opts the CLI out of connections_read) merging first, or scenario-parity will still require the deleted file.
|
|
||
| #[test] | ||
| fn connections_read() { | ||
| let (cli, connection_id) = skip_if_no_connection!(); |
There was a problem hiding this comment.
nit: (not blocking) this was the only caller of skip_if_no_connection!, so deleting it leaves the whole connection-id scaffolding dead:
tests/common/mod.rs:265-292— theskip_if_no_connection!macro (won't warn, since#[macro_export]macros are exempt fromunused_macros)tests/common/mod.rs:48,70—TestEnv::connection_idand itsload_envwiring (silenced by the crate-level#![allow(dead_code)]).github/workflows/integration-tests.yml:98—HOTDATA_SDK_TEST_CONNECTION_IDpassed to the integration job
Since connections are resolved internally now and no scenario is expected to re-add a connections CLI surface, dropping these in the same PR keeps the harness honest — otherwise the next reader sees a supported connection-gated path that nothing uses. Fine to leave if you'd rather keep it as a hook for a future scenario.
There was a problem hiding this comment.
Verified the substantive claim: -w is global = true on Commands::Databases (src/cli.rs:52-58) and resolve_workspace (src/main.rs:74-78) returns an explicit --workspace-id verbatim with no client-side validation, so the fabricated id does reach the gateway as X-Workspace-Id. databases::list exits non-zero via e.exit() on API error (src/commands/databases.rs:943), so the non-zero assertion is real coverage now rather than an arg-parse artifact.
One non-blocking nit inline.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
What
Retire two scenario tests that call the
hotdata connectionscommand removed in #221 ("scope all commands to active database; remove connections command").Background
#221 deleted the
connectionscommand but left these tests behind (and never updated the server-side scenario manifest). They've been silently broken since:tests/connections_read.rs— calls the removedconnections list/connections <id>. It exists only to satisfy scenario-parity's file-existence check and skips in CI (HOTDATA_SDK_TEST_CONNECTION_IDis unset), so nobody noticed it was dead. The scenario has no current CLI surface (connections are resolved internally now). Deleted.tests/auth_unknown_workspace.rs— a security scenario: a fabricated workspace id must be rejected with no cross-workspace leak. It also calledconnections list, so it exited non-zero at arg-parse — i.e. it was passing for the wrong reason and never actually reached the server to verify the rejection. Switched todatabases list, a real workspace-scoped listing that hits the gateway with the fabricated workspace id, restoring genuine coverage. (The scenario'sops: ["*"]allows any op.)Dependency / merge order
Companion PR hotdata-dev/www.hotdata.dev#290 adds
clitooptional_foron theconnections_readscenario. That must merge first — until it does, scenario-parity fetches the live manifest (which still requires the CLI to havetests/connections_read.rs) and this PR'sscenario-paritycheck will be red. Once #290 is onmain, re-run and it goes green.Verification
cargo test+cargo fmt --checkpass locally;auth_unknown_workspacecompiles and skips cleanly without creds.connections listoutside an explanatory comment.