Skip to content

fix(starlite): Gate request body collection on data_collection experiment - #7260

Merged
ericapisani merged 2 commits into
masterfrom
py-2419-request-body-starlite
Aug 26, 2026
Merged

fix(starlite): Gate request body collection on data_collection experiment#7260
ericapisani merged 2 commits into
masterfrom
py-2419-request-body-starlite

Conversation

@ericapisani

@ericapisani ericapisani commented Aug 26, 2026

Copy link
Copy Markdown
Member

Attach request.data only when "incoming_request" is present in
data_collection.http_bodies. When the experiment is unset, behaviour is
unchanged; when it is set, it takes precedence over send_default_pii.

Refs PY-2419
Refs #6283

@linear-code

linear-code Bot commented Aug 26, 2026

Copy link
Copy Markdown

PY-2419

@ericapisani
ericapisani marked this pull request as ready for review August 26, 2026 13:40
@ericapisani
ericapisani requested a review from a team as a code owner August 26, 2026 13:40
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

118295 passed | ⏭️ 6732 skipped | Total: 125027 | Pass Rate: 94.62% | Execution Time: 420m 10s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +30
Passed Tests 📈 +31
Failed Tests 📉 -1
Skipped Tests

➖ Removed Tests (1)

View removed tests
  • test_continuous_profiler_auto_start_and_stop_sampled[non-experiment-thread]
    • File: tests.profiler.test_continuous_profiler

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2479 uncovered lines.
✅ Project coverage is 90.27%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    90.27%    90.27%        —%
==========================================
  Files          193       193         —
  Lines        25472     25474        +2
  Branches      9378      9378         —
==========================================
+ Hits         22992     22995        +3
- Misses        2480      2479        -1
- Partials      1432      1431        -1

Generated by Codecov Action

Base automatically changed from py-2419-request-body-litestar to master August 26, 2026 16:19
…ment

Attach `request.data` only when "incoming_request" is present in
`data_collection.http_bodies`. When the experiment is unset, behaviour is
unchanged; when it is set, it takes precedence over `send_default_pii`.

Refs PY-2419
Refs #6283
@ericapisani
ericapisani force-pushed the py-2419-request-body-starlite branch from 59e4a8f to 71be800 Compare August 26, 2026 16:19
The test module uses `from __future__ import annotations`, so the quoted
annotation `data: "Dict[str, Any]"` is stored as the literal string
`'"Dict[str, Any]"'`. `get_type_hints` evaluates that to the plain string
`'Dict[str, Any]'`, which becomes a `ForwardRef` that Python <= 3.10 never
resolves further.

Starlite builds its OpenAPI schema eagerly in `Starlite.__init__`, so the
unresolvable `ForwardRef` made `starlite_app_factory()` raise
`ImproperlyConfiguredException` and took down the entire starlite suite on
py3.8. Dropping the quotes resolves correctly on every Python version.
@ericapisani
ericapisani merged commit 1ec2d5d into master Aug 26, 2026
144 checks passed
@ericapisani
ericapisani deleted the py-2419-request-body-starlite branch August 26, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants