Skip to content

refactor: migrate raw HTTP to typed SDK handles#141

Merged
zfarrell merged 4 commits into
mainfrom
worktree-cached-prancing-bengio
Jun 5, 2026
Merged

refactor: migrate raw HTTP to typed SDK handles#141
zfarrell merged 4 commits into
mainfrom
worktree-cached-prancing-bengio

Conversation

@zfarrell
Copy link
Copy Markdown
Contributor

@zfarrell zfarrell commented Jun 5, 2026

Closes #131. Migrates the clean database and connection call sites from the seam's raw get_json/post_raw/delete_raw helpers to the SDK's typed resource handles; the lossy/closed-enum/raw-body-inspection sites stay raw as documented.

@sentry
Copy link
Copy Markdown

sentry Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 56.52174% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/connections.rs 0.00% 21 Missing ⚠️
src/databases.rs 73.23% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread src/connections.rs
eprintln!("error parsing response: {e}");
std::process::exit(1);
}
let result = CreateResponse {
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.

super nit: with this change CreateResponse is only constructed here and rendered via the manual json!/serde_yaml blocks below — it's no longer deserialized from a response body or serialized directly. The #[derive(Deserialize, Serialize)] on the struct (line 302) are now dead and can be dropped. (not blocking)

claude[bot]
claude Bot previously approved these changes Jun 5, 2026
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Clean refactor. Error handling via e.exit() reproduces the old api_error formatting (plus the 4xx re-auth hint), the Option<Option<_>> flattening is correct, and the SDK's required default_catalog is reflected in the updated mocks. One super-nit left inline.

Comment thread src/databases.rs Outdated
/// from the SDK's `DatabaseDetailResponse` (see the `From` impl), keeping the
/// `-o json`/`-o yaml` contract independent of the generated model's field order
/// and `Option<Option<_>>` nullability.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
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.

super nit: same as the CreateResponse note in connections.rs — after this migration Database (and likewise DatabaseSummary at line 12, DatabaseAttachment at line 39) are only ever built via their From<hotdata::models::…> impls and serialized for -o json/-o yaml output; nothing deserializes them anymore. The Deserialize in their derives is now dead and can be dropped (keep Serialize). CreateDatabaseResponse is unaffected — it's still deserialized on the delete+recreate raw path. (not blocking)

claude[bot]
claude Bot previously approved these changes Jun 5, 2026
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Clean refactor — call sites migrated to typed SDK handles with output shapes preserved via From impls, and tests updated to match the new response contracts. Only non-blocking super-nits on now-dead Deserialize derives.

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Clean, well-documented migration to the typed SDK handles. Verified the raw paths that intentionally stay (delete+recreate inspecting error bodies, CreateDatabaseResponse deserialization), the From impl flattening of Option<Option<_>> fields, and the discovery_status.to_string() lowercase convention (consistent with connections_new.rs). Test fixtures correctly updated with content-type headers and the now-required default_catalog field. Prior super-nits on dead Deserialize derives are addressed.

@zfarrell zfarrell merged commit faeef94 into main Jun 5, 2026
14 checks passed
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.

Migrate remaining raw-HTTP call sites to typed SDK handles

1 participant