Skip to content

Fix upstream simulation error responses - #3821

Draft
anth-volk wants to merge 5 commits into
masterfrom
fix/2430-upstream-simulation-errors
Draft

Fix upstream simulation error responses#3821
anth-volk wants to merge 5 commits into
masterfrom
fix/2430-upstream-simulation-errors

Conversation

@anth-volk

@anth-volk anth-volk commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2430

Summary

  • Return HTTP 502 when the simulation service reports a failed execution.
  • Preserve the upstream failure message in the API response.
  • Return cached failed executions as errors instead of successful responses with a null result.
  • Keep successful and in-progress responses at HTTP 200 with a null message.
  • Add a changelog fragment.

Testing

  • Added focused service coverage for immediate failures, cached failures, and cached failures without a stored message.
  • Added focused route coverage for failed, successful, and in-progress responses.
  • 134 focused economy service and route tests passed.
  • 38 API v1 route-contract tests passed.
  • Ruff formatting and lint checks passed.

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.21%. Comparing base (37e168a) to head (9122964).

Files with missing lines Patch % Lines
policyengine_api/services/economy_service.py 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3821      +/-   ##
==========================================
- Coverage   46.26%   46.21%   -0.05%     
==========================================
  Files         135      135              
  Lines        7963     7971       +8     
  Branches     1326     1328       +2     
==========================================
  Hits         3684     3684              
- Misses       3990     3998       +8     
  Partials      289      289              

☔ View full report in Codecov by Harness.
📢 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.

@anth-volk

Copy link
Copy Markdown
Collaborator Author

Deployment validation for this PR currently depends on resolving the pre-existing failure in tests/integration/test_live_phase10_staging.py::test_live_phase10_activation_failure_and_retry on master (failed workflow run). This PR should remain blocked until the existing deployment sequence completes successfully.

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.

Simulation API runs that complete with 500 errors cause the API to respond with 200 and a result of None

1 participant