|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from pathlib import Path |
| 4 | + |
| 5 | + |
| 6 | +PROOF_PATH = Path("docs/plans/post-phase-67-runtime-created-world-eval-proof-2026-06-08.md") |
| 7 | +MINIMUM_LOOP = ( |
| 8 | + "corpus -> chunks -> graph -> personas -> scenarios -> deterministic runs -> " |
| 9 | + "report/claims -> eval" |
| 10 | +) |
| 11 | + |
| 12 | + |
| 13 | +def _read(path: Path) -> str: |
| 14 | + assert path.exists(), path |
| 15 | + return path.read_text(encoding="utf-8") |
| 16 | + |
| 17 | + |
| 18 | +def test_runtime_created_world_eval_proof_exists_with_guardrails() -> None: |
| 19 | + proof = _read(PROOF_PATH) |
| 20 | + required_sections = [ |
| 21 | + "# Post-Phase-67 Runtime-Created World Eval Proof", |
| 22 | + "## Scope", |
| 23 | + "## Source Evidence", |
| 24 | + "## Validation Evidence", |
| 25 | + "## Queue Decision", |
| 26 | + "## Boundaries", |
| 27 | + "## Validation Commands", |
| 28 | + ] |
| 29 | + for section in required_sections: |
| 30 | + assert section in proof |
| 31 | + |
| 32 | + required_phrases = [ |
| 33 | + f"`{MINIMUM_LOOP}`", |
| 34 | + "runtime-created bounded world can pass `eval-world`", |
| 35 | + "This closes only the narrow runtime-created template proof question", |
| 36 | + "The queue remains paused.", |
| 37 | + "Do not open Phase 68 from this proof.", |
| 38 | + "does not claim future-world readiness", |
| 39 | + "Do not present Mirror as a real-world prediction machine.", |
| 40 | + "Do not build real-person personas or digital doubles.", |
| 41 | + "Do not build political persuasion, hidden surveillance, law-enforcement scoring, hiring, credit, medical, or judicial decision systems.", |
| 42 | + ] |
| 43 | + for phrase in required_phrases: |
| 44 | + assert phrase in proof, phrase |
| 45 | + |
| 46 | + |
| 47 | +def test_runtime_created_world_eval_proof_is_source_backed() -> None: |
| 48 | + proof = _read(PROOF_PATH) |
| 49 | + template_service = _read(Path("backend/app/world_templates/service.py")) |
| 50 | + eval_service = _read(Path("backend/app/evals/service.py")) |
| 51 | + cli_tests = _read(Path("backend/tests/test_cli.py")) |
| 52 | + |
| 53 | + for phrase in [ |
| 54 | + 'default_report_scenario = "evidence_delayed"', |
| 55 | + '"default_report_scenario": default_report_scenario', |
| 56 | + 'world_root / "scenarios" / f"{default_report_scenario}.yaml"', |
| 57 | + '"kind": "delay_document"', |
| 58 | + ]: |
| 59 | + assert phrase in template_service |
| 60 | + assert phrase in proof |
| 61 | + |
| 62 | + for phrase in [ |
| 63 | + "def _default_redlines_path(repo_root: Path) -> Path:", |
| 64 | + "runtime_path = repo_root / \"evals\" / \"assertions\" / \"redlines.yaml\"", |
| 65 | + "Path(__file__).resolve().parents[3] / \"evals\" / \"assertions\" / \"redlines.yaml\"", |
| 66 | + ]: |
| 67 | + assert phrase in eval_service |
| 68 | + |
| 69 | + for phrase in [ |
| 70 | + "test_cli_runtime_created_world_passes_eval_world", |
| 71 | + 'main(["eval-world", "--world", world_id])', |
| 72 | + 'eval_payload["metrics"]["tracked_outcome_fields_covered"] == 5', |
| 73 | + 'eval_payload["metrics"]["compare_outcome_fields_covered"] == 5', |
| 74 | + 'eval_payload["metrics"]["report_compare_sourced"] is True', |
| 75 | + 'eval_payload["metrics"]["transfer_proof_world_local"] is True', |
| 76 | + 'claim.get("label")', |
| 77 | + 'claim.get("evidence_ids")', |
| 78 | + '"scenario_harbor_night_drill_template_matrix"', |
| 79 | + ]: |
| 80 | + assert phrase in cli_tests |
| 81 | + assert phrase in proof |
| 82 | + |
| 83 | + |
| 84 | +def test_current_docs_point_to_runtime_created_world_eval_proof_without_phase68() -> None: |
| 85 | + docs = [ |
| 86 | + Path("README.md"), |
| 87 | + Path("docs/plans/current-state-baseline.md"), |
| 88 | + Path("docs/plans/phase-execution-queue.md"), |
| 89 | + Path("docs/plans/automation-roadmap.md"), |
| 90 | + ] |
| 91 | + required_phrases = [ |
| 92 | + "`docs/plans/post-phase-67-runtime-created-world-eval-proof-2026-06-08.md`", |
| 93 | + "Post-Phase-67 runtime-created world eval proof keeps the queue paused", |
| 94 | + "runtime-created bounded world can pass `eval-world`", |
| 95 | + "does not claim future-world readiness", |
| 96 | + "Do not open Phase 68 from this proof.", |
| 97 | + ] |
| 98 | + forbidden_phrases = [ |
| 99 | + "Phase 68 is active", |
| 100 | + "Phase 68 execution queue is open", |
| 101 | + "`audit-github-queue` reports `ready` for Phase 68", |
| 102 | + "milestone `Phase 68", |
| 103 | + ] |
| 104 | + for path in docs: |
| 105 | + text = _read(path) |
| 106 | + for phrase in required_phrases: |
| 107 | + assert phrase in text, f"{path} is missing runtime-created eval proof pointer: {phrase}" |
| 108 | + for phrase in forbidden_phrases: |
| 109 | + assert phrase not in text, f"{path} opens Phase 68 prematurely: {phrase}" |
0 commit comments