Skip to content

Revert bundled httpx stubs (fixes #4366) - #4371

Open
anushamukka-dev wants to merge 1 commit into
facebook:mainfrom
anushamukka-dev:export-D114158493
Open

Revert bundled httpx stubs (fixes #4366)#4371
anushamukka-dev wants to merge 1 commit into
facebook:mainfrom
anushamukka-dev:export-D114158493

Conversation

@anushamukka-dev

Copy link
Copy Markdown
Contributor

Summary:
The bundled httpx stubs added in D110685002 caused a diagnostics regression between Pyrefly 1.1.1 and 1.2.0-dev.3 (GitHub #4366): code using httpx.MockTransport that type-checked cleanly in 1.1.1 started reporting missing-attribute errors (22 new diagnostics in one corpus repo).

Original intent of D110685002: mirror the existing bundled stubs (boto3, pandas, etc.) so that httpx users get out-of-the-box type checking even without the library installed locally / discoverable by the module resolver.

The slip-up: unlike those libraries, httpx ships py.typed with full inline annotations -- it is its own authoritative type source. The hand-written bundled stubs were therefore both unnecessary and, worse, incomplete: they omitted _transports/mock.pyi and never re-exported MockTransport from __init__.pyi. Because a bundled stub shadows the upstream inline types, this turned a fully-typed public API into false-positive diagnostics. (The stubs were also added without a corresponding entry in stubs_metadata.json.)

The fix: remove the entire httpx-stubs/ tree (all 19 vendored files), reverting D110685002. Import resolution then falls back to httpx's own authoritative inline types, which are complete and include MockTransport.

Why remove rather than patch MockTransport: adding the one missing symbol would only close today's gap. Maintaining a hand-written stub for an already-fully-typed library commits us to tracking parity with every future httpx release -- ongoing drift and maintenance cost for no benefit over the upstream types. Removal is the correct, durable fix.

Differential Revision: D114158493

Summary:
The bundled httpx stubs added in D110685002 caused a diagnostics regression between Pyrefly 1.1.1 and 1.2.0-dev.3 (GitHub facebook#4366): code using `httpx.MockTransport` that type-checked cleanly in 1.1.1 started reporting missing-attribute errors (22 new diagnostics in one corpus repo).

Original intent of D110685002: mirror the existing bundled stubs (boto3, pandas, etc.) so that httpx users get out-of-the-box type checking even without the library installed locally / discoverable by the module resolver.

The slip-up: unlike those libraries, httpx ships `py.typed` with full inline annotations -- it is its own authoritative type source. The hand-written bundled stubs were therefore both unnecessary and, worse, incomplete: they omitted `_transports/mock.pyi` and never re-exported `MockTransport` from `__init__.pyi`. Because a bundled stub shadows the upstream inline types, this turned a fully-typed public API into false-positive diagnostics. (The stubs were also added without a corresponding entry in `stubs_metadata.json`.)

The fix: remove the entire `httpx-stubs/` tree (all 19 vendored files), reverting D110685002. Import resolution then falls back to httpx's own authoritative inline types, which are complete and include `MockTransport`.

Why remove rather than patch `MockTransport`: adding the one missing symbol would only close today's gap. Maintaining a hand-written stub for an already-fully-typed library commits us to tracking parity with every future httpx release -- ongoing drift and maintenance cost for no benefit over the upstream types. Removal is the correct, durable fix.

Differential Revision: D114158493
@meta-cla meta-cla Bot added the cla signed label Jul 30, 2026
@meta-codesync

meta-codesync Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@anushamukka-dev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114158493.

@codspeed-hq

codspeed-hq Bot commented Jul 30, 2026

Copy link
Copy Markdown

Unable to generate the flame graphs

The performance report has correctly been generated, but there was an internal error while generating the flame graphs for this run. We're working on fixing the issue. Feel free to contact us on Discord or at support@codspeed.io if the issue persists.

@yangdanny97 yangdanny97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants