from pathlib import Path import shutil out = Path('output') archive = out / 'original_submission' archive.mkdir(exist_ok=True) for name in ('diagnosis.md', 'check_words.py'): dest = archive / name if not dest.exists(): shutil.copyfile(out / name, dest) p = out / 'diagnosis.md' s = p.read_text() s = s.replace('- Current output is MP4 / H.264, 1920 × 1080, 16:9, 30 fps, duration 00:01:00', '- Displayed export settings are MP4 / H.264, 1920 × 1080, 16:9, 30 fps; project duration is 00:01:00') s = s.replace('Relinking restores the existing edit and addresses the offline-source blocker; do not rebuild the timeline', 'A successful relink restores the existing edit and removes this E204 blocker, allowing an export retry; it does not guarantee export success. Do not rebuild the timeline') p.write_text(s) n = len(s.split()) assert n <= 500 assert (archive / 'diagnosis.md').exists() assert 'Current output is' not in s print(f'Revised diagnosis: {n} whitespace-separated words; limit passed.') print('Original diagnosis and word-check script preserved separately.')