Remove review material byte caps and enable complete readonly evidence inspection
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"candidate": "d1c7ce27d21a77be87081e12d20e7c8dd6ffa353",
|
||||
"original_unit_completed": false,
|
||||
"next": "final native with first-writer semantic preflight, normal OS, final regression, independent Opus, integration",
|
||||
"fixed_material_limit": null,
|
||||
"file_count_limit": null,
|
||||
"original_30_88_unchanged": true
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
"""Execute unchanged submitted P08 collector with storage-only closed-phase hook."""
|
||||
from pathlib import Path
|
||||
import importlib.util,argparse,json,sys,hashlib
|
||||
sys.dont_write_bytecode=True
|
||||
parser=argparse.ArgumentParser();parser.add_argument('--commit',required=True);parser.add_argument('--output',type=Path,required=True);args=parser.parse_args()
|
||||
root=Path('/Users/korizatou114/Projects/TheTree-managed-worktrees/p08-02/P08-02-implement')
|
||||
coordinator=Path(__file__).resolve().parent
|
||||
|
||||
def load(name,path):
|
||||
s=importlib.util.spec_from_file_location(name,path);m=importlib.util.module_from_spec(s);s.loader.exec_module(m);return m
|
||||
|
||||
driver=load('submitted_p08_collector',root/'tools/run_p08_mixed_migration.py')
|
||||
storage=load('closed_phase_storage',coordinator/'native_storage_guard.py')
|
||||
original_module=driver.module
|
||||
traces=[]
|
||||
|
||||
def module(name,path):
|
||||
m=original_module(name,path)
|
||||
if name=='p08_standard_runner':
|
||||
original=m.execute_phase
|
||||
def execute(*values,**kwargs):
|
||||
row=original(*values,**kwargs)
|
||||
print(json.dumps({'phase':values[3],'passed':row['passed'],'actual_pid':row.get('actual_pid'),'exit':row.get('exit_code'),'error':row.get('validation_error'),'guard_error':row.get('guard_error')}),flush=True)
|
||||
if row['passed']:
|
||||
if values[3] == 'off-positive-writer':
|
||||
checker=load('final_first_writer_semantic',root/'tools/check_p08_migration_evidence.py')
|
||||
pair=args.output/'pairs/off-positive'
|
||||
identity=checker.decode(checker.load(pair/'identity.json'))
|
||||
before=checker.decode(checker.load(pair/'original.json'))
|
||||
after=checker.decode(checker.load(pair/'writer-checkpoint.json'))
|
||||
checker.semantics(before,identity,initial=True)
|
||||
checker.semantics(after,identity)
|
||||
checker.migration_revisions(before['systems']['runtime'],after['systems']['runtime'],False)
|
||||
checker.semantics(checker.decode(checker.load(pair/'writer-minute-160.json')),identity)
|
||||
print(json.dumps({'early_actual_first_writer_semantics':'PASS','candidate':args.commit,'no_acceptance_criteria_omitted':True}),flush=True)
|
||||
changes=storage.compress_closed_phase(args.output,row)
|
||||
traces.append({'phase':values[3],'ended_native_pid':row.get('actual_pid'),'storage_only_changes':changes})
|
||||
print(json.dumps({'phase':values[3],'closed_proofs_preserved_and_compressed':len(changes)}),flush=True)
|
||||
return row
|
||||
m.execute_phase=execute
|
||||
return m
|
||||
|
||||
driver.module=module
|
||||
native=argparse.Namespace(project_root=root,output=args.output.resolve(),commit=args.commit,godot='/Applications/Godot.app/Contents/MacOS/Godot',collect=True)
|
||||
code=driver.collect(native)
|
||||
record={'target_commit':args.commit,'native_exit':code,'storage_helper_sha256':hashlib.sha256((coordinator/'native_storage_guard.py').read_bytes()).hexdigest(),'collector_sha256':hashlib.sha256((root/'tools/run_p08_mixed_migration.py').read_bytes()).hexdigest(),'snapshots_or_timepoints_omitted':0,'worker_source_changed':False,'phase_traces':traces,'original_unit_accepted':False}
|
||||
(coordinator/'NATIVE_STORAGE_COLLECTION_TRACE.json').write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n')
|
||||
raise SystemExit(code)
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
"""Coordinator storage only: transparently compress closed, owned phase proof files.
|
||||
|
||||
No snapshot/timepoint filtering. No changes to worker code or native outputs.
|
||||
Call only after execute_phase returned and actual engine_ended is true.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import hashlib,json,os,subprocess
|
||||
|
||||
def compress_closed_phase(out, phase_row):
|
||||
if phase_row.get('engine_ended') is not True:
|
||||
raise RuntimeError('Owned native child must actually have ended')
|
||||
out=Path(out).resolve()
|
||||
rows=[]
|
||||
candidates=[p for p in sorted((out/'pairs').rglob('*')) if p.is_file() and not p.is_symlink() and p.suffix in ('.var','.json') and p.stat().st_size>=65536 and not p.stat().st_flags&32] if (out/'pairs').exists() else []
|
||||
for offset in range(0,len(candidates),128):
|
||||
probe=subprocess.run(['/usr/sbin/lsof','-t','--',*[str(p) for p in candidates[offset:offset+128]]],capture_output=True,text=True)
|
||||
if probe.stdout.strip(): raise RuntimeError('Owned proof has open handles')
|
||||
for p in candidates:
|
||||
if not p.is_file() or p.is_symlink() or p.suffix not in ('.var','.json'):
|
||||
continue
|
||||
old=p.stat()
|
||||
if old.st_flags & 32 or old.st_size < 65536: continue
|
||||
data_sha=hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
temp=p.with_name(p.name+'.owned-hfs-temporary')
|
||||
if temp.exists(): raise RuntimeError('Storage temporary collision')
|
||||
subprocess.run(['/usr/bin/ditto','--hfsCompression','--noclone',str(p),str(temp)],check=True)
|
||||
now=temp.stat()
|
||||
if hashlib.sha256(temp.read_bytes()).hexdigest()!=data_sha or (now.st_size,now.st_mode,now.st_uid,now.st_gid,now.st_mtime_ns)!=(old.st_size,old.st_mode,old.st_uid,old.st_gid,old.st_mtime_ns):
|
||||
raise RuntimeError('Content/metadata preservation failed')
|
||||
if hashlib.sha256(p.read_bytes()).hexdigest()!=data_sha:
|
||||
raise RuntimeError('Original proof changed before replacement')
|
||||
os.replace(temp,p)
|
||||
if hashlib.sha256(p.read_bytes()).hexdigest()!=data_sha:
|
||||
raise RuntimeError('Post-replacement content mismatch')
|
||||
rows.append({'path':str(p.relative_to(out)),'bytes':old.st_size,'sha256':data_sha,'physical_before':old.st_blocks*512,'physical_after':p.stat().st_blocks*512,'whole_bytes_and_mode_owner_mtime_preserved':True})
|
||||
return rows
|
||||
Reference in New Issue
Block a user