修复测试模型路径并完善四路八路回归与文档
- 按文件哈希区分当前八路工程和历史 Amesim 基准,修复测试与清单中的旧路径。 - 四路审计从 JSON 按需生成 XML,八路新增只核对模式,并显式使用 UTF-8 与 LF。 - 将缺失高刚度夹具的测试替换为当前八路完整 BDF 运行,明确未恢复原 RK45 专项覆盖。 - 更新前端大型工程测试、历史活动回放入口、数据说明、现行规范和相关报告。 验证:全量后台 374 项通过、1 项条件跳过;前端 11 项通过、历史独立服务用例 1 项跳过;四路八路 AME 审计通过。 环境、缓存和运行产物保持忽略;本次未实施工程 JSON 字段精简。
This commit is contained in:
1 parent
44b6ea74ab
commit
b6c22a54f8
32 files changed
+318
-153
No files matched your search
@@ -1,11 +1,14 @@
|
||||
"""Reproduce the eight-branch AME drawing -> editor model audit.
|
||||
|
||||
Run from the repository root with .venv/bin/python. The original inputs are
|
||||
read only. Mapping uses typed graph isomorphism and endpoint edit cost, never
|
||||
component display names; names are emitted only as evidence for review.
|
||||
Run from the repository root with .venv/bin/python and --check to preserve
|
||||
the current project; omit --check to regenerate it. Audit evidence goes to
|
||||
the ignored test/model-audit/mql8 directory. Mapping uses typed graph
|
||||
isomorphism and endpoint edit cost, never component display names; names
|
||||
are emitted only as evidence for review.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from collections import Counter, defaultdict
|
||||
from copy import deepcopy
|
||||
import hashlib
|
||||
@@ -24,11 +27,12 @@ from tests.test_test_mql_ame_contract import (
|
||||
_SOURCE_FIELD_BY_PARAMETER, _numeric_project_value,
|
||||
)
|
||||
from app.simulation.registry import get_component_model_spec
|
||||
from app.simulation.paths import CURRENT_MQL8_AME_PATH, CURRENT_MQL8_PROJECT_PATH
|
||||
|
||||
HERE = ROOT / 'test/solver-newton-20260911/mql8'
|
||||
AME = ROOT / 'tests/data/test_mql.ame'
|
||||
INPUT = ROOT / 'tests/fixtures/legacy/test-mql-8.json'
|
||||
OUTPUT = ROOT / 'tests/data/test-mql-8-corrected.json'
|
||||
HERE = ROOT / 'test/model-audit/mql8'
|
||||
AME = CURRENT_MQL8_AME_PATH
|
||||
INPUT = CURRENT_MQL8_PROJECT_PATH
|
||||
OUTPUT = CURRENT_MQL8_PROJECT_PATH
|
||||
|
||||
|
||||
def read_drawing():
|
||||
@@ -179,8 +183,14 @@ def match_graph(entities, ame_edges, project):
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--check', action='store_true',
|
||||
help='Audit current JSON against AME without changing the project; evidence goes to test/model-audit/mql8/.')
|
||||
arguments = parser.parse_args()
|
||||
HERE.mkdir(parents=True, exist_ok=True)
|
||||
original = json.loads(INPUT.read_text())
|
||||
sources = {str(p.relative_to(ROOT)): {'sha256': hashlib.sha256(p.read_bytes()).hexdigest(),
|
||||
'bytes': p.stat().st_size} for p in (AME, INPUT)}
|
||||
original = json.loads(INPUT.read_text(encoding='utf-8'))
|
||||
entities, edges, globals_, sim, model_info = read_drawing()
|
||||
mapping, matching = match_graph(entities, edges, original)
|
||||
corrected = deepcopy(original)
|
||||
@@ -266,7 +276,8 @@ def main():
|
||||
payload = ReactFlowProjectPayload.model_validate(executable)
|
||||
network = compile_reactflow_network(payload)
|
||||
program = compile_native_program(network)
|
||||
OUTPUT.write_text(json.dumps(corrected, ensure_ascii=False, indent=2) + '\n')
|
||||
if not arguments.check:
|
||||
OUTPUT.write_text(json.dumps(corrected, ensure_ascii=False, indent=2) + '\n', encoding='utf-8', newline='\n')
|
||||
xml = build_reactflow_system_xml(payload)
|
||||
(HERE / 'corrected.xml').write_bytes(xml if isinstance(xml, bytes) else xml.encode())
|
||||
# The archive's parameter table and run input have matching row order.
|
||||
@@ -296,7 +307,8 @@ def main():
|
||||
cache_checks.append({'dataPath': path, 'parameterDataLine': line,
|
||||
'drawingValue': drawing_value, 'runValue': run_value})
|
||||
audit = {
|
||||
'sources': {str(p.relative_to(ROOT)): {'sha256': hashlib.sha256(p.read_bytes()).hexdigest(), 'bytes': p.stat().st_size} for p in (AME, INPUT)},
|
||||
'sources': sources,
|
||||
'checkOnly': arguments.check,
|
||||
'output': str(OUTPUT.relative_to(ROOT)), 'globals': globals_, 'matching': matching,
|
||||
'counts': {'components': len(entities), 'connections': len(edges), 'parameters': len(parameter_audit),
|
||||
'changedParameters': len(parameter_changes), 'changedConnections': len(connection_changes),
|
||||
@@ -315,11 +327,16 @@ def main():
|
||||
'parameters': parameter_audit, 'connections': connection_audit,
|
||||
'evaluationSchedule': program.evaluation_schedule,
|
||||
}
|
||||
(HERE / 'audit.json').write_text(json.dumps(audit, ensure_ascii=False, indent=2) + '\n')
|
||||
(HERE / 'audit.json').write_text(json.dumps(audit, ensure_ascii=False, indent=2) + '\n', encoding='utf-8', newline='\n')
|
||||
print(json.dumps({'counts': audit['counts'], 'matching': matching,
|
||||
'parameters': parameter_changes, 'connections': connection_changes,
|
||||
'simulation': audit['simulation']}, ensure_ascii=False, indent=2))
|
||||
|
||||
if arguments.check:
|
||||
assert not parameter_changes, 'Current JSON parameters differ from AME; see audit.json.'
|
||||
assert not connection_changes, 'Current JSON connection ports differ from AME; see audit.json.'
|
||||
assert original['simulation'] == corrected['simulation'], 'Current JSON time settings differ from AME.'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user