Skip to content

feat(http): astrid:[email protected] per-request control surface#60

Merged
joshuajbouw merged 3 commits into
mainfrom
feat/http-1-1-0
Jun 24, 2026
Merged

feat(http): astrid:[email protected] per-request control surface#60
joshuajbouw merged 3 commits into
mainfrom
feat/http-1-1-0

Conversation

@joshuajbouw

Copy link
Copy Markdown
Contributor

Summary

Mirrors the astrid:[email protected] host contract (shipped on wit main #17, implemented in the kernel #1050) into the Rust SDK: per-request HTTP controls on the Request builder, response metadata, and the new error arms. Backward-compatible — an untouched Request produces empty options == @1.0.0 behaviour.

Changes

  • Contracts pin 0a50cfc812c833 (the wit main commit with [email protected] + session 1.1.0); bundle re-synced via sync-contracts-wit.sh.
  • astrid-sys: capsule world now imports astrid:http/[email protected]. astrid:http is the first host package with two version files, which tripped the wit-bindgen "two versions in one deps dir" collision — fixed build.rs to stage each version in its own deps/astrid-<pkg>@<version>/ dir (same approach as the kernel). wit-bindgen disambiguates the module to http1_1_0, absorbed in a single wit_http alias.
  • astrid-sdk http: new fluent Request options — .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_start build request-options and call the *-opts functions. Response gains .final_url()/.redirect_count()/.elapsed()/.wire_bytes(). The new error-code arms surface with their distinct names through the existing SysError::HostError mapping (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

  • The contracts bundle diff (+196 lines) is session 1.1.0 records only — a coordinated side-effect of the pin bump (http is a host/ package, not in the interfaces/ bundle); confirmed via sync-contracts-wit.sh --check.
  • Deferred (host returns not-implemented / none): http-upload and stream trailers — TODO notes left; will surface when the host implements them.
  • sdk-js mirror is deferred (its contracts submodule is behind and doesn't carry [email protected] yet) — tracked separately.
  • No version bump (release PRs are separate).

…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).
Copilot AI review requested due to automatic review settings June 24, 2026 17:33

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-sys to import astrid:http/[email protected], including handling multiple frozen versions of the same package in wit-staging.
  • Extends astrid-sdk::http::Request with fluent per-request controls (timeouts, redirects, size/decompression caps, https-only, integrity) and threads options through *-opts host calls.
  • Extends buffered Response with @1.1.0 metadata 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_method still references astrid_sys::astrid::http::host::HttpMethod, but this module now aliases astrid_sys::astrid::http1_1_0::host as wit_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.

Comment thread astrid-sys/build.rs
Comment thread astrid-sys/src/lib.rs
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.
@joshuajbouw joshuajbouw merged commit 3d5cae7 into main Jun 24, 2026
8 checks passed
@joshuajbouw joshuajbouw deleted the feat/http-1-1-0 branch June 24, 2026 18:32
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.

2 participants