Files
fengqun/tests/test_model_io_report_audit.py
T
gongzhiyongandOmX dc2b166e60 Use external codebase for live agent scenario
Replace the self-referential S07 code task with a pinned fastapi/fastapi GitHub scenario so the live Agent standard tests evaluate an external complex codebase instead of the local harness project.

Constraint: The user explicitly rejected using this project as the code target for the live scenario.

Rejected: Keeping swarm-minimal as the S07 code target | it would keep validating the harness against itself.

Confidence: high

Scope-risk: moderate

Directive: Keep S07 target files external to this repository unless the user explicitly asks for a local-harness scenario.

Tested: .venv/bin/python -u -B examples/run_standard_scenario_acceptance.py; .venv/bin/python -B -m unittest discover -s tests; .venv/bin/python -B -m py_compile swarm_minimal/*.py examples/*.py tests/*.py; .venv/bin/python -u -B examples/run_academic_standard_evaluation.py; git diff --check; docs secret-pattern scan.

Not-tested: Applying the proposed FastAPI patch inside the external fastapi/fastapi repository was not run; S07 is a live Agent reasoning and evidence-chain test.

Co-authored-by: OmX <omx@oh-my-codex.dev>
2026-05-16 15:44:36 +08:00

52 lines
1.7 KiB
Python

from pathlib import Path
import re
import unittest
ROOT = Path(__file__).resolve().parents[1]
REPORT = ROOT / "docs" / "MODEL_AGNET_IO_REPORT.zh-CN.md"
class ModelIoReportAuditTests(unittest.TestCase):
def test_report_exposes_scenarios_inputs_outputs_and_handoff(self) -> None:
text = REPORT.read_text(encoding="utf-8")
for required in [
"## 本轮测试场景补充",
"| S01 | syntax_import_sanity |",
"| S02 | unit_regression |",
"| S03-S06 | deterministic_standard_scenarios |",
"| S07 | live_external_github_code_reasoning |",
"| S08 | model_io_report_audit |",
"fastapi/fastapi",
"ecace740f3eaccb1aba152cf1de79477095c56f4",
"fastapi/routing.py",
"#### 本次任务输入 task.input",
"#### Agnet / 模型实际输出 task.output",
"#### 接手 / 交接机制",
"chain_edge=",
]:
self.assertIn(required, text)
for forbidden in [
"为 swarm-minimal 设计可恢复的大规模代码任务推理链",
"swarm_minimal/core.py",
"swarm_minimal/newapi_agnet.py",
"swarm_minimal/azure_store.py",
]:
self.assertNotIn(forbidden, text)
def test_report_does_not_contain_obvious_secret_values(self) -> None:
text = REPORT.read_text(encoding="utf-8")
forbidden_patterns = [
r"sk-[A-Za-z0-9]{20,}",
r"AccountKey=[^<\s`]+",
r"password=[^<\s`]+",
r"BEGIN [A-Z ]*PRIVATE KEY",
]
for pattern in forbidden_patterns:
self.assertIsNone(re.search(pattern, text, flags=re.IGNORECASE))
if __name__ == "__main__":
unittest.main()