"""Physical OUT ACK and animation-settle order, using real production functions.""" import os from pathlib import Path import shutil import subprocess import pytest ROOT = Path(__file__).resolve().parents[1] CASES = ( "out_only_ack_barrier", "configured_settle_and_server_marker", "mapping_and_explicit_fields_cannot_overtake_out", "already_inflight_mapping_drains_before_out", "replaced_input_still_waits_settle_without_foreign_out", "manual_score_mapping_waits_for_goal_hide", "double_minor_hide_prepare_then_show", "alias_mapping_preparation_preserves_native_fields", "native_pause_waits_until_hidden", "native_start_waits_until_hidden", "f2_loss_during_settle", "role_loss_during_settle", "game_loss_during_settle", "agent_loss_during_settle", "nack_has_no_field_write_or_replay", "unknown_has_no_field_write_or_replay", "manual_recovery_success_after_empty_tally", "manual_recovery_nack_after_empty_tally", "semantic_edit_during_out_preserves_penalty", "semantic_edit_prevents_undo_reshow", "new_agent_goal_does_not_wait_or_lose_queue_to_old_context", "shared_title_is_hidden_then_other_clock_restored", "main_input_is_never_hidden", "foreign_input_is_never_hidden", "overlay_eight_goal_and_undo", ) @pytest.mark.parametrize("case", CASES) def test_goal_out(case): node = shutil.which("node") assert node, "Node is required for production-function regressions" result = subprocess.run([node, str(ROOT / "tests/build202_goal_out.cjs"), case, os.environ.get("BUILD202_RUNTIME_ROOT", str(ROOT))], cwd=ROOT, text=True, capture_output=True, timeout=20) assert result.returncode == 0, result.stdout + result.stderr assert f"PASS BUILD202 goal OUT: {case}" in result.stdout, result.stdout + result.stderr