sched: docs, probe retirement, MCP guard, coverage pins, executable example (T14)

This commit is contained in:
lda
2026-09-09 12:21:13 +07:00 Verified
parent e09c08899a
commit 9c4f7de086
17 changed files with 601 additions and 2398 deletions
+31
View File
@@ -353,3 +353,34 @@ def test_poll_one_uses_fresh_definition_after_edit(tmp_path: Path) -> None:
assert admission.resolved_input["team"] == "new"
assert admission.schedule_revision == 2
sched.ownership.release()
def test_manual_and_other_schedule_runs_are_overlap_independent(
tmp_path: Path,
) -> None:
from wf_api.run_lifecycle import (
materialize_admitted_view,
persist_admission,
)
sched, store, runs, sources = _harness(tmp_path, script={"*": "hang"})
t0 = ts(2026, 9, 8, 12, 0)
# An active run of another schedule occupies only its own slot.
_add(sched, store, sources, "b", OneShotSource(t0), t0 - timedelta(hours=1))
assert sched.poll(t0)["b"].startswith("admit:run-")
# A manual run (no schedule owner) participates in no overlap check.
manual_id = runs.allocate_run_id()
manual = persist_admission(
store=runs,
run_id=manual_id,
environment=fixture_environment(object()),
resolved_input={},
max_steps=None,
)
materialize_admitted_view(store=runs, admission=manual)
# A due one-shot admits despite both unrelated active runs.
_add(sched, store, sources, "a", OneShotSource(t0), t0 - timedelta(hours=1))
result = sched.poll(t0 + timedelta(seconds=1))
assert result["a"].startswith("admit:run-")
assert result["b"] == "exhausted"
sched.ownership.release()