"""Actual menu/Mapping coordinator/loader functions with deterministic offline I/O.""" from pathlib import Path import os import shutil import subprocess import pytest ROOT = Path(__file__).resolve().parents[1] CASES = [ "loading_blocks_global_keyboard", "partial_warning_late_mapping_rearms_watchdog", "late_roster_maps_without_reopen", "loading_waits_for_rosters_and_mapping", "fingerprint_ignores_volatile_fields", "fingerprint_covers_identity_and_array_order", "unchanged_roster_does_not_send_again", "late_roster_requires_fresh_queued_mapping", "failed_mapping_can_retry_same_roster", "partial_roster_never_reports_ready", "retry_partial_roster_sends_once_after_enrichment", "slow_mapping_warns_without_retry_or_abort", "stale_job_cannot_close_new_loading", ] + [f"stale_mapping_{field}" for field in ( "generation", "game", "account", "session", "language", "device", )] @pytest.mark.parametrize("case", CASES) def test_roster_mapping(case): node = shutil.which("node") assert node, "Node is required for executable roster delivery regressions" source_root = Path(os.environ.get("BUILD197_RUNTIME_ROOT", ROOT)) result = subprocess.run( [node, str(ROOT / "tests/build197_roster_mapping.cjs"), case, str(source_root)], cwd=ROOT, text=True, capture_output=True, timeout=20, ) assert result.returncode == 0, result.stdout + result.stderr assert f"PASS roster mapping: {case}" in result.stdout, "The scenario must finish its assertions"