Skip to content

Use context manager and match-case in endpoints#12934

Merged
berland merged 3 commits intoequinor:mainfrom
berland:http_errors_ctx
Feb 26, 2026
Merged

Use context manager and match-case in endpoints#12934
berland merged 3 commits intoequinor:mainfrom
berland:http_errors_ctx

Conversation

@berland
Copy link
Copy Markdown
Contributor

@berland berland commented Feb 18, 2026

Issue
Readability.

Approach
contextlib.

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'just rapid-tests')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Add backport label to latest release (format: 'backport release-branch-name')

@berland berland added the release-notes:skip If there should be no mention of this in release notes label Feb 18, 2026
@berland berland added this to SCOUT Feb 18, 2026
@berland berland moved this to Ready for Review in SCOUT Feb 18, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 63.35878% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.24%. Comparing base (005c621) to head (ee22a67).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ert/dark_storage/endpoints/responses.py 54.38% 26 Missing ⚠️
src/ert/dark_storage/common.py 40.00% 12 Missing ⚠️
src/ert/dark_storage/endpoints/parameters.py 62.50% 9 Missing ⚠️
src/ert/dark_storage/endpoints/experiments.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12934      +/-   ##
==========================================
+ Coverage   90.12%   90.24%   +0.12%     
==========================================
  Files         445      446       +1     
  Lines       30858    30820      -38     
==========================================
+ Hits        27811    27815       +4     
+ Misses       3047     3005      -42     
Flag Coverage Δ
cli-tests 36.89% <0.00%> (+0.05%) ⬆️
gui-tests 67.44% <3.81%> (+0.07%) ⬆️
performance-and-unit-tests 76.85% <63.35%> (+0.10%) ⬆️
test 46.08% <24.42%> (+0.07%) ⬆️

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

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

Comment thread src/ert/dark_storage/endpoints/responses.py Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 19, 2026

Merging this PR will not alter performance

✅ 35 untouched benchmarks


Comparing berland:http_errors_ctx (c355e3d) with main (0790612)

Open in CodSpeed

@berland berland force-pushed the http_errors_ctx branch 3 times, most recently from e91eb25 to 6579a99 Compare February 19, 2026 13:17
@berland berland changed the title Use context manager for reraising as http errors Use ctx manager and match-case in endpoints Feb 19, 2026
@berland berland added the release-notes:maintenance Automatically categorise as maintenance change in release notes label Feb 19, 2026
@berland berland changed the title Use ctx manager and match-case in endpoints Use context manager and match-case in endpoints Feb 19, 2026
@berland berland self-assigned this Feb 20, 2026
@berland berland force-pushed the http_errors_ctx branch 2 times, most recently from fe427b1 to 6c7398b Compare February 20, 2026 11:16
Comment thread src/ert/dark_storage/endpoints/parameters.py Outdated
Comment thread src/ert/dark_storage/endpoints/parameters.py Outdated
Also raise HTTP error 415 when the requested media type is not
supported.
@berland
Copy link
Copy Markdown
Contributor Author

berland commented Feb 25, 2026

My sneaky force-push also moved two lines in get_gradient into the reraise.. context, consistent with the other code.

Copy link
Copy Markdown
Contributor

@andreas-el andreas-el left a comment

Choose a reason for hiding this comment

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

Well done! 🥓

@github-project-automation github-project-automation Bot moved this from Ready for Review to Reviewed in SCOUT Feb 26, 2026
@berland berland merged commit 9d2541d into equinor:main Feb 26, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewed to Done in SCOUT Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:maintenance Automatically categorise as maintenance change in release notes release-notes:skip If there should be no mention of this in release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants