build(deps): pin starlette directly so it can't float under fastapi#516
Merged
Conversation
starlette is fastapi's dependency, but fastapi declares only a floor (starlette>=0.46, no ceiling), so on our side it was unpinned and floated to the latest release on every build (already at 1.3.1). Declare it as a direct dependency with an upper bound (>=1.3.1,<1.4.0) so: - a starlette release can't change framework behaviour without a deliberate, reviewed bump of this line; and - a fastapi version that needs a starlette outside this range FAILS TO RESOLVE instead of swapping it in silently (the fastapi 0.137 + starlette 1.x trap that prompted this). Adds tests/test_dependency_pins.py (wired into the CI unit shard) to hold the invariant: starlette stays a direct dep with an upper bound, and fastapi keeps its ceiling. Resolution verified (pip dry-run exit 0).
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.
Makes it structurally impossible to bump fastapi (or rebuild) and silently change starlette underneath us.
The gap
starletteis fastapi's dependency, but fastapi declares only a floor (starlette>=0.46, no ceiling). We never pinned it ourselves, so on every build it floats to the latest release — it is already at 1.3.1 today underfastapi 0.136.1. That means a starlette release (or a fastapi bump that raises the floor) can change framework behaviour with no deliberate, reviewed change on our side.The guard
services/pyproject.toml: declarestarlette = ">=1.3.1,<1.4.0"as a direct dependency, adjacent tofastapiwith a comment. Now:services/tests/test_dependency_pins.py(new, wired into the CI unit shard): asserts starlette stays a direct dep with an upper bound, and fastapi keeps its ceiling — so the guard can't be quietly deleted.Verification
fastapi <0.137+starlette >=1.3.1,<1.4.0+sse-starlette→ exit 0, no conflict.pyproject.toml;ruffclean.Part of v0.38.1 alongside #512 and #513.