sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

ref(wsgi): Update _werkzeug vendor to newer version

Open mgaligniana opened this issue 4 months ago • 9 comments

Fixes GH-3516

mgaligniana avatar Sep 12 '25 13:09 mgaligniana

Codecov Report

:x: Patch coverage is 44.44444% with 15 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 83.41%. Comparing base (5a122b5) to head (ba2c350).

Files with missing lines Patch % Lines
sentry_sdk/_werkzeug.py 44.44% 11 Missing and 4 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4793      +/-   ##
==========================================
- Coverage   84.47%   83.41%   -1.07%     
==========================================
  Files         158      158              
  Lines       16506    16512       +6     
  Branches     2865     2864       -1     
==========================================
- Hits        13944    13773     -171     
- Misses       1712     1889     +177     
  Partials      850      850              
Files with missing lines Coverage Δ
sentry_sdk/_werkzeug.py 54.54% <44.44%> (+6.39%) :arrow_up:

... and 8 files with indirect coverage changes

codecov[bot] avatar Sep 12 '25 16:09 codecov[bot]

Thanks for the PR @mgaligniana -- I think the HTTP_X_FORWARDED_HOST handling needs to be added manually on top of the vendored in code. As far as I can tell we also did that in the current version as the original upstream 1.0.1 version also doesn't contain it.

sentrivana avatar Sep 16 '25 07:09 sentrivana

Ok, Seer 🎉 liked!

But codecov not, should I add new tests for the new vendor?

Edited: I think yes because Anton said:

Also make sure this code is tested to have a high test coverage. (maybe by vendoring in the related tests from Werkzeug?)

But do you think I should copy-paste the test from werkzeug to get_host for example?

mgaligniana avatar Sep 17 '25 03:09 mgaligniana

But do you think I should copy-paste the test from werkzeug to get_host for example?

Tests would be great. I think the one you linked would be good, plus something custom for the HTTP_X_FORWARDED_HOST stuff.

sentrivana avatar Sep 18 '25 10:09 sentrivana

So adding that now we have image

mgaligniana avatar Sep 19 '25 03:09 mgaligniana

There we go!

image

mgaligniana avatar Sep 25 '25 01:09 mgaligniana

Hi @sentrivana, just following up on this! In case you need any changes from my side! Thank you!

mgaligniana avatar Oct 21 '25 13:10 mgaligniana

Hey @mgaligniana, sorry for dropping the ball on this, I'll get to reviewing eventually -- no need for you to wait though, I can just apply any changes myself. Thanks for your work!

sentrivana avatar Oct 23 '25 08:10 sentrivana

Perfect, no problem!! Thank you!!

mgaligniana avatar Oct 23 '25 11:10 mgaligniana