from pathlib import Path import re root = Path('C:/ar-text-9e8r6t') prepared = Path('C:/Users/User/Documents/Git/ARCADIA-Studio/.local/text-diagnostics-20260913') module = root / 'crates/oa-desktop/src/source_annotations' target = module / 'widget/tests.rs' target.parent.mkdir(exist_ok=True) source = (prepared / 'prepared-widget-tests.rs').read_text(encoding='utf-8') source = source[source.index('//! Actual Decorations'):] source = source.replace("//! Footer expectations target the parent's measured-height/remaining-count fix.", '//! Footer expectations require measured height and an explicit remaining count.') target.write_text(source, encoding='utf-8') with (module / 'widget.rs').open('a', encoding='utf-8') as out: out.write('\n#[cfg(all(test, debug_assertions))]\nmod tests;\n') source = (prepared / 'prepared-annotation-performance.rs').read_text(encoding='utf-8') source = source[source.index('use super::*;'):] (module / 'performance_tests.rs').write_text('//! Manual actual-layout timing distributions; no fixed machine threshold.\n' + source, encoding='utf-8') source = (prepared / 'prepared-anchor-followup.rs').read_text(encoding='utf-8') source = source[source.index('use super::*;'):] source = source.replace('#[test]\n', '#[test]\n#[ignore = "manual supported-font cluster and bidi witnesses"]\n') (module / 'anchor_tests.rs').write_text('//! Manual actual-font witnesses; missing supported glyphs fail fixture admission.\n' + source, encoding='utf-8') with (root / 'crates/oa-desktop/src/source_annotations.rs').open('a', encoding='utf-8') as out: out.write('\n#[cfg(test)]\nmod performance_tests;\n#[cfg(test)]\nmod anchor_tests;\n') with (root / 'crates/oa-desktop/src/app/text_workspace/tests.rs').open('a', encoding='utf-8') as out: out.write((root / '.local/text-diagnostic-gates/prepared-app-annotation-tests.rs').read_text(encoding='utf-8')) log = (root / '.local/text-diagnostic-gates/provenance-core-full-1/stdout.log').read_text(encoding='utf-8') counts = [tuple(map(int, m)) for m in re.findall(r'test result: ok\. (\d+) passed; (\d+) failed; (\d+) ignored;', log)] print('core result groups', len(counts), 'totals', tuple(map(sum, zip(*counts)))) print('Prepared tests installed; uncompiled.')