Cleanup of the TEA parity work: no prose in code, no hacks, everything in its place

1. No prose in code
- Remove parity-added Python comments and docstrings across the EEG, FHIR,
  execution, preview, training and run code and tests. Preserve endpoint
  descriptions as explicit FastAPI schema metadata.

2. No hacks, no glued code
- Read the declared TEA patient filters and training inputs directly and
  use the same TEA check for exposing and validating reference options.
- Give the Dagster GraphQL request one helper. Keep lock backoff and
  cancellation polling because their timing and error behavior are
  covered by run tests and they handle different Dagster states.
- Use the renamed FHIR report ID helper in the hospital test. Keep
  TEA_GATE_SLOW local to that test and preserve the test assertions.

3. Everything in its place
- Keep endpoint and run handling in WebApi and reuse Core and Persistance
  for domain rules and reads. Leave tests in the existing testpaths.
This commit is contained in:
2026-11-30 13:39:51 -06:00
parent 54b1995681
commit ec5d945f71
9 changed files with 62 additions and 82 deletions
+1 -7
View File
@@ -1,5 +1,3 @@
"""Run shaping and the API's Dagster-backed run and execution routes."""
import os
import time
@@ -169,7 +167,6 @@ def test_cancel_a_finished_run_is_409(api, failed_run):
@pytest.fixture
def api_with_dagster_address(platform, request, monkeypatch):
"""Capture the Dagster port chosen by the shared API fixture for its first process."""
ports = []
free_port = conftest._free_port
@@ -211,7 +208,7 @@ def test_execution_options_and_health(api):
options = _ok(api.get("/execution/options"))
assert options["default_mode"] == "sync"
configured = [s for s in os.environ.get("DASK_SCHEDULERS", "").split(",") if s]
assert options["schedulers"] == configured # compose and CI name the test scheduler
assert options["schedulers"] == configured
health = _ok(api.get("/execution/health", params={"mode": "local"}))
assert health["reachable"] is True
assert health["workers"] >= 1
@@ -231,8 +228,6 @@ def test_tea_eegs_analyze_validates_scope(api):
def test_a_locked_run_storage_is_read_again(monkeypatch):
"""Dagster's SQLite run storage is locked for a moment while a run writes: the read is retried,
and a storage that stays locked is a 503 the caller can retry, not a 502."""
from fastapi import HTTPException
from webapi import runs
@@ -266,7 +261,6 @@ def test_a_locked_run_storage_is_read_again(monkeypatch):
def test_cancel_waits_for_a_starting_run(monkeypatch):
"""Dagster refuses to terminate a run that is still STARTING: cancel waits for it to start."""
from webapi import runs
statuses = iter(["STARTING", "STARTING", "STARTED", "CANCELING"])