import importlib.util import unittest from pathlib import Path def load_init_runner(): script_path = Path(__file__).resolve().parents[1] / "scripts" / "init_round05_context.py" spec = importlib.util.spec_from_file_location("init_round05_context", script_path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module class Round05ContextInitTests(unittest.TestCase): def test_required_sources_and_output_path_are_declared(self): runner = load_init_runner() self.assertEqual( runner.OUTPUT_RELATIVE_PATH, Path("ccra_review_bundle") / "round-05_init_selector-calibration-policy" / "00_ROUND05_NEW_SESSION_CONTEXT.md", ) for required in [ "reports/Round04_closeout_note_2026-06-18.md", "reports/Round04_blind_routing_evaluation_report_2026-06-18.md", "reports/Round04_1_post_patch_routing_verification_report_2026-06-18.md", "selector/round04_blind_inputs.json", "selector/selector_rules.json", "selector/selector_calibration_inputs.json", "tests/qpi.regression.json", "tests/intellectual_archaeology.regression.json", "tests/regression_cases.json", "docs/DECISIONS.md", "docs/WORKFLOW.md", ]: self.assertIn(required, runner.REQUIRED_SOURCE_FILES) def test_context_document_contains_round05_scope_and_missing_file_section(self): runner = load_init_runner() root = Path(__file__).resolve().parents[1] document, summary = runner.build_context_document(root) self.assertIn("# Round 05 New Session Context", document) self.assertIn("## Project State", document) self.assertIn("## Round 04 / 04.1 Closure Summary", document) self.assertIn("## Round 05: Selector Calibration Policy Review", document) self.assertIn("## Round 05 Core Questions", document) self.assertIn("## Files To Read in New Conversation", document) self.assertIn("## Round 05 Non-Goals", document) self.assertIn("## Suggested Round 05 Deliverables", document) self.assertIn("## Missing Files", document) self.assertIn("R04-BI-022", document) self.assertIn("QPI", document) self.assertIn("Intellectual Archaeology", document) self.assertEqual(summary["sections"][0], "Project State") self.assertIn("Round 05 Non-Goals", summary["sections"]) if __name__ == "__main__": unittest.main()