存档求解器回归基线与当前改动
纳管 AMESim 对齐基线、发布锁、回归测试及当前物理门禁调整。 更新日志仅记录已完成成果,并注明当前 HEAD 尚待真实 production 复跑与远端 workflow 验证。
This commit is contained in:
1 parent
53f8601fec
commit
a8c733883c
32 files changed
+47241
-108
No files matched your search
@@ -1,12 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
from app.main import compile_system_xml_network
|
||||
from app.simulation.benchmark_regression import (
|
||||
evaluate_regression_golden,
|
||||
load_regression_manifest,
|
||||
run_regression_suite,
|
||||
source_simulation_config,
|
||||
@@ -85,6 +87,60 @@ class MqlFullBranchesStaticRegressionTests(unittest.TestCase):
|
||||
expected["hasMechanicalStateEvents"],
|
||||
)
|
||||
|
||||
def test_three_production_repeats_replay_approved_goldens_exactly(self) -> None:
|
||||
repository_root = Path(self.manifest["_repositoryRoot"])
|
||||
evidence = self.manifest["acceptanceEvidence"]
|
||||
self.assertEqual(evidence["status"], "approved")
|
||||
self.assertEqual(evidence["lane"], "production")
|
||||
self.assertEqual(evidence["repeatCount"], 3)
|
||||
self.assertTrue(evidence["physicalValuesIdenticalAcrossRepeats"])
|
||||
|
||||
expected_counts = {"0.81s": 480, "2.10s": 720}
|
||||
stable_signatures: dict[str, object] = {}
|
||||
for report_reference in evidence["reports"]:
|
||||
report_path = repository_root / report_reference["path"]
|
||||
payload = report_path.read_bytes()
|
||||
self.assertEqual(len(payload), report_reference["bytes"])
|
||||
self.assertEqual(
|
||||
hashlib.sha256(payload).hexdigest(),
|
||||
report_reference["sha256"],
|
||||
)
|
||||
report = json.loads(payload)
|
||||
self.assertEqual(report["lane"], "production")
|
||||
self.assertEqual(
|
||||
report["source"]["sha256"], self.manifest["source"]["sha256"]
|
||||
)
|
||||
|
||||
for case_id in self.manifest["sequence"]:
|
||||
case = next(
|
||||
item for item in report["cases"] if item["caseId"] == case_id
|
||||
)
|
||||
self.assertEqual(case["outcome"], "completed")
|
||||
self.assertTrue(case["acceptance"]["passed"])
|
||||
summary = case["worker"]["summary"]
|
||||
golden = self.manifest["_goldens"][case_id]["production"]
|
||||
audit = evaluate_regression_golden(summary, golden)
|
||||
self.assertTrue(audit["passed"], audit)
|
||||
self.assertEqual(
|
||||
audit["comparedValueCount"], expected_counts[case_id]
|
||||
)
|
||||
self.assertEqual(audit["maxAbsoluteError"], 0.0)
|
||||
self.assertEqual(audit["maxToleranceRatio"], 0.0)
|
||||
self.assertEqual(audit["issues"], [])
|
||||
|
||||
diagnostics = dict(summary["diagnostics"])
|
||||
diagnostics.pop("performance", None)
|
||||
signature = {
|
||||
"physicalContract": summary["physicalContract"],
|
||||
"eventTrace": summary["eventTrace"],
|
||||
"outputContract": summary["outputContract"],
|
||||
"diagnosticsWithoutPerformance": diagnostics,
|
||||
}
|
||||
if case_id not in stable_signatures:
|
||||
stable_signatures[case_id] = signature
|
||||
else:
|
||||
self.assertEqual(stable_signatures[case_id], signature)
|
||||
|
||||
def test_both_horizons_have_the_expected_signal_schedule(self) -> None:
|
||||
assert self.validation.document is not None
|
||||
system = GenericFluidSystem(
|
||||
@@ -105,9 +161,16 @@ class MqlFullBranchesStaticRegressionTests(unittest.TestCase):
|
||||
)
|
||||
class MqlFullBranchesLongRegressionTests(unittest.TestCase):
|
||||
def test_both_horizons_complete_within_their_safety_budgets(self) -> None:
|
||||
report = run_regression_suite(MANIFEST_PATH, lane="solver-only")
|
||||
report = run_regression_suite(MANIFEST_PATH, lane="production")
|
||||
outcomes = [case["outcome"] for case in report["cases"]]
|
||||
self.assertEqual(outcomes, ["completed", "completed"], report["cases"])
|
||||
self.assertTrue(
|
||||
all(
|
||||
case["acceptance"]["regressionGolden"]["passed"]
|
||||
for case in report["cases"]
|
||||
),
|
||||
report["cases"],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user