Files
SkillFactory/tests/test_contact_cycle_sim_learning_physics.py
chenlin 9fe9d27865 feat: checkpoint contact-cycle evaluation and RootXY PPO progress
Consolidate next-stage docs, archive superseded narratives, and preserve frozen document inputs. Retain invalid P2 pairs, partial RootXY training, failed attempts and nonselectable checkpoints as explicit limitations.

Include supervised evaluation/training, desktop GPU admission, bounded evidence and atomic-publication monitor repairs with CPU regressions. Ignore local dotenv configuration.

Validation: 1403 passed, 6 skipped for contact-cycle and related contracts/CLI tests. Full-suite legacy ABI and registration tests require Python 3.12/Torch 2.10/pxr; no runtime checks relaxed. No new physical run or accepted skill.
2026-10-15 14:18:17 +08:00

43 lines
2.1 KiB
Python

"""Opt-in nonoptimizing API preflight. A skipped test is not physical evidence."""
import json
import os
import subprocess
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
@pytest.mark.skipif(os.environ.get("SIM_RESIDUAL_LEARNING_API_TESTS") != "1",
reason="requires explicit supervised nonlearning PhysX API probe")
def test_contact_cycle_sim_learning_runtime(tmp_path):
env = os.environ.copy()
env.pop("CONDA_PREFIX", None)
env.pop("VIRTUAL_ENV", None)
env["PYTHONPATH"] = str(ROOT / "source/SkillFactory")
env["PYTHONDONTWRITEBYTECODE"] = "1"
process = subprocess.run([
"/usr/bin/python3", str(ROOT / "scripts/supervise_sim.py"), "--timeout", "240",
"--log", str(tmp_path / "console.log"), "--report", str(tmp_path / "supervisor.json"), "--",
env.get("ISAACLAB_LAUNCHER", "/home/cen/IsaacLab/isaaclab.sh"), "-p",
str(ROOT / "scripts/verify_cycle_sim_learning_runtime.py"),
"--output", str(tmp_path / "probe"), "--headless",
], cwd=ROOT, env=env, capture_output=True, text=True, timeout=280)
assert process.returncode == 0, process.stdout[-4000:] + process.stderr[-4000:]
report = json.loads((tmp_path / "probe/result.json").read_text())
supervisor = json.loads((tmp_path / "supervisor.json").read_text())
assert report["passed"] and supervisor["passed"] and supervisor["cleanup"]["clean"]
assert not supervisor["critical_log_lines"]
assert report["optimizer_steps"] == report["training_transitions"] == 0
assert report["nonoptimizing_api_transitions"] == 512
assert report["model_sha256_before"] == report["model_sha256_after"]
assert not report["accepted_skill"] and not report["functional_claim"]
assert not report["failure_term_disabled"] and report["acquisition_deadline_s"] == .2
for name in ("timeout", "true_failure"):
fixture = report["fixtures"][name]
assert all(fixture["checks"].values())
assert fixture["logprob_max_abs_error"] < 2e-4
assert fixture["max_actual_residual_rad"] <= .050001