Files
ARCADIA-Studio/harness/experiments/text-diagnostics-20260913/native-preparation/prepare-oracle.py
T
sorokin.oleg.edu 9fd76aef3a Add current-draft diagnostic underlines and passive hover
Preserve raw include diagnostic provenance and derive bands from the existing shaped editor. Retain deferred tooltip paragraphs through rendering. Include source, regression, failure and native-trial evidence; corrected native acceptance remains pending.
2026-09-13 01:43:22 -07:00

35 lines
2.1 KiB
Python

"""Read-only fixture lint with a pinned existing CLI; not current-build acceptance."""
from pathlib import Path
import datetime, hashlib, json, shutil, subprocess, sys
base = Path(__file__).resolve().parent
out = base / sys.argv[1]
out.mkdir()
binary = Path('C:/Users/User/Documents/Git/ARCADIA-Studio/.local/target-gnullvm/debug/arcadia.exe')
def identity(path):
raw = path.read_bytes()
return {'bytes': len(raw), 'sha256': hashlib.sha256(raw).hexdigest()}
before = identity(binary)
fixture = out / 'complete-fixture'
fixture.mkdir()
shutil.copyfile(base / 'fixtures/missing-include/project.arcadia', fixture / 'project.arcadia')
shutil.copyfile(base / 'fixtures/functions-to-discover.arcadia', fixture / 'functions.arcadia')
inputs = {p.name: identity(p) for p in fixture.iterdir()}
runs = []
for label, entry in [('missing', base / 'fixtures/missing-include/project.arcadia'), ('complete', fixture / 'project.arcadia')]:
argv = [str(binary), 'lint', str(entry), '--json']
start = datetime.datetime.now(datetime.timezone.utc).isoformat()
result = subprocess.run(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=out)
(out / f'{label}.stdout.json').write_bytes(result.stdout)
(out / f'{label}.stderr.log').write_bytes(result.stderr)
runs.append({'label': label, 'start': start, 'argv': argv, 'exitCode': result.returncode,
'stdout': identity(out / f'{label}.stdout.json'), 'stderr': identity(out / f'{label}.stderr.log')})
record = {'scope': 'Provisional fixture/diagnostic preparation using identified pre-existing CLI. Source provenance not established here; no current #12 binary or native acceptance claim.',
'helper': identity(Path(__file__)), 'binaryPath': str(binary), 'binary': before, 'binaryUnchanged': before == identity(binary),
'inputs': inputs, 'inputsUnchanged': inputs == {p.name: identity(p) for p in fixture.iterdir()}, 'runs': runs}
(out / 'result.json').write_text(json.dumps(record, indent=2), encoding='utf-8')
print(json.dumps(record, indent=2))
sys.exit(0 if [run['exitCode'] for run in runs] == [3, 0] and record['inputsUnchanged'] and record['binaryUnchanged'] else 1)