Skip to content

Commit c96bcf1

Browse files
committed
[iris] Simplify replay system: tests-only, drop SQL traces, flatten goldens
Address review feedback: - Replay code lives under ``lib/iris/tests/cluster/controller/replay/`` instead of ``lib/iris/src/iris/cluster/controller/replay/``. It's test infrastructure; belongs with the tests. - Drop the SQLite ``set_trace_callback`` hook and the ``sql_trace`` module. The trace was dominated by 500+ migration DDL lines and the DB-state dump already catches every behavioral drift we care about. Reverts the ~10-line ``db.py`` addition. - Flatten golden tree: ``golden/<scenario>/db.json`` -> ``golden/<scenario>.json``. ``sql.txt`` goldens deleted. - Merge ``events.py`` and ``dispatcher.py`` into a single module. - Move ``frozen_clock`` out of every scenario into a top-level context manager entered once by the test runner, after ``ControllerDB`` construction. - Delete the ``run.py`` CLI and ``__main__.py``. Running ``pytest lib/iris/tests/cluster/controller/replay/`` is the full workflow; a CLI can be added back if marin-checkpoint-seeded runs are wanted. Also from the PR-B review: - ``register_or_refresh_worker`` docstring updated: the attr-cache update and audit line are scheduled as ``cur.on_commit`` hooks, not returned to callers. - ``service.launch_job`` closes the submit-with-replace TOCTOU by running the existing-job check and the conditional cleanup in a single transaction. ``submit_job`` still opens its own tx downstream; a concurrent submitter between the two txs collides on the jobs PK (legitimate error, not corruption). Tests: 815 passed on the controller suite; 13 replay goldens match exactly. pyrefly clean in the controller tree.
1 parent ab4b8ba commit c96bcf1

40 files changed

Lines changed: 725 additions & 9192 deletions

File tree

lib/iris/src/iris/cluster/controller/db.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,6 @@ class ControllerDB:
294294
AUTH_DB_FILENAME = "auth.sqlite3"
295295
PROFILES_DB_FILENAME = "profiles.sqlite3"
296296

297-
# Class-level SQL trace hook: when set, every connection (writer + read pool)
298-
# opened via _configure() registers this callback via
299-
# ``conn.set_trace_callback``. Exposed for the replay-system tests
300-
# (``iris.cluster.controller.replay``); production never sets this. Must be
301-
# set BEFORE ``ControllerDB(...)`` is constructed so the writer connection
302-
# picks it up — connections opened earlier will not retroactively trace.
303-
_trace_callback: Callable[[str], None] | None = None
304-
305297
def __init__(self, db_dir: Path):
306298
import time
307299

@@ -423,8 +415,6 @@ def _configure(conn: sqlite3.Connection) -> None:
423415
conn.execute("PRAGMA synchronous = NORMAL")
424416
conn.execute("PRAGMA busy_timeout = 5000")
425417
conn.execute("PRAGMA foreign_keys = ON")
426-
if (cb := ControllerDB._trace_callback) is not None:
427-
conn.set_trace_callback(cb)
428418

429419
def optimize(self) -> None:
430420
"""Run PRAGMA optimize to refresh statistics for tables with stale data.

lib/iris/src/iris/cluster/controller/replay/__init__.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

lib/iris/src/iris/cluster/controller/replay/__main__.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/iris/src/iris/cluster/controller/replay/dispatcher.py

Lines changed: 0 additions & 102 deletions
This file was deleted.

lib/iris/src/iris/cluster/controller/replay/events.py

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)