Skip to content

feat: bounded HTTP client facade for blocking and async consumers #167

Closed

Description

@zackees

Context

FastLED migration (#155) still needs reqwest for blocking artifact downloads, GitHub release metadata, HEAD probes, async debug POSTs, and HTTP/SSE server integration tests. Existing kernel HTTP calls are private ureq consumers in symbolize/discovery.rs and conpty_acquire.rs; there is no public HTTP client capability.

Proposal

Add an optional HTTP capability with facade-owned request, response, status, header, limit, and error types. Support GET/HEAD/POST, blocking streaming download and bounded small responses, plus async bounded pull-based body reads for SSE. Privately select a single implementation; never re-export backend types. Keep FastLED endpoints, JSON schemas, status interpretation, fallback policy, and staged publication in the application.

Acceptance criteria

  • Focused failing HTTP facade tests before implementation, then GREEN with real loopback servers.
  • Bound input/output bytes, header metadata, connection and total/progress time, redirects and retained chunk sizes; cancellation/drop must release response resources.
  • Test declared and undeclared body overflow, stalled headers/body, redirects, non-success responses, malformed URLs/headers, streaming, cancellation, and HTTPS trust behavior.
  • Support HTTPS without disabling certificate verification. Define cross-origin credential and downgrade redirect policy.
  • No public backend types; feature-isolation and supported-platform CI.
  • Migrate generic client tests upstream, retain FastLED protocol tests; publish exact usable release for application adoption.

Decisions

  • P2 migration capability, not a server-framework replacement; HTTP server ownership is a separate slice.
  • Start with blocking bounded transfers, but this issue is not complete until async POST and SSE reads can remove all FastLED reqwest usage including tests.
  • Use local fixtures for deterministic tests; do not require external services for routine tests.
  • Reuse existing kernel cancellation/deadline contracts where applicable; do not create a second runtime.

Related issues

#155 overall FastLED migration; FastLED/cli#229.

Activity

  1. zackees commented on Sep 13, 2026

    @zackees
    CollaboratorAuthor

    Pre-publication inspection found a cross-origin credential-policy gap: 307/308 redirects discard application headers but replay POST payloads to a different origin. The safe facade policy will reject cross-origin POST replay for 307/308 before connecting, while retaining same-origin replay and existing 301/302/303 POST-to-GET behavior. Adding a socket-observed RED -> GREEN regression; FastLED current callers need no cross-origin POST replay.

  2. zackees commented on Sep 13, 2026

    @zackees
    CollaboratorAuthor

    Local pre-push review identified response-byte drift under Cargo feature unification: a downstream reqwest gzip/brotli/deflate/zstd feature can enable automatic decoding and strip encoding/length headers before kernel validation. The facade will explicitly disable all four decoders and add an encoded-wire regression, including a reqwest/gzip-enabled run. Review also confirmed TLS rejection/hostname/downgrade fixtures remain outstanding; HTTP is still an unpublished draft.

  3. zackees commented on Sep 13, 2026

    @zackees
    CollaboratorAuthor

    Added four deterministic loopback TLS unit tests: trusted local HTTPS body, default rejection of an untrusted certificate, rejection of a trusted certificate for the wrong hostname, and HTTPS-to-HTTP downgrade rejection before plaintext connection. Test-only native-tls server uses checked-in public fixture identity; trust is scoped to one private test client, with no OS trust-store modification or external service. Mutation validation: temporarily disabling certificate/hostname verification and downgrade guard produced three expected failures; restored protections yield four passes. Strict HTTP-feature all-target Clippy and broader HTTP-enabled suite pass. Existing native --all-features CI includes these tests; platform execution is still pending. Fixture expires September 2036 and regeneration is documented.

  4. zackees commented on Sep 13, 2026

    @zackees
    CollaboratorAuthor

    Metadata contract audit: application header ceilings are post-parse acceptance limits, not allocation ceilings. Locked Hyper 1.11.0 has a separate finite HTTP/1 header parser threshold (8192+4096*100), default 100 parsed header fields, and 16KiB trailer/chunk-extension ceilings. Because a library lockfile does not constrain consumers, pinning the audited private Hyper dependency under http-client and adding transport-limit regressions with relaxed facade acceptance limits. No claim that the parser threshold equals total allocator/RSS usage.

  5. zackees commented on Sep 16, 2026

    @zackees
    CollaboratorAuthor

    Complete and adopted; closing with the evidence rather than leaving it open.

    kernal-api — src/http.rs behind the http-client feature, with tests/http_client.rs and docs/http-client.md. Verified present on main rather than inferred from the commit message alone.

    FastLED — crates/fastled-cli/src/dwarf_smoke.rs: kernal_api::http::Client::new(kernal_api::http::Limits::default())?.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions