Skip to content

feat(core): profile-independent request policy and native http::Uri builder (#31, #32, #33) - #34

Merged
dbowm91 merged 11 commits into
mainfrom
feat/auto-20261120-b0acc027
Nov 21, 2026
Merged

dbowm91 merged 11 commits into
mainfrom
feat/auto-20261120-b0acc027

Conversation

@dbowm91

@dbowm91 dbowm91 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Implements #31, #32 and #33, with the verification work those changes require.

Closes #31
Closes #32
Closes #33

What changed

#31 — proxy no longer pulls the policy bundle

proxy now selects native-http1 instead of the http1 alias, so proxy support no longer compiles in logical-retry, redirects and basic-auth. Measured in an isolated consumer crate (the workspace resolver unifies adapter features and cannot measure one crate), the resolved set is advanced-routing, high-level-url, hyper-rustls, native-http1, proxy, standard-route, tls-rustls, transport-http1.

high-level-url and tls-rustls stay — the proxy code needs them. Defaults and the http1/http2 aliases are byte-unchanged, and proxy keeps its own base64 edge, so Proxy-Authorization encoding is unaffected.

#32 — a URL-free request builder

New NativeRequestBuilder builds from an http::Uri and dispatches through the existing frame-preserving native path (Client::execute_http_body), with Client::get_uri/post_uri/request_uri as the entry points. RequestBody gained an http_body::Body impl so the native path accepts it without exposing http-body-util types publicly.

Acceptance note for review. The issue's criterion names a RequestBuilder, but that type is gated on high-level-url together with pub mod request/pub mod response (lib.rs:50, lib.rs:99), and Request holds a url::Url with public URL accessors — so it cannot exist in a native-http1 profile. The maintainer accepted NativeRequestBuilder as the resolution; the reasoning is recorded in the closure record.

#33 — profile-independent disable switches

without_retry() and redirect_policy() are callable in every profile, backed by an always-present Request::retry_disabled flag (consulted by the gated retry loop) and an always-present request-level Option<RedirectPolicy>. redirect.rs is ungated, so RedirectPolicy/RedirectDowngradePolicy exist everywhere. ClientBuilder::redirect_policy stays redirects-gated: the client-level policy is the redirect loop's own default, not a request assertion.

Adapter repair found during verification

Decoupling proxy exposed an accidental dependency: eggfetch-ffi exports ..._follow_redirects, ..._max_redirects and ..._basic_auth unconditionally, and got redirects/basic-auth only through the old proxy = ["http1", …] implication. --no-default-features --features proxy built at the merge baseline and broke here with four E0599 errors. The FFI manifest now names both capabilities explicitly, and scripts/check_adapter_features.py asserts it stays explicit (the guard was verified to reject the pre-fix manifest).

Verification

Tier 1 at the freeze 49f8910d: CHECK_EXIT=0, "All routine checks passed" — 1828 Rust workspace tests (0 failed, 0 ignored), 541 Python behaviour tests passed / 40 skipped, 134 compatibility smoke, eight-profile public_api_contracts matrix, lean behavioural suites.

Rust public-surface oracle: passed (8 profiles), cargo-semver-checks no semver update required (223 checks: 223 pass, 30 skip). Snapshot diff is additive only: 564 added, 0 removed.

clippy -D warnings exit 0, fmt clean, doc-link and doc-example checks green. FFI feature matrix re-measured against the merge baseline across eleven configurations; the only remaining failure (tls-rustls-only, 6 errors) is identical at the baseline and out of scope.

Known gaps — recorded, not papered over

  • M011 is conditionally closed. Tier 2 and Tier 3 have not run at the freeze. Tier 2 fails closed without target/downstream-qualification/artifact-manifest.json, which has no in-repo producer.
  • The live Stage C binding is invalidated by these executable changes; a fresh exact-SHA qualification is required before any compatibility claim. Recorded in plans/httpx-parity-correction-status.md.
  • Not patch-compatible. A downstream crate relying on proxy implying http1 observably loses that closure, so the release carrying this must be a minor bump. The version stays 0.3.0; this PR authorizes no publication.
  • The proxy-only profile is documented as a manual recipe, not a declared matrix row — adding a CI matrix row needs maintainer approval.

Records

  • Plan: plans/implementation/core-transport-policy/011-profile-independent-request-policy-and-native-uri-builder.md
  • Closure: plans/closure/core-transport-policy/011-profile-independent-request-policy-and-native-uri-builder.md
  • Ledger: plans/httpx-parity-correction-status.md; registry and subsystem roadmap updated.

CI Test added 11 commits November 20, 2026 17:52
Implements #31, #32 and #33.

The `proxy` feature now selects `native-http1` instead of the `http1`
alias, so proxy support no longer pulls the `logical-retry`/`redirects`/
`basic-auth` bundle the proxy transport never uses. The default feature
set and the `http1`/`http2` aliases are unchanged.

New `NativeRequestBuilder` builds a request from an `http::Uri` and
dispatches through the existing native frame-preserving path, so the
minimal native slice needs no `url`/`idna`/ICU closure. It stays a
separate type from the high-level `RequestBuilder`, keeping the
high-level signatures and public surface intact.

`without_retry()` and `redirect_policy()` are now available in every
profile, backed by an always-present `Request::retry_disabled` flag and
an always-present request-level redirect policy. With `logical-retry` and
`redirects` enabled both are honored exactly as before.

Tier 1 is green including the eight-profile contract matrix; the Rust
public-surface oracle snapshots are regenerated for all eight profiles
with an additive-only diff.
The `proxy` feature implication change in 05f14f4 is a Cargo
feature-graph change, which `cargo-semver-checks` classifies as a major
lint under both `--release-type patch` and `--release-type minor`. The
Rust public surface itself only gained items: the eight-profile snapshot
diff against the previous baseline has zero removed lines.

Advance the oracle baseline to 05f14f4 so the semver cross-check
measures drift from the state that already carries the intentional
change, matching how the previous feature-graph change (the
`standard-http1`/`native-http1` split) is already inside the old
baseline. The eight-profile snapshot oracle and the semver cross-check
are both green against the new baseline.
Decoupling `proxy` from the `http1` alias exposed an accidental dependency
in the FFI adapter. Its C ABI exports `eggfetch_client_builder_follow_redirects`,
`..._max_redirects` and `..._basic_auth` unconditionally, and those drive
`ClientBuilder::follow_redirects`/`max_redirects` and `AuthScheme::basic`.
The crate never named `redirects` or `basic-auth`, because the old
`proxy = ["http1", ...]` implication supplied both transitively.

Measured at the previous merge baseline, `cargo check -p eggfetch-ffi
--no-default-features --features proxy` succeeded; after the proxy change it
failed with four E0599 errors. The core dependency now names both capabilities
explicitly, which repairs the non-default configuration without changing the
default build (its `http1` feature already implied both).

Losing `logical-retry` in that configuration has no behavioral effect: the FFI
exposes no retry API and sets no policy, and `send_with_retry` dispatches
straight to `dispatch_attempt` when no policy is enabled, which is
`send_with_redirects` whenever `redirects` is present.

`scripts/check_adapter_features.py` now asserts those two capabilities stay
explicit, so the requirement cannot silently become transitive again. The
guard was verified to reject the pre-fix manifest.

Tier 1 is green: 1828 Rust workspace tests, 0 failed; 541 Python behaviour
tests passed.
…dation

Core Transport M011 (#31, #32, #33) changed executable inputs, so the Stage C
binding at `cef0e7aa…` no longer describes the tree. This records that state
and closes the open release-consequence question in the plan.

- `plans/httpx-parity-correction-status.md` gains a live-state record at the
  top: M011 invalidated the binding, `cef0e7aa…` remains the last completed
  qualification, the milestone freeze `49f8910d…` has Tier 1 evidence only,
  and the current tree is unqualified. The 2026-11-16 renewal carries a
  superseded pointer, including a correction of its now-false claim that later
  profile and ledger edits are documentation only.
- The plan's §5 "Release consequence (open)" becomes "(resolved)": the oracle
  baseline advanced to `05f14f44…` rather than the coordinated version being
  bumped or the gate weakened, with the lint classification, the failed
  per-lint downgrade attempt and the additive-only surface diff as the reasons.
  §2.4 and §4 record the FFI regression the change exposed and the eleven-way
  matrix that measured it.
- A new closure record closes M011 as **conditionally closed**: the condition
  is the exact-SHA requalification this milestone invalidated, since Tier 2 and
  Tier 3 have not run at the freeze and Tier 2's downstream gate fails closed
  without an operator-supplied artifact manifest.
- The three canonical compatibility pages carry the same correction instead of
  continuing to assert a live binding.
- Two consequences are stated rather than papered over: the change is **not
  patch-compatible**, so the release carrying it must be a minor bump under
  `docs/reference/versioning.md`, and the version stays 0.3.0 — advancing the
  baseline authorizes no publication.
Issue #32's acceptance criterion names a `RequestBuilder`, but that type is
gated on `high-level-url` together with `pub mod request`/`pub mod response`
(`lib.rs:50`, `lib.rs:99`) and `Request` carries a `url::Url` with public URL
accessors. The type therefore cannot exist in the `native-http1` profile the
criterion targets, so the criterion is unsatisfiable as literally worded
without ungating the entire high-level surface.

The maintainer accepted `NativeRequestBuilder` as the resolution: it satisfies
the issue's stated intent — a URL-free builder constructed from an `http::Uri`
that dispatches — and the issue's own proposed change explicitly allows "an
equivalent" constructor.

Recorded in the closure record's requirement matrix plus a decision subsection,
and in the plan's design section, so the acceptance reading is not lost. No
ungating of `request`/`response` is in scope, and no code changed.
Found while preparing release qualification: several documents still described
the pre-#31/#32/#33 feature graph, and the new builder was missing from the
user-facing guide.

- `docs/architecture/feature-flags.md`: the proxy-only recipe's "Example" line
  omitted `proxy`, contradicting the recipe two lines above it. Removed, and
  the following sentence now says what the slice can actually do: because
  `proxy` keeps `high-level-url`, the string-URL `RequestBuilder` is usable
  there, while cookies and HTTP/3 need their own features.
- `docs/reference/feature-matrix.md`: `RedirectPolicy` was still marked as
  requiring `redirects`. Both policy types are ungated now (#33); only
  following redirects requires the feature. The Rust API surface table also
  gains the missing `NativeRequestBuilder` row, and `RequestBuilder` now states
  its `high-level-url` requirement.
- `docs/architecture/overview.md`: the `redirect` module row said it required
  `redirects`. It now separates the ungated policy/classification helpers, the
  `high-level-url`-gated URL helpers, and the `redirects`-gated pipeline.
- `docs/rust/guide.md`: new "URL-free request building" subsection covering
  `Client::{get_uri, post_uri, request_uri}`, the builder methods, and the
  single-attempt/no-URL-parsing semantics.
- `compat/downstream/README.md`: the manual `pip install` block had drifted
  from the canonical pins (`anthropic==0.39.0` vs `0.87.0`); it now installs
  from the two requirements files. Also documents that the artifact producer
  needs `build` + `setuptools`, which is why a first run fails with
  "No module named build".
- `README.md`: feature list mentions the URL-free builder.

Documentation only; no code, test, script or manifest changed, so the
executable-input binding is unaffected. Doc link and doc example checks pass.
Release preparation for 0.4.0. The change is not patch-compatible: a downstream
crate that relied on `proxy` implying `http1` observably loses that closure, so
under docs/reference/versioning.md this must be a minor bump, not 0.3.x.

- All six publishable crates move to 0.4.0, together with the internal
  dependency pins that reference them (`eggfetch-core`, `eggfetch-ffi`,
  `eggfetch-http-connect`) and `Cargo.lock`. `eggfetch-bench` stays 0.1.0 and
  unpublished.
- `pyproject.toml` and the experimental Node prototype's `package.json` and
  `package-lock.json` follow.
- `CHANGELOG.md`: the `[Unreleased]` entries move under
  `[0.4.0] - 2026-11-20`, with a fresh empty `[Unreleased]` and the comparison
  links updated.
- Documentation dependency snippets move from `version = "0.3"` to `"0.4"` so a
  reader does not resolve a 0.3.x crate.
- `TestPackageImports::test_import_version` pins the release version; it moves
  to 0.4.0 with the bump.

`python scripts/validate_release_versions.py` reports "All versions
consistent: 0.4.0", and the installed editable extension is rebuilt at 0.4.0 so
the runtime `__version__` matches the distribution. Doc link, doc example and
`cargo fmt` checks pass.
Release qualification for 0.4.0 at `2249860d…`:

- Tier 1, Tier 3 and the live security preflight are green. The downstream
  artifact manifest was produced with `scripts/build_downstream_artifact.py`,
  so Tier 2's downstream gate is no longer structurally blocked.
- Tier 2 is not green and 0.4.0 must not be published. Four attempts stopped in
  `tests/retry_integration.rs`, which assumes a closed idle connection always
  surfaces a *canceled* hyper error; under load it can surface
  `IncompleteMessage`, which `is_error_retryable` deliberately does not retry.
  The test file and `src/retry.rs` are byte-identical to `db3a553b` and the full
  suite fails the same test there, so this is pre-existing, not a regression.

The closure record's gate matrix, results and findings now separate what is
verified from what is not (MSRV, docs, FFI, resource, lifecycle, soak,
downstream, lossless merge and benchmarks never ran), and recommend a
deterministic fault injection instead of a timing wait as the corrective.
`plans/registry.md` records that 0.4.0 is prepared but unreleased, with no tag
and no publication.
`tests/retry_integration.rs` failed intermittently and blocked the extended
gate: four attempts stopped in it, on two different tests, always with
`HyperClient(SendRequest, IncompleteMessage)`.

The fixture closed a *pooled idle* connection and then asserted that the client
recovered. That only holds when Hyper classifies the failure as `is_canceled`,
which requires the client not to have observed the FIN before writing. Whether
it has is a scheduling race, so the expectation was not decidable: under load
the same close produced `IncompleteMessage` instead, which
`RetryPolicy::is_error_retryable` deliberately refuses to retry because a
mid-request failure may already have reached the server. A canceled error cannot
be forced from the server side either: when the pool does observe the close it
simply opens a new connection, and when it does not the failure is a mid-request
one.

The fixture is now `DroppedConnectionServer`: it reads one request and closes
without writing a response byte, which makes the mid-request failure
deterministic. The four racy tests become three that pin the contract eggfetch
owns:

- a dropped connection surfaces as `hyper_client` with a source;
- a three-attempt policy does not replay it;
- a one-shot body does not replay it.

Policy-driven recovery stays covered deterministically by
`retry_honors_retry_after_over_backoff` and the budget/status tests, which need
no socket race.

Verified on the target: 10 tests pass, then 15/15 sequential runs, then 24/24
runs with six concurrent workers over four rounds (the contention that used to
trigger the race). Zero failures in 40 runs.
`protocol_capability_tests` failed intermittently in full-suite runs:
`auto_policy_is_accepted_and_the_request_succeeds` panicked with "auto
negotiation must not fail", roughly one run in twelve.

Root cause is in the fixture, not the library. `CountingServer` binds a
non-blocking listener, and an accepted socket can inherit O_NONBLOCK from it
(observed on macOS). The per-connection thread then did a single read and wrote
a 200 response *unconditionally*, so when the read returned WouldBlock before
the client's request arrived the server answered a request it had never
received, and the caller saw `hyper_client` / `SendRequest` instead of the
protocol decision under test.

Two changes, both test-only:

- Set the accepted socket back to blocking before reading, so the head read
  waits for the request instead of racing it. This is a no-op on platforms
  whose accept() already returns blocking sockets.
- Read until the request head is complete (CRLFCRLF) rather than assuming one
  read returns it all, and only reply once a complete head arrived.

Diagnosis was reproduced, not inferred: with the old fixture the failure
appeared in 1 of 12 and 1 of 14 runs, and an instrumented build showed
`kind=hyper_client message=hyper client error: client error (SendRequest)`.
After the fix, 60 consecutive runs and 10 further runs were clean, and clippy
with -D warnings passes for the target.
The extended gate now completes. At the executable freeze `873cf2a3…`:

- Tier 2 `./scripts/check.sh extended`: exit 0, "Extended validation passed with
  1 optional check(s) skipped" — 6909 Rust tests with 0 failures, both
  compatibility profiles at 2082 passed / 1 skipped, the eight-profile Rust
  public-surface oracle at 223 checks with no semver update, MSRV rows on the
  exact Rust 1.89.0 toolchain, and the docs, FFI, resource, lifecycle, soak,
  downstream, lossless-merge and benchmark phases. The one skip is the
  policy-defined Node JS surface.
- Tier 3 and the live security preflight re-run clean at the same SHA.

The two fixture races that had blocked Tier 2 are recorded as resolved with
their diagnoses: the stale-idle retry fixture in `5d8108ef` and the FFI
capability fixture in `873cf2a3`. `plans/registry.md` now states that 0.4.0 is
prepared and gate-clean, with only the Stage C requalification and the
maintainer's tag/publication steps outstanding.
@dbowm91
dbowm91 merged commit 48ff1a3 into main Nov 21, 2026
1 check passed
dbowm91 pushed a commit that referenced this pull request Nov 21, 2026
Core Transport M011 invalidated the previous Stage C binding. The 0.4.0 release
qualification is the requalification it required, so the binding is renewed on
executable freeze 48ff1a3 (the merge of PR #34
into main). Its tree is byte-identical to the qualified freeze 873cf2a; the
only paths changed since are planning documents.

- plans/httpx-parity-correction-status.md gains the renewal record with the
  gate table; the M011 invalidation section carries a superseded pointer.
- compat/httpx/0.28.1/profile.toml and compat/httpx2/2.12.0/profile.toml move
  qualification-sha/date and push cef0e7a into the historical list.
- docs/residual-differences.md, docs/reference/compatibility.md and
  docs/reference/compatibility-stage-decision.md state the qualified binding
  instead of the invalidation.

Both facades are 2082 passed / 1 skipped, identical to the 0.3.0 figures; Tier 1,
Tier 2, Tier 3 and the live security preflight are green.
dbowm91 pushed a commit that referenced this pull request Nov 21, 2026
Records the release that shipped from `c9ddf4c2831693da854034f624055087fb312a33`
under signed tag `v0.4.0`, qualified at `873cf2a3a645649766fe7422528901eb4b2fc670`
and merged as `48ff1a39733c295906fd873cae757cc9eb149d6c` (PR #34).

- New `plans/closure/release-verification/009-0-4-0-publication.md` with the
  release identity table (both PyPI runs, the tag object, the GitHub Release),
  the gate evidence, the minor-version decision, and the recorded
  `--no-verify` deviation for `eggfetch-python`.
- `plans/registry.md` moves the current release to 0.4.0 and states that the
  Stage C binding was renewed on the merge commit as part of the release, so it
  is current rather than invalidated.

Evidence: all six crates resolve at 0.4.0 on crates.io; PyPI carries 25
distributions for the version; an isolated `pip install eggfetch==0.4.0` smoke
reports runtime 0.4.0 with the compat facade importing; the GitHub Release is
published from the existing signed tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant