Files
ARCADIA-Studio/harness/experiments/text-diagnostics-20260913/native-preparation/build-and-preserve.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

36 lines
1.8 KiB
Python

"""Run the captured build gate and immediately retain its exact GUI/CLI artifacts."""
from pathlib import Path
import hashlib, json, shutil, subprocess, sys
base = Path(__file__).resolve().parent
gate = base.parent / 'text-diagnostic-gates/gate.py'
label = sys.argv[1]
out = base / (label + '-binaries')
assert not out.exists()
code = subprocess.run([sys.executable, str(gate), label, 'build', '--locked', '--offline', '--message-format=json', '-p', 'oa-desktop', '-p', 'oa-cli']).returncode
if code:
sys.exit(code)
result_path = gate.parent / label / 'result.json'
result = json.loads(result_path.read_text(encoding='utf-8'))
assert result['exitCode'] == 0 and result['inputsUnchanged']
def identity(path):
data = path.read_bytes()
return {'bytes':len(data), 'sha256':hashlib.sha256(data).hexdigest()}
out.mkdir()
copied = []
for name in ['arcadia-studio', 'arcadia']:
candidates = [a for a in result['artifacts'] if a['cargo']['target']['name'] == name and a['cargo']['target']['kind'] == ['bin'] and not a['cargo']['profile']['test']]
assert len(candidates) == 1, (name, len(candidates))
artifact = candidates[0]
source = Path(artifact['cargo']['executable'])
assert identity(source) == artifact['readback']
destination = out / (name + '.exe')
shutil.copyfile(source, destination)
assert identity(source) == identity(destination) == artifact['readback']
copied.append({'name':name, 'source':str(source), 'path':str(destination), **identity(destination)})
record = {'buildResult':{'path':str(result_path), **identity(result_path)}, 'sourceInputs':result['inputs'], 'helper':identity(Path(__file__)), 'binaries':copied}
(out / 'preserved.json').write_text(json.dumps(record, indent=2) + '\n', encoding='utf-8')
print(json.dumps(record, indent=2))