Skip to content

feat(queries,results): scope to database for SDK 0.8.0#204

Merged
zfarrell merged 2 commits into
mainfrom
chore/sdk-0.8.0-database-scoped-results
Jul 7, 2026
Merged

feat(queries,results): scope to database for SDK 0.8.0#204
zfarrell merged 2 commits into
mainfrom
chore/sdk-0.8.0-database-scoped-results

Conversation

@zfarrell

@zfarrell zfarrell commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Updates the CLI to hotdata SDK v0.8.0, which makes results and query runs database-scoped via a required X-Database-Id header. Adds a -d/--database flag to queries and results, resolves the scope (flag → HOTDATA_DATABASE → active database) and fails with an actionable hint when none is set instead of leaking the raw server error.

Comment thread src/commands/results.rs Outdated
/// Build an [`Api`] scoped to `database` when the caller passed `--database`,
/// otherwise the database resolved at construction (`HOTDATA_DATABASE` /
/// current database).
fn scoped_api(workspace_id: &str, database: Option<&str>) -> Api {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this scoped_api helper is duplicated verbatim in src/commands/queries.rs, and the same match database { Some(db) => api.scoped_to_database(...), None => api } is inlined twice more in src/commands/query.rs (execute and poll). Consider consolidating into a single helper — e.g. an Api::scoped_to_database_opt(self, Option<&str>) on the seam — so all four call sites share one implementation. (not blocking)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in a0e1050 — added Api::scoped_to_database_opt(self, Option<&str>) on the seam and routed all four call sites through it, removing the two duplicated scoped_api helpers and the inlined matches in execute/poll.

claude[bot]
claude Bot previously approved these changes Jul 7, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. SDK 0.8.0 database-scoping is applied consistently: the seam forwards X-Database-Id via get_json/get_result_arrow, require_database pre-flights with an actionable hint, and all main.rs call sites were updated. One non-blocking duplication nit left inline.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 22.05882% with 53 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/commands/query.rs 30.00% 14 Missing ⚠️
src/client/sdk.rs 42.85% 12 Missing ⚠️
src/commands/results.rs 0.00% 11 Missing ⚠️
src/commands/queries.rs 0.00% 8 Missing ⚠️
src/main.rs 0.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Prior consolidation feedback addressed — scoped_to_database_opt on the seam with all four call sites routed through it. Database scoping is applied consistently and header forwarding is verified by tests.

@zfarrell zfarrell merged commit 23741d6 into main Jul 7, 2026
14 checks passed
@zfarrell zfarrell deleted the chore/sdk-0.8.0-database-scoped-results branch July 7, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant