from __future__ import annotations import yaml from tracker.config import _TRACKER_REPO_ROOT def patch_active_program_id(program_id: int | None) -> None: """Rewrite `active_program_id` in config.yaml at the tracker repo root.""" path = _TRACKER_REPO_ROOT / "config.yaml" raw = yaml.safe_load(path.read_text()) raw["active_program_id"] = program_id path.write_text(yaml.safe_dump(raw, sort_keys=False, allow_unicode=True))