Repository navigation
Phase 1 of the API redesign: make the safe spelling the only one - #56
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bound ty from below so the lowest-direct job runs the checker the URL type test asserts on, and say in the changelog and docs what a bare, wrapped or middleware-replaced SigningAuth request now does. Cover stream, paginate and PageRequest in the URL type probe, a Link header and an escaped path in the verbatim next-URL test, and a wrapped signer's 401. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Phase 1 of the public API redesign: safety by construction. The spec is
specs/2026-11-05-public-api-redesign-design.md(section 1). The plan isspecs/2026-11-05-phase-1-safety-by-construction.md. Both are committed here underspecs/, outside the published docs. This is a clean break, with no deprecation aliases.Breaking changes
LiteralString | Template | httpx2.URL.stream,paginateandPageRequest.strsuch asf"items/{uid}"no longer type-checks. It silently skipped path escaping: withuid="../../admin"it reached/admin.httpx2.URL(...)for a URL taken from a response.httpx2.URL, so they are sent verbatim with their escapes. Anystris still accepted at runtime.credential_headersandcredential_params.frozenset[str], empty when the middleware stamps none.HttpOptionsrefuses with aTypeError, naming the class or function, a middleware that leaves either out, misspells it (credential_header), or gives aset,list,stror non-str members.SigningAuthsigns every attempt, inside the retry layer.MiddlewareTransportsigns after the last middleware and before the credential guard, so a retry or hedge carries a fresh signature and a cross-origin redirect hop has the signature withheld.SigningAuthsigns. ASigningAuthwrapped in anotherhttpx2.Auth, or given to a barehttpx2.AsyncClient, sends unsigned. This fails closed: without the check, a wrapped signer's signature reached another origin.request.extensionsover.docs/configuration.md's HMAC example is now aSigningAuthsubclass.The
tydev dependency now has a lower bound (>=0.0.93), because a test runs ty to prove that an f-string URL is rejected.Left as is, on purpose
Middlewareinherits its two members fromheadgate._core.CredentialCarrierinstead of redeclaring them. Users only declare attributes and never import_core. Making the seam public belongs to the later phase that publishes the extension types (spec goal 4). For the same reason, the API snapshot showsCallUrlandCredentialCarrierby name, not their contents. The type test and the middleware tests guard those.sign()also runs on a hop the guard will strip. Nothing leaks: the guard removes the signature. Skipping the call would need a newtrusts()seam on the guard.CallUrlis a plain alias, not atypestatement. With atypestatement, ty reportsExpected CallUrland does not name the three accepted types.pragma: no coverlines in the tests predate this branch. One of them moved with the code it covers.Each task was implemented and then reviewed before the next started, and a whole-branch review ran at the end. Its findings are fixed in f91008c.
Checklist
uv run ruff check,uv run ruff format --checkanduv run ty checkpass, with no suppression commentsuv run python -m pytest --covpasses at 100% line and branch coverage (2257 tests).zensical build --strictand the benchmarks pass. The lowest-direct run passes, and so does an install without extras.CHANGELOG.mdhas an entry under "Unreleased"--snapshot-update, diff reviewed: only theurl:annotations and theMiddlewarebase list changed)🤖 Generated with Claude Code