"""Ensure cross-evidence synthesis remains reachable, without fake mandatory evidence quotas.""" from pathlib import Path from tempfile import TemporaryDirectory import shutil import sys import unittest ROOT=Path(__file__).resolve().parents[1] SKILL=ROOT/'.agents/skills/history-writing-workflow-c4h' sys.path.insert(0,str(ROOT/'tools')) import new_item import validate class SynthesisProseTests(unittest.TestCase): def test_protocol_linked_at_all_entrypoints(self): self.assertTrue((ROOT/'SYNTHESIS_AND_PROSE.md').exists()) for f in ('AGENTS.md','README.md','code4history.md','INTERPRETATION.md','ARGUMENT_DENSITY.md'): self.assertIn('SYNTHESIS_AND_PROSE.md',(ROOT/f).read_text(encoding='utf-8'),f) self.assertIn('SYNTHESIS_AND_PROSE.md',(SKILL/'SKILL.md').read_text(encoding='utf-8')) self.assertTrue((SKILL/'references/synthesis-logic-quotation.md').exists()) def test_synthesis_card_kind(self): self.assertIn('synthesis',new_item.KINDS) self.assertIn('SYN-', (ROOT/'10_templates/synthesis.md').read_text(encoding='utf-8').replace('__ID__','SYN-0001')) self.assertIn('section-plan.md',(ROOT/'07_manuscript/readme.md').read_text(encoding='utf-8')) def test_new_synthesis_card_structure(self): with TemporaryDirectory() as td: root=Path(td) (root/'10_templates').mkdir() shutil.copy(ROOT/'10_templates/synthesis.md',root/'10_templates/synthesis.md') ident,p=new_item.create(root,'synthesis','cross-reference') self.assertEqual(ident,'SYN-0001') self.assertEqual(p.relative_to(root).as_posix(),'06_arguments/syntheses/SYN-0001-cross-reference.md') self.assertEqual(validate.parse_header(p.read_text(encoding='utf-8')).get('id'),ident) self.assertTrue(validate.ID_FORMAT.fullmatch(ident)) self.assertIn('06_arguments/syntheses',validate.CARD_DIRS) def test_no_overwrite_of_user_data(self): self.assertEqual((ROOT/'USERINFO.md').stat().st_size,0) self.assertFalse((ROOT/'agent.md').exists()) self.assertIn('Q18',(ROOT/'topic.md').read_text(encoding='utf-8')) def test_core_examples(self): protocol=(ROOT/'SYNTHESIS_AND_PROSE.md').read_text(encoding='utf-8') for key in ('独立互证','直接引文','逻辑关系','原文','转述','审查'): self.assertIn(key,protocol) if __name__=='__main__':unittest.main()