"""Bind native launch to closed same-source Windows gates and the current CLI oracle.""" from pathlib import Path import hashlib, json base = Path(__file__).resolve().parent gates = base.parent / 'text-diagnostic-gates' def identity(path): raw = path.read_bytes() return {'path':str(path), 'bytes':len(raw), 'sha256':hashlib.sha256(raw).hexdigest()} def read(path): return json.loads(path.read_text(encoding='utf-8')) preserved = base / 'windows-build-final-1-binaries/preserved.json' binary_record = read(preserved) evidence = [identity(preserved), identity(Path(__file__)), identity(base / 'launch.py'), identity(base / 'native-recorder.js')] source_inputs = None for label in ['strict-clippy-3','desktop-cli-final-1','format-final-1','windows-build-final-1']: root = gates / label result = read(root / 'result.json') assert result['exitCode'] == 0 and result['inputsUnchanged'] and result['inputCount'] == 604 assert result['environment']['RUSTUP_TOOLCHAIN'] == 'stable-x86_64-pc-windows-gnullvm' if source_inputs is None: source_inputs = result['inputs'] assert source_inputs == result['inputs'] evidence.append(identity(root / 'result.json')) for name, key in [('inputs.json','inputs'),('inputs.zip','archive'),('stdout.log','stdout'),('stderr.log','stderr')]: item = identity(root / name) assert {k:item[k] for k in ['bytes','sha256']} == result[key] evidence.append(item) oracle_path = base / 'current-oracle-1/result.json' oracle = read(oracle_path) assert oracle['passed'] and oracle['sourceInputs'] == source_inputs evidence.append(identity(oracle_path)) for name in ['missing.stdout.json','missing.stderr.log','complete.stdout.json','complete.stderr.log']: evidence.append(identity(oracle_path.parent / name)) for name in ['fixtures/missing-include/project.arcadia','fixtures/functions-to-discover.arcadia']: evidence.append(identity(base / name)) binary = next(b for b in binary_record['binaries'] if b['name'] == 'arcadia-studio') actual = identity(Path(binary['path'])) assert all(actual[key] == binary[key] for key in ['bytes','sha256']) build_path = gates / 'windows-build-final-1/result.json' build = read(build_path) assert binary_record['buildResult'] == identity(build_path) assert binary_record['sourceInputs'] == source_inputs assert 'build' in build['command'] and build['finish'] if '--target' in build['command']: assert build['command'][build['command'].index('--target') + 1] == 'x86_64-pc-windows-gnullvm' matches = [a for a in build['artifacts'] if a['cargo']['target']['name'] == 'arcadia-studio' and a['cargo']['target']['kind'] == ['bin'] and a['cargo']['profile']['test'] is False and a['cargo']['executable']] assert len(matches) == 1 artifact = matches[0] assert artifact['readback'] == {key:actual[key] for key in ['bytes','sha256']} assert Path(binary['source']).resolve() == Path(artifact['cargo']['executable']).resolve() assert Path(artifact['cargo']['manifest_path']).resolve() == (Path(build['cwd']) / 'crates/oa-desktop/Cargo.toml').resolve() assert 'crates/oa-desktop/Cargo.toml' in read(build_path.parent / 'inputs.json') raw_artifacts = [] for line in (build_path.parent / 'stdout.log').read_text(encoding='utf-8').splitlines(): try: value = json.loads(line) except json.JSONDecodeError: continue if isinstance(value, dict) and value.get('reason') == 'compiler-artifact': raw_artifacts.append(value) assert artifact['cargo'] in raw_artifacts assert oracle['buildResult']['sha256'] == identity(build_path)['sha256'] manifest = {'nativeReady':True, 'target':'x86_64-pc-windows-gnullvm', 'scope':'Development diagnostic GUI trial only; no integrated package or release acceptance.', 'sourceInputs':source_inputs, 'binary':actual, 'evidence':evidence} path = base / 'launch-manifest-final-1.json' with path.open('x', encoding='utf-8', newline='\n') as output: json.dump(manifest, output, indent=2) output.write('\n') print(json.dumps(identity(path)))