Record independently verified protected Save As diagnostics

This commit is contained in:
2026-10-01 18:53:52 -07:00
parent 0e83157e09
commit 046cdc1b46
66 changed files with 3289 additions and 0 deletions
@@ -0,0 +1,19 @@
from pathlib import Path
import datetime,hashlib,json,os,subprocess
root=Path(__file__).resolve().parents[1];run=root/'.local/native46'
record=json.loads((run/'baseline.json').read_text(encoding='utf-8'))
bin=run/'bin';exe=bin/'arcadia-studio.exe'
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
assert sha(exe)==record['binary']['sha256'] and sha(bin/'libunwind.dll')==record['runtime']['sha256']
work=run/'working';work.mkdir(exist_ok=False)
env=os.environ.copy();system=os.environ['SystemRoot'];env['PATH']=str(Path(system)/'System32')+';'+system
for k in list(env):
if k.startswith(('CARGO_','RUST','LLVM','WGPU','ARCADIA_')):del env[k]
receipt={'source':record['source'],'start':datetime.datetime.now(datetime.timezone.utc).isoformat(),'binary_sha256':sha(exe),'runtime_sha256':sha(bin/'libunwind.dll'),'cwd':str(work),'path':env['PATH']}
with (run/'stdout.log').open('xb') as out,(run/'stderr.log').open('xb') as err:
child=subprocess.Popen([str(exe)],cwd=work,env=env,stdout=out,stderr=err,creationflags=subprocess.CREATE_NO_WINDOW)
receipt['pid']=child.pid;(run/'started.json').write_text(json.dumps(receipt,indent=2)+'\n',encoding='utf-8');print(json.dumps(receipt,indent=2),flush=True)
code=child.wait()
receipt.update({'exit_code':code,'finished':datetime.datetime.now(datetime.timezone.utc).isoformat(),'stdout_bytes':(run/'stdout.log').stat().st_size,'stderr_bytes':(run/'stderr.log').stat().st_size,'binary_unchanged':sha(exe)==record['binary']['sha256'],'runtime_unchanged':sha(bin/'libunwind.dll')==record['runtime']['sha256']})
(run/'finished.json').write_text(json.dumps(receipt,indent=2)+'\n',encoding='utf-8');print(json.dumps(receipt,indent=2),flush=True)
assert code==0 and receipt['stdout_bytes']==receipt['stderr_bytes']==0 and receipt['binary_unchanged'] and receipt['runtime_unchanged']
@@ -0,0 +1,9 @@
from pathlib import Path
root=Path(__file__).resolve().parents[1]
original=Path('C:/ar-compact-01a0d717/.local/package39/native-model-oracle.py').read_text(encoding='utf-8')
text=original.replace("proof=json.loads((root/'extraction-check.json').read_text(encoding='utf-8'))", "proof=json.loads(Path('C:/ar-compact-01a0d717/.local/package39/extraction-check.json').read_text(encoding='utf-8'))")
text=text.replace("(root/'working/saved','qa-saved.arcadia')", "(root/'fresh-c','project.arcadia')")
text=text.replace('Assess pressure alarm QA LEFT XYRIGHT','Assess pressure alarm QA46')
assert text!=original and 'working/saved' not in text and 'QA LEFT XYRIGHT' not in text
(root/'.local/native46/native-model-oracle.py').write_text(text,encoding='utf-8')
print('Prepared exact-source/model QA46 oracle with explicit UTF-8 read')
@@ -0,0 +1,27 @@
from pathlib import Path
import hashlib,json,shutil,subprocess
root=Path(__file__).resolve().parents[1]
source='0e83157e09d52e6152df91208e41693b62da2d46'
assert subprocess.check_output(['git','rev-parse','HEAD'],cwd=root,text=True).strip()==source
subprocess.run(['git','diff','--exit-code',source,'--','crates','Cargo.toml','Cargo.lock'],cwd=root,check=True)
run=root/'.local/native46';run.mkdir(exist_ok=False)
bins=run/'bin';bins.mkdir()
target=Path('C:/Users/User/Documents/Git/ARCADIA-Studio/.local/target-gnullvm/debug')
runtime=Path('C:/ar-compact-01a0d717/.local/package39/bin/libunwind.dll')
assert hashlib.sha256(runtime.read_bytes()).hexdigest()=='f45604a12e8bcd839fd86f667c1be1cc7c4f9da2b3c69ff381ac708f0e1ae7d4'
shutil.copyfile(target/'arcadia-studio.exe',bins/'arcadia-studio.exe')
shutil.copyfile(runtime,bins/'libunwind.dll')
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
fixture=root/'examples/release1'
def inventory(p): return {f.relative_to(p).as_posix():{'bytes':f.stat().st_size,'sha256':sha(f)} for f in p.rglob('*') if f.is_file()}
baseline=inventory(fixture)
assert len(baseline)==37
for name in ['collision-a','external-b']: shutil.copytree(fixture,run/name)
fresh=run/'fresh-c';fresh.mkdir()
for f in fixture.rglob('*'):
if f.is_file() and f.suffix!='.arcadia':
p=fresh/f.relative_to(fixture);p.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(f,p)
assert len(inventory(fresh))==7 and not list(fresh.rglob('*.arcadia'))
receipt={'source':source,'profile':'dev/unoptimized','target':'x86_64-pc-windows-gnullvm','binary':{'bytes':(bins/'arcadia-studio.exe').stat().st_size,'sha256':sha(bins/'arcadia-studio.exe')},'runtime':{'bytes':(bins/'libunwind.dll').stat().st_size,'sha256':sha(bins/'libunwind.dll')},'baseline':baseline,'fresh_companions':inventory(fresh),'declared_rename':{'activity':'61f7bbfb-74a4-5540-9182-2583dfb27a49','before':'Assess pressure alarm','after':'Assess pressure alarm QA46'},'external_dependency':'oa/activities/activity_oa_restore_work.arcadia','external_comment':'\n// native #46 external-edit probe\n'}
(run/'baseline.json').write_text(json.dumps(receipt,indent=2)+'\n',encoding='utf-8')
print(json.dumps({k:v for k,v in receipt.items() if k not in ['baseline','fresh_companions']},indent=2))
@@ -0,0 +1,9 @@
$taskRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
$env:RUSTUP_HOME = Join-Path $taskRoot '.local\toolchain\rustup'
$env:CARGO_HOME = Join-Path $taskRoot '.local\toolchain\cargo'
$env:RUSTUP_TOOLCHAIN = 'stable-x86_64-pc-windows-gnullvm'
$env:PATH = "$env:CARGO_HOME\bin;$(Join-Path $taskRoot '.local\toolchain\llvm-mingw-20260826-ucrt-x86_64\bin');$env:PATH"
$env:CARGO_TARGET_DIR = Join-Path $taskRoot '.local\target-gnullvm'
# Keep this small development disk from accumulating multi-GiB incremental caches.
$env:CARGO_INCREMENTAL = '0'
$env:CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER = 'clang.exe'