完善 PNL00R 摩擦模型与八路回归

This commit is contained in:
huojiarong committed 2026-08-18 09:30:29 +00:00
1 parent 684d28752a
commit f725f038b6
10 files changed
+498 -98

No files matched your search

+19 -7
View File
@@ -127,12 +127,15 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
case_id,
)
def test_approved_production_golden_replays_its_source_report(self) -> None:
def test_historical_v2_golden_replays_its_source_report(self) -> None:
repository_root = Path(self.manifest["_repositoryRoot"])
reference = self.manifest["variants"]["0.2s"]["goldens"]["production"]
golden_path = (
repository_root
/ "tests/baselines/simulation/test_mql_8/goldens/production-0.2s-v1.json"
)
golden = load_regression_golden(
repository_root / reference["path"],
expected_sha256=reference["sha256"],
golden_path,
expected_sha256="99fa7b3631a89f59f86551847175f3701a1567d8d0bd10d87545734f17515d72",
repository_root=repository_root,
)
source_report = golden["provenance"]["sourceReport"]
@@ -142,12 +145,16 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
case = next(item for item in report["cases"] if item["caseId"] == "0.2s")
audit = evaluate_regression_golden(case["worker"]["summary"], golden)
self.assertNotEqual(
golden["sourceXmlSha256"],
self.manifest["source"]["sha256"],
)
self.assertTrue(audit["passed"], audit)
self.assertEqual(audit["comparedValueCount"], 402)
self.assertEqual(audit["maxAbsoluteError"], 0.0)
self.assertEqual(audit["maxToleranceRatio"], 0.0)
def test_extension_decision_is_bound_to_the_current_report_and_budget(self) -> None:
def test_historical_v2_extension_decision_remains_auditable(self) -> None:
repository_root = Path(self.manifest["_repositoryRoot"])
runs = repository_root / "tests/baselines/simulation/test_mql_8/runs"
decision = json.loads(
@@ -164,6 +171,10 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
first_decision = decision["decisions"][0]
self.assertEqual(
decision["sourceXmlSha256"],
"170463d65d074da01f0f9e9dab730b3815c94c1cc80b5190ec2e3fe623da74d3",
)
self.assertNotEqual(
decision["sourceXmlSha256"], self.manifest["source"]["sha256"]
)
self.assertEqual(
@@ -191,7 +202,7 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
self.assertEqual(first_decision["outcome"], "deferred")
self.assertTrue(decision["simulationWasNotStartedForDeferredCases"])
def test_periodic_main_lane_exercises_the_approved_production_golden(self) -> None:
def test_periodic_main_lane_uses_the_current_production_source(self) -> None:
workflow = (
Path(self.manifest["_repositoryRoot"])
/ ".github/workflows/solver-regression.yml"
@@ -199,11 +210,12 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
self.assertIn("default: production", workflow)
self.assertIn("inputs.lane || 'production'", workflow)
self.assertNotIn("goldens", self.manifest["variants"]["0.2s"])
@unittest.skipUnless(
os.getenv(LONG_RUN_ENVIRONMENT, "").strip().lower() in {"1", "true", "yes"},
f"Set {LONG_RUN_ENVIRONMENT}=1 to run bounded 0.01/0.2/1/5/10 s integration.",
f"Set {LONG_RUN_ENVIRONMENT}=1 to run bounded 0.005/0.2/1/5/10 s integration.",
)
class TestMql8ProgressiveLongRegressionTests(unittest.TestCase):
@classmethod