Skip to content

ALEPH-512 ensure we always return json for error #804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

olethanh
Copy link
Collaborator

@olethanh olethanh commented May 5, 2025

Some endpoint return text for errors which made the web frontend crash
Solution: Add a middleware which ensure a json error is always returned

Add some test for it.
Also refactor version header code

Related ClickUp, GitHub or Jira tickets : ALEPH-512

Self proofreading checklist

  • The new code clear, easy to read and well commented.
  • New code does not duplicate the functions of builtin or popular libraries.
  • An LLM was used to review the new code and look for simplifications.
  • New classes and functions contain docstrings explaining what they provide.
  • All new code is covered by relevant tests.
  • Documentation has been updated regarding these changes.
  • Dependencies update in the project.toml have been mirrored in the Debian package build script packaging/Makefile

How to test

Call multiple endpoint, try to trigger error

olethanh added 2 commits May 5, 2025 13:51
Some endpoint return text for errors which made the web frontend crash
Solution: Add a middleware which ensure a json error is always returned

Add some test for it
Use a signal instead of a middleware to add the 'Server' version header
as in some case (StreamResponse, Websocket) it would not work and display warning

see:
https://docs.aiohttp.org/en/stable/web_advanced.html#signals
Copy link

codecov bot commented May 5, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 3 lines in your changes missing coverage. Please review.

Project coverage is 64.88%. Comparing base (a5e3fef) to head (0314870).

Files with missing lines Patch % Lines
src/aleph/vm/orchestrator/supervisor.py 96.29% 0 Missing and 1 partial ⚠️
src/aleph/vm/orchestrator/views/__init__.py 50.00% 1 Missing ⚠️
src/aleph/vm/orchestrator/views/operator.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #804      +/-   ##
==========================================
+ Coverage   64.57%   64.88%   +0.30%     
==========================================
  Files          78       79       +1     
  Lines        7094     7133      +39     
  Branches      598      601       +3     
==========================================
+ Hits         4581     4628      +47     
+ Misses       2313     2304       -9     
- Partials      200      201       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant