#!/usr/bin/env python3 """Frozen Pi1 native Intel qualification evidence; no keys, prompts, or publication.""" import argparse,datetime,difflib,hashlib,json,os,platform,shutil,signal,subprocess,sys,tempfile,time from pathlib import Path from closed_inventory import closed_tree from owned_processes import OwnedProcesses,atomic_json import source_guard from lifecycle import Lifecycle, run_test_cases from retain_pack import retain_pack from native_daemon_reuse import import_daemon HERE=Path(__file__).resolve().parent INPUTS=json.loads((HERE/'profile-inputs.json').read_text()) PIN=INPUTS['localComparison'] SOURCE=PIN['sourceRevision'] sha=source_guard.sha require=source_guard.require def tool_invocation(name): found=shutil.which(name) require(found is not None,'Required executable not found: '+name) # Multicall CLIs dispatch on argv[0]; preserve the name returned by PATH lookup. invocation=Path(found).absolute() target=invocation.resolve(strict=True) require(invocation.name==name and target.is_file() and os.access(invocation,os.X_OK),'Unexpected executable invocation') return invocation, {'invocationPath':str(invocation),'resolvedTarget':str(target),'targetSha256':sha(target)} def verify_tool_invocation(invocation, audit): require(str(invocation)==audit['invocationPath'] and str(invocation.resolve(strict=True))==audit['resolvedTarget'], 'Executable invocation or target changed') require(sha(invocation.resolve(strict=True))==audit['targetSha256'],'Executable target bytes changed') def execute(args): stage=args.source.resolve(strict=True);out=args.output.resolve() out.mkdir(mode=0o700,parents=True,exist_ok=False) scratch=Path(tempfile.mkdtemp(prefix='pc-intel-',dir='/private/tmp'));scratch.chmod(0o700) identity=(scratch.stat().st_dev,scratch.stat().st_ino,scratch.stat().st_uid) receipt={'status':'running','sourceRevision':SOURCE,'trustedWorkflowRevision':os.environ['GITHUB_WORKFLOW_SHA'], 'startedAt':datetime.datetime.now(datetime.timezone.utc).isoformat(),'runId':os.environ['GITHUB_RUN_ID'],'runAttempt':os.environ['GITHUB_RUN_ATTEMPT'], 'runnerLabel':'macos-15-intel','hostIsBareMetalClaim':False,'providerCalls':0,'credentialsRead':False, 'providerPromptsSubmitted':0,'imagePublications':0,'cloudSandboxesCreated':0,'automaticRetries':0, 'model':PIN['model'],'commands':[],'helpers':{p.name:sha(p) for p in HERE.iterdir() if p.is_file()}, 'originalTestSourceUnmodified':True,'cleanupObserverUsed':True,'localComparison':PIN} def save():atomic_json(out/'receipt.json',receipt) save() inherited_path=os.environ['PATH'] node=Path(shutil.which('node')).resolve(strict=True) pnpm=Path(shutil.which('pnpm')).resolve(strict=True) # Reused daemon bytes retain their original compiler provenance; no new compiler is invoked. env={'PATH':inherited_path,'HOME':str(scratch/'home'),'TMPDIR':str(scratch),'LANG':'en_US.UTF-8','CI':'true', 'PAPERCLIP_TELEMETRY_ENABLED':'false','PAPERCLIP_RUNNER_SOURCE_REVISION':SOURCE, 'CARGO_HOME':str(scratch/'cargo'),'RUSTUP_HOME':str(scratch/'rustup'),'CARGO_TARGET_DIR':str(scratch/'target'), 'RUSTUP_TOOLCHAIN':'1.97.1','CARGO_BUILD_JOBS':'2','npm_config_audit':'false','npm_config_fund':'false', 'npm_config_update_notifier':'false','npm_config_package_import_method':'copy'} Path(env['HOME']).mkdir(mode=0o700) active=None;owner=None;lifecycle=Lifecycle() def stop_signal(signum,_):raise InterruptedError('CI stopped with signal '+str(signum)) signal.signal(signal.SIGTERM,stop_signal) def run(command,label,timeout,cwd=stage,command_env=None,owned=False): nonlocal active,owner lifecycle.begin() row={'label':label,'startedAt':datetime.datetime.now(datetime.timezone.utc).isoformat(),'command':list(map(str,command)),'deadlineSeconds':timeout,'status':'running'} receipt['commands'].append(row);save();start=time.monotonic() with (out/(label+'.log')).open('x') as log: try: if owned:owner=OwnedProcesses(out/(label+'-processes.json'),scratch,stage,pack/'dist/cli/acpx-runtime-sidecar.cjs') active=subprocess.Popen(row['command'],cwd=cwd,env=command_env or env,stdout=log,stderr=log,start_new_session=True) while active.poll() is None: if owner:owner.observe(active.pid) require(time.monotonic()-start