feat(http): astrid:[email protected] per-request control surface#60
Conversation
…ersion Bump the contracts submodule pin to 812c833 (canonical wit main: #17 astrid:[email protected], #16 session 1.1.0, plus the already-landed #14/#15 process changes) and re-sync astrid-sdk/wit/astrid-contracts.wit. The bundle diff is the new session 1.1.0 records (list/get_meta/update/delete/search); astrid:http is a host/ package and is not part of the interfaces/ bundle. astrid:http now ships two frozen versions side by side. build.rs keyed each deps dir by package name alone, so [email protected] and [email protected] both landed in deps/astrid-http/ and wit-bindgen rejected the second (package identifier astrid:[email protected] does not match previous package name of astrid:[email protected]). Key each deps dir by name@version so multiple frozen versions of one package coexist; the inline world imports only astrid:http/[email protected].
Move the http module to astrid:http/[email protected] (additive superset of @1.0.0) and add the per-request control surface. An unset option reproduces @1.0.0 behaviour exactly, so the change is backward-compatible. Request gains fluent builders: .timeout/.connect_timeout/.first_byte_timeout/.read_timeout (Duration -> ms, saturating), .redirect(RedirectPolicy{Follow,Error,Manual})/.max_redirects, .max_response_bytes/.max_decompressed_bytes/.auto_decompress, .https_only/.integrity. send and stream_start build request-options from the stored controls and call http-request-opts / http-stream-start-opts. Response gains the @1.1.0 metadata accessors final_url/redirect_count/elapsed/wire_bytes. New error-code arms (redirect-blocked, too-many-redirects, integrity-mismatch, scheme-denied, decompression-bomb, dns-error, tls-error) flow through host_err -> SysError::HostError carrying the arm name, consistent with the existing http error mapping. http-upload-start and stream trailers are deferred until the host implements them (TODO notes left in place).
There was a problem hiding this comment.
Code Review
This pull request updates the astrid:http host interface to version 1.1.0, introducing per-request controls (such as timeouts, redirect policies, size limits, and subresource integrity) and exposing post-request metadata on responses. It updates the SDK to support these new options via fluent builders on Request and new accessors on Response. Additionally, the build system is updated to stage frozen WIT versions in separate directories to prevent package name collisions, and the session contract is extended to version 1.1.0 with conversation management capabilities. There are no review comments provided, and I have no feedback to provide on these changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Mirrors the astrid:[email protected] host contract into the Rust SDK, adding a per-request control surface on the HTTP Request builder and exposing new response metadata and error arms while keeping the default/unset behavior equivalent to astrid:[email protected].
Changes:
- Bumps/stages updated WIT contracts and updates
astrid-systo importastrid:http/[email protected], including handling multiple frozen versions of the same package inwit-staging. - Extends
astrid-sdk::http::Requestwith fluent per-request controls (timeouts, redirects, size/decompression caps, https-only, integrity) and threads options through*-optshost calls. - Extends buffered
Responsewith@1.1.0metadata accessors (final_url,redirect_count,elapsed,wire_bytes) and adds unit tests for the new option-building logic.
Reviewed changes
Copilot reviewed 8 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| CHANGELOG.md | Documents the new astrid:[email protected] per-request controls and the updated contracts pin/staging behavior. |
| astrid-sys/build.rs | Stages each WIT package version into its own deps/astrid-<pkg>@<version>/ directory to avoid wit-bindgen collisions. |
| astrid-sys/src/lib.rs | Updates the synthetic world to import astrid:http/[email protected] and documents multi-version staging. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] guest export worlds into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Stages the astrid:[email protected] contract alongside @1.1.0 for multi-version coexistence. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the astrid:[email protected] contract with request-options, response meta, and new errors. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] foundation I/O contracts into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sys/wit-staging/deps/[email protected]/[email protected] | Adds/stages the frozen astrid:[email protected] host contract into the repo. |
| astrid-sdk/wit/astrid-contracts.wit | Updates the SDK event/contracts bundle to include session 1.1.0 records. |
| astrid-sdk/src/lib.rs | Switches the wit_http alias to the disambiguated http1_1_0 module generated by wit-bindgen. |
| astrid-sdk/src/http.rs | Implements per-request options, uses http-request-opts/http-stream-start-opts, and exposes new response metadata accessors + tests. |
Comments suppressed due to low confidence (1)
astrid-sdk/src/http.rs:335
- The doc comment for
parse_methodstill referencesastrid_sys::astrid::http::host::HttpMethod, but this module now aliasesastrid_sys::astrid::http1_1_0::hostaswit_http. Updating the link avoids broken docs/confusion when browsing rustdoc.
/// Parse a textual HTTP method to the typed
/// [`astrid_sys::astrid::http::host::HttpMethod`] variant. Non-standard
/// methods fall through to `Other(String)`.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The staging moved to deps/astrid-<pkg>@<version>/ (multi-version support), but the build.rs top comment, the astrid-sys crate doc, and CLAUDE.md still described the old deps/astrid-<pkg>/ layout. Per Copilot review on #60.
Summary
Mirrors the
astrid:[email protected]host contract (shipped onwitmain#17, implemented in the kernel #1050) into the Rust SDK: per-request HTTP controls on theRequestbuilder, response metadata, and the new error arms. Backward-compatible — an untouchedRequestproduces empty options ==@1.0.0behaviour.Changes
0a50cfc→812c833(thewitmaincommit with[email protected]+ session 1.1.0); bundle re-synced viasync-contracts-wit.sh.astrid:http/[email protected].astrid:httpis the first host package with two version files, which tripped the wit-bindgen "two versions in one deps dir" collision — fixedbuild.rsto stage each version in its owndeps/astrid-<pkg>@<version>/dir (same approach as the kernel). wit-bindgen disambiguates the module tohttp1_1_0, absorbed in a singlewit_httpalias.http: new fluentRequestoptions —.timeout/.connect_timeout/.first_byte_timeout/.read_timeout(Duration),.redirect(RedirectPolicy{Follow,Error,Manual})/.max_redirects,.max_response_bytes/.max_decompressed_bytes/.auto_decompress,.https_only(),.integrity().send/stream_startbuildrequest-optionsand call the*-optsfunctions.Responsegains.final_url()/.redirect_count()/.elapsed()/.wire_bytes(). The newerror-codearms surface with their distinct names through the existingSysError::HostErrormapping (no collapse).Verification
cargo build --workspace,cargo clippy --workspace -- -D warnings(CI-exact),cargo fmt --all --check,cargo test --workspace— all green. 7 new http tests (Duration→ms + saturation, RedirectPolicy mapping, unset→empty options, timeout-config population, partial-timeout None-fill, control-options population).Notes
host/package, not in theinterfaces/bundle); confirmed viasync-contracts-wit.sh --check.http-uploadand streamtrailers— TODO notes left; will surface when the host implements them.[email protected]yet) — tracked separately.