Skip to content

fix: Read normalized rate limit headers - #3883

Merged
buenaflor merged 5 commits into
mainfrom
fix/rate-limit-header-casing
Jul 28, 2026
Merged

buenaflor merged 5 commits into
mainfrom
fix/rate-limit-header-casing

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Read package:http response headers using their normalized lowercase keys. This preserves category-specific Sentry rate limits instead of falling back to an all-category limit when header names arrive lowercased.

The transport tests now supply lowercase retry-after and x-sentry-rate-limits headers, matching the response map contract and covering both lookup paths.

Automated Dart tests were not run because this environment does not include Dart or FVM. git diff --check passes.

Fixes #3882

Requested by Gino Buenaflor via Junior.

--

View Junior Session in Sentry

Use lowercase keys when reading package:http response headers so category-specific rate limits are not missed.

Fixes #3882

Co-Authored-By: Junior <noreply@github.com>
Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Features

Flutter

  • Extend standalone app start by buenaflor in #3918
  • Add standalone app start tracing by buenaflor in #3896

Fixes

  • Read normalized rate limit headers by sentry-junior[bot] in #3883

Dependencies

  • chore(deps): update Android SDK to v8.50.1 by github-actions in #3921

Internal Changes

  • (deps) Pin Flutter development dependencies by buenaflor in #3913
  • (grpc) Move MockHub to _sentry_testing package by lucas-zimerman in #3908

🤖 This preview updates automatically when you update the PR.

@codecov

codecov Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.82%. Comparing base (3f5a205) to head (c8130c2).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3883      +/-   ##
==========================================
+ Coverage   85.94%   87.82%   +1.87%     
==========================================
  Files         240      346     +106     
  Lines        8767    12854    +4087     
==========================================
+ Hits         7535    11289    +3754     
- Misses       1232     1565     +333     
Flag Coverage Δ
sentry 87.62% <100.00%> (ø)
sentry_dio 97.73% <ø> (ø)
sentry_drift 93.57% <ø> (ø)
sentry_file 65.29% <ø> (ø)
sentry_firebase_remote_config 100.00% <ø> (ø)
sentry_flutter 91.85% <ø> (?)
sentry_grpc 99.09% <ø> (ø)
sentry_hive 77.48% <ø> (ø)
sentry_isar 74.37% <ø> (ø)
sentry_link 21.50% <ø> (ø)
sentry_logging 97.01% <ø> (ø)
sentry_sqflite 88.81% <ø> (ø)
sentry_supabase 97.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 389.30 ms 394.83 ms 5.52 ms
Size 14.55 MiB 15.87 MiB 1.31 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9993fa9 389.44 ms 390.85 ms 1.41 ms
c741aa5 360.67 ms 367.86 ms 7.19 ms
cdf371b 367.64 ms 377.02 ms 9.38 ms
ebccb5b 363.79 ms 371.10 ms 7.31 ms
6287dc4 390.30 ms 399.12 ms 8.82 ms
51520fc 351.89 ms 349.79 ms -2.10 ms
3fe9e80 362.67 ms 376.19 ms 13.52 ms
d8f332d 365.31 ms 349.98 ms -15.33 ms
819c1e7 449.80 ms 442.98 ms -6.82 ms
29e8ebe 389.91 ms 395.76 ms 5.84 ms

App size

Revision Plain With Sentry Diff
9993fa9 14.55 MiB 15.87 MiB 1.31 MiB
c741aa5 14.55 MiB 15.87 MiB 1.31 MiB
cdf371b 13.93 MiB 15.18 MiB 1.25 MiB
ebccb5b 13.93 MiB 15.18 MiB 1.25 MiB
6287dc4 13.93 MiB 15.18 MiB 1.25 MiB
51520fc 13.93 MiB 15.18 MiB 1.25 MiB
3fe9e80 14.55 MiB 15.87 MiB 1.31 MiB
d8f332d 14.55 MiB 15.87 MiB 1.31 MiB
819c1e7 13.93 MiB 15.00 MiB 1.06 MiB
29e8ebe 13.93 MiB 15.06 MiB 1.13 MiB

Previous results on branch: fix/rate-limit-header-casing

Startup times

Revision Plain With Sentry Diff
c5030fb 354.88 ms 368.66 ms 13.78 ms

App size

Revision Plain With Sentry Diff
c5030fb 14.55 MiB 15.87 MiB 1.31 MiB

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1242.98 ms 1252.62 ms 9.64 ms
Size 5.83 MiB 6.28 MiB 458.81 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d0371bb 1258.85 ms 1259.44 ms 0.60 ms
dc53d48 1252.06 ms 1255.61 ms 3.55 ms
c26ed0a 1244.11 ms 1263.85 ms 19.75 ms
81f83eb 1259.53 ms 1273.39 ms 13.86 ms
40c8f93 1234.27 ms 1261.98 ms 27.71 ms
dbd526b 1244.78 ms 1259.02 ms 14.24 ms
73dca78 1246.65 ms 1265.42 ms 18.76 ms
737ef5d 1255.65 ms 1252.24 ms -3.41 ms
3801d52 1267.76 ms 1266.10 ms -1.65 ms
5367726 1211.00 ms 1216.73 ms 5.73 ms

App size

Revision Plain With Sentry Diff
d0371bb 5.73 MiB 6.18 MiB 464.41 KiB
dc53d48 5.65 MiB 6.09 MiB 446.96 KiB
c26ed0a 5.53 MiB 5.97 MiB 453.76 KiB
81f83eb 7.86 MiB 9.44 MiB 1.58 MiB
40c8f93 5.53 MiB 6.00 MiB 479.94 KiB
dbd526b 7.86 MiB 9.44 MiB 1.58 MiB
73dca78 7.86 MiB 9.44 MiB 1.58 MiB
737ef5d 5.73 MiB 6.18 MiB 466.16 KiB
3801d52 5.73 MiB 6.17 MiB 455.54 KiB
5367726 5.73 MiB 6.17 MiB 455.87 KiB

Previous results on branch: fix/rate-limit-header-casing

Startup times

Revision Plain With Sentry Diff
c5030fb 1259.85 ms 1268.30 ms 8.44 ms

App size

Revision Plain With Sentry Diff
c5030fb 5.83 MiB 6.28 MiB 460.43 KiB

@buenaflor
buenaflor marked this pull request as ready for review July 14, 2026 12:05
Copilot AI review requested due to automatic review settings July 14, 2026 12:05

Copilot AI 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.

Pull request overview

This PR fixes rate-limit header parsing in the Dart HTTP transport by reading package:http response headers via their normalized lowercase keys, preventing missed headers (notably under HTTP/2+ semantics) and avoiding unintended all-category rate limiting.

Changes:

  • Read retry-after and x-sentry-rate-limits from Response.headers using lowercase keys in HttpTransport.
  • Update transport tests to provide lowercase header names, matching package:http’s header-map contract.

Standards

No issues found.

Standards summary: 0 findings; worst issue: none.

Spec

Matches the PR description and Issue #3882: ensures rate-limit headers are read case-insensitively (via normalized lowercase keys) and updates tests accordingly.

Spec summary: 0 findings; worst issue: none.

Correctness

The change aligns with package:http behavior (normalized lowercase header keys) and fixes previously fragile header lookups without introducing new logic paths.

Correctness summary: 0 findings; worst issue: none.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/dart/lib/src/transport/http_transport.dart Switch header lookups to lowercase keys for correct rate-limit parsing.
packages/dart/test/transport/http_transport_test.dart Adjust tests to use lowercase response header names to match package:http behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@buenaflor buenaflor 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.

LGTM, failing CI is not because of this PR

@buenaflor
buenaflor enabled auto-merge (squash) July 28, 2026 14:45
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.

Double-check: case-insensitive rate-limit header parsing

2 participants