Publish verified traceability view Windows evidence
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
# Source-bundle capture supplement, declared before model edits
|
||||
|
||||
The native trial at source 17f1f89fef4a6bf520f4b09a2116548b967d030e has successfully imported JSON and saved working/traceability-trial.arcadia. Save As generated seven included .arcadia modules. No semantic checkpoint or placement has occurred according to the parent operator. The frozen check.py copies only the entry before evaluating it; alone that copy would lack its included modules. This supplement changes actual-evidence capture only. It leaves the frozen recipes, B/P expected Projects, first-placement UUID/position rules and immutable manifest unchanged.
|
||||
|
||||
After independent review and parent acceptance, invoke (from any cwd):
|
||||
|
||||
python NATIVE_ROOT/supplement-source-bundle/capture_bundle.py --expected B --checkpoint 00-baseline
|
||||
python NATIVE_ROOT/supplement-source-bundle/capture_bundle.py --expected P --checkpoint 01-place --calibration PRE_INPUT_CALIBRATION.json
|
||||
|
||||
Each invocation requires a new checkpoint directory under this supplement. It inventories every .arcadia file in working, checks the bounded generated fixture's complete include closure, and copies the original entry and all included source files with their relative paths unchanged. This fixture uses only direct entry includes; nested include syntax is conservatively refused rather than reimplemented. Links, junctions, outside paths, unknown source files and state.arcadia collisions are refused. Original JSON import is not part of the saved source bundle.
|
||||
|
||||
The unchanged checker receives --actual ORIGINAL_WORKING_ENTRY and --output-prefix NEW_DIRECTORY/state. Thus its new state.arcadia is beside the copied includes and its evaluator resolves the snapshot, not live includes. The wrapper checks original and copied complete source inventories before the checker, then both again afterward. It requires the checker exit and complete-Project equality to pass. The receipt binds wrapper, this plan, frozen manifest/checker, source inventories, inner receipt, and existing/new binding hashes.
|
||||
|
||||
An inner success alone is insufficient. Only bundle-receipt.json with accepted=true accepts a checkpoint. Any outer failure after capture begins permanently writes UNACCEPTED.json at supplement level: stop the trial, retain all files and any inner-created binding, and never delete/relearn/reuse that binding. Subsequent wrapper invocations reject this marker; existing bindings also require the first checkpoint's successful outer receipt and matching hashes. Manual direct check.py invocation cannot substitute for this acceptance rule.
|
||||
|
||||
This plan does not claim atomic filesystem snapshots. Exact pre/post hashes bound a quiet saved checkpoint; transient changes that restore identical bytes are not detected. Do not save or edit during capture. The launch/capture/normal-close recipes record only the default entry hash; they do not attest to all included module bytes. This supplement's complete source inventories and full-Project comparisons supply that checkpoint evidence. GUI observations, close behavior and input timing remain separately documented native evidence. Existing frozen artifacts and prior failed attempts remain untouched.
|
||||
|
||||
Preparation only: independent review and parent readback are required before invocation. No compiler, evaluator, checkpoint, staging or GUI operation was run to author this supplement.
|
||||
|
||||
## UNACCEPTED PROPOSAL — DO NOT EXECUTE
|
||||
|
||||
Independent review found a blocking evaluator incompatibility before execution. The frozen attachment_snapshot uses persistence::load, which reads one file and parses it without include resolution; language.rs rejects include statements on that path. Copying modules beside state.arcadia does not repair that contract. This wrapper has never been run and is not an accepted checkpoint method. Retain it as rejected preparation; do not invoke it or interpret its prepared receipt scheme as evidence. Ancestor containment also needs strengthening before any future reuse. See `.local/traceability-view-bundle-supplement-review-20260923.md`.
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
"""Capture the generated source bundle; delegate unchanged semantic oracle to check.py."""
|
||||
from pathlib import Path, PurePosixPath
|
||||
import argparse, datetime, hashlib, json, re, shutil, subprocess, sys
|
||||
HERE=Path(__file__).resolve().parent
|
||||
ROOT=HERE.parent
|
||||
WORK=ROOT/'working'
|
||||
def digest(p):
|
||||
b=p.read_bytes(); return {'bytes':len(b),'sha256':hashlib.sha256(b).hexdigest()}
|
||||
def read(p): return json.loads(p.read_text(encoding='utf-8-sig'))
|
||||
def write(p,v):
|
||||
with p.open('x',encoding='utf-8') as f: json.dump(v,f,indent=2);f.write('\n')
|
||||
def inventory(root):
|
||||
if root.is_symlink() or root.is_junction(): raise RuntimeError('Linked bundle root forbidden')
|
||||
out={}
|
||||
for p in root.rglob('*'):
|
||||
if p.is_symlink() or p.is_junction() or getattr(p.lstat(), 'st_file_attributes', 0)&1024: raise RuntimeError('Links forbidden: '+str(p))
|
||||
if p.is_file() and p.suffix.lower()=='.arcadia': out[p.relative_to(root).as_posix()]=digest(p)
|
||||
return out
|
||||
def closure(entry, inv):
|
||||
# Bounded generated fixture: includes only in entry, with simple normalized paths.
|
||||
text=entry.read_text(encoding='utf-8-sig')
|
||||
paths=re.findall(r'\binclude\s+"([^"\r\n]+)"\s*;',text)
|
||||
if len(re.findall(r'\binclude\b',text))!=len(paths): raise RuntimeError('Unsupported include syntax')
|
||||
for name in paths:
|
||||
p=PurePosixPath(name)
|
||||
if p.is_absolute() or '..' in p.parts or ':' in name or '\\' in name or str(p)!=name or name not in inv: raise RuntimeError('Unsafe/missing include: '+name)
|
||||
if re.search(r'\binclude\b',(entry.parent/name).read_text(encoding='utf-8-sig')): raise RuntimeError('Nested includes outside this fixed assay')
|
||||
if set(inv)!={entry.name,*paths}: raise RuntimeError('Unexpected source file outside declared bundle')
|
||||
def main():
|
||||
ap=argparse.ArgumentParser();ap.add_argument('--expected',choices=['B','P'],required=True);ap.add_argument('--checkpoint',required=True);ap.add_argument('--calibration',type=Path);a=ap.parse_args()
|
||||
if not re.fullmatch(r'[0-9]{2}-[a-z0-9-]+',a.checkpoint): raise RuntimeError('Use NN-name checkpoint')
|
||||
if (HERE/'UNACCEPTED.json').exists(): raise RuntimeError('Prior outer failure: trial quarantined, no binding reuse or relearning')
|
||||
dest=HERE/'checkpoints'/a.checkpoint
|
||||
if dest.exists(): raise RuntimeError('Fresh checkpoint required')
|
||||
manifest=read(ROOT/'input-manifest.json');entry=Path(manifest['saved_working_path'])
|
||||
if entry.parent.resolve()!=WORK.resolve() or entry.is_symlink(): raise RuntimeError('Unexpected entry location')
|
||||
prior=ROOT/'fresh-node-binding.json'
|
||||
if prior.exists():
|
||||
binding=read(prior); first=Path(binding['first_checkpoint_receipt']['path']);outer=first.parent/'bundle-receipt.json'
|
||||
accepted=read(outer)
|
||||
if not accepted['accepted'] or accepted['inner_receipt']!=digest(first) or accepted['binding_after']!=digest(prior): raise RuntimeError('Binding lacks successful outer acceptance')
|
||||
dest.mkdir(parents=True)
|
||||
receipt={'started_utc':datetime.datetime.now(datetime.timezone.utc).isoformat(),'accepted':False,'failure':None,'expected':a.expected,'wrapper':digest(Path(__file__)),'plan':digest(HERE/'README.md'),'manifest':digest(ROOT/'input-manifest.json'),'checker':digest(ROOT/'check.py'),'entry':str(entry),'binding_before':digest(prior) if prior.exists() else None}
|
||||
try:
|
||||
before=inventory(WORK);closure(entry,before)
|
||||
if 'state.arcadia' in before: raise RuntimeError('Snapshot entry collision')
|
||||
receipt['original_before']=before
|
||||
for name in before:
|
||||
target=dest/name;target.parent.mkdir(parents=True,exist_ok=True)
|
||||
with target.open('xb') as f:f.write((WORK/name).read_bytes())
|
||||
if inventory(dest)!=before or inventory(WORK)!=before: raise RuntimeError('Bundle changed during capture')
|
||||
argv=[sys.executable,str(ROOT/'check.py'),'--expected',a.expected,'--actual',str(entry),'--output-prefix',str(dest/'state')]
|
||||
if a.calibration: argv+=['--calibration',str(a.calibration.resolve())]
|
||||
receipt['argv']=argv
|
||||
with (dest/'wrapper.stdout.log').open('xb') as out,(dest/'wrapper.stderr.log').open('xb') as err:
|
||||
result=subprocess.run(argv,cwd=ROOT,stdout=out,stderr=err)
|
||||
receipt['exit_code']=result.returncode
|
||||
inner=dest/'state.receipt.json';receipt['inner_receipt']=digest(inner) if inner.exists() else None
|
||||
receipt['original_after']=inventory(WORK);receipt['snapshot_after']=inventory(dest)
|
||||
expected=dict(before);expected['state.arcadia']=before[entry.name]
|
||||
if result.returncode or not inner.exists():raise RuntimeError('Inner checker failed')
|
||||
r=read(inner)
|
||||
if r['failure'] or not r['full_project_exact'] or not r['inputs_unchanged']:raise RuntimeError('Inner comparison not accepted')
|
||||
if receipt['original_after']!=before or receipt['snapshot_after']!=expected:raise RuntimeError('Original or copied bundle changed')
|
||||
if digest(Path(__file__))!=receipt['wrapper'] or digest(HERE/'README.md')!=receipt['plan']:raise RuntimeError('Supplement changed')
|
||||
receipt['binding_after']=digest(prior) if prior.exists() else None
|
||||
if receipt['binding_before'] and receipt['binding_after']!=receipt['binding_before']:raise RuntimeError('Existing binding changed')
|
||||
receipt['accepted']=True
|
||||
except Exception as e:
|
||||
receipt['failure']=str(e)
|
||||
write(HERE/'UNACCEPTED.json',{'checkpoint':str(dest),'failure':str(e),'binding_unaccepted':True,'instruction':'Stop this trial; preserve binding and failures, never delete or relearn.'})
|
||||
finally:
|
||||
receipt['finished_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat()
|
||||
try: write(dest/'bundle-receipt.json',receipt)
|
||||
except Exception as e:
|
||||
if not (HERE/'UNACCEPTED.json').exists(): write(HERE/'UNACCEPTED.json',{'checkpoint':str(dest),'failure':'Outer receipt write failed: '+str(e),'binding_unaccepted':True})
|
||||
raise
|
||||
if not receipt['accepted']:raise SystemExit('Outer checkpoint failed; trial quarantined')
|
||||
print('Complete source bundle and unchanged full-Project oracle accepted: '+a.checkpoint)
|
||||
if __name__=='__main__': main()
|
||||
Reference in New Issue
Block a user