Skip to content

Fix simulation request correlation and service metadata - #659

Merged
anth-volk merged 2 commits into
mainfrom
fix/simulation-request-correlation
Jul 30, 2026
Merged

Fix simulation request correlation and service metadata#659
anth-volk merged 2 commits into
mainfrom
fix/simulation-request-correlation

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Fixes #658

Summary

  • standardize simulation HTTP correlation on X-PolicyEngine-Request-Id
  • preserve supplied or generated IDs through the Cloud Run Entrypoint and Modal gateway
  • give the Entrypoint, gateway, and executor explicit FastAPI service identities
  • recognize APP_ENVIRONMENT without changing the existing environment precedence
  • document the three-service observability boundary

Root cause

The Entrypoint forwarded X-Request-ID, but policyengine-observability reads X-PolicyEngine-Request-Id, so the Modal gateway generated a different UUID. The shared FastAPI initializer also hard-coded the executor service name and did not consider the Cloud Run APP_ENVIRONMENT value.

Impact

Entrypoint and gateway logs can now correlate a synchronous request with the same ID. Structured records identify the correct service and deployed Entrypoint environment. Authentication, routing, secrets, workflows, API schemas, generated clients, and asynchronous job semantics are unchanged.

Tests

  • test-first regression commit captured the expected pre-fix failures
  • simulation observability: 28 passed
  • simulation entry: 64 passed
  • simulation gateway: 103 passed, 1 deployment integration test deselected
  • simulation executor: 391 passed, 2 deployment integration tests deselected
  • Ruff CI formatting lane: 62 source files formatted
  • targeted Pyright: zero errors for every modified source file
  • Entrypoint Docker image build: passed
  • git diff --check: passed

Real Modal integration smoke tests were not run because they create ephemeral deployments; the hermetic Modal image-definition and import-smoke tests passed in the gateway and executor unit suites.

@anth-volk
anth-volk marked this pull request as ready for review July 30, 2026 19:42
@anth-volk
anth-volk merged commit 8038bba into main Jul 30, 2026
10 checks passed
@anth-volk
anth-volk deleted the fix/simulation-request-correlation branch July 30, 2026 19:43
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.

Fix simulation request correlation and service metadata

1 participant