Skip to content

Split the simulation service into gateway/executor projects with lockfile-derived Modal images #609

Description

@anth-volk

Restructure to eliminate the #602 bug class (Modal images resolving dependencies fresh at build time, diverging from the tested environment, crashing only in deployed containers):

End state

  • projects/policyengine-simulation-gateway (new): Modal gateway as its own uv project; image built with uv_sync(frozen=True) from its own uv.lock — CI unit tests run in the exact env the image ships.
  • projects/policyengine-simulation-executor (renamed from policyengine-api-simulation): versioned Modal worker apps + standalone FastAPI service; keeps the bundle-install architecture; image bootstrap pinned via a dependency-group export from its lock.
  • libs/policyengine-simulation-contract (new): gateway↔worker contract (request/response models, budget-window state, dataset refs).
  • libs/policyengine-simulation-observability (new): observability wrapper, logfire_legacy, error redaction, telemetry — isolated because Logfire is transitional and this dependency cluster caused Beta gateway crash-loops: logfire import fails with ModuleNotFoundError (importlib_metadata) in rebuilt Modal images #602.
  • libs/policyengine-simulation-api (dead stub): deleted.
  • New pre-merge image smoke gate: real modal run functions import the true app entrypoints inside both built images on PRs touching these projects.

Commit shape

1–2: re-land #603/#608 verbatim (closed as superseded by this work) · 3: project rename · 4–5: lib extractions · 6: gateway project + uv_sync image · 7: smoke gate + docs.

Fixes-in-flight: #602, #607. Modal app names and the generated client package name (policyengine_api_simulation_client) deliberately unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions