Audit APL PN scope and localize official synaptic contacts without changing frozen dynamics

This commit is contained in:
Digital Drosophila Archive
2026-09-29 23:58:05 +08:00
parent 3981628ff8
commit d6843e675d
62 changed files with 3974 additions and 0 deletions
@@ -0,0 +1,51 @@
"""Seal only this newly created audit and copy small evidence into Git registry."""
import json
from pathlib import Path
import shutil
import time
from audit import save,digest,seal,immutable_check
ROOT=Path('/data/digital-drosophila');MODEL=ROOT/'models/male-cns-lif/apl-pn-scope-audit-v1';EXP=ROOT/'experiments/phase4aa-apl-pn-scope'
def main():
assert not (EXP/'manifest.json').exists() and not (MODEL/'manifest.json').exists(),'Already sealed'
static=json.loads((EXP/'audit/results.json').read_text())
local=json.loads((EXP/'localization/summary.json').read_text())
pairs=json.loads((EXP/'localization/complete-pair-set-validation.json').read_text())
gpu=json.loads((EXP/'retry-with-correct-PATH/gpu-frozen-regression/summary.json').read_text())
external=json.loads((EXP/'external-resources/synaptic-partners/download-verification.json').read_text())
assert static['frozen_integrity_pass'] and local['pass'] and pairs['pass'] and gpu['pass'] and external['pass']
post=immutable_check(ROOT,ROOT/'registry/snapshots/bootstrap-20260929',4)
save(EXP/'regression/final-old-files-integrity.json',post);assert post['pass']
result={'phase':'4AA','status':'PASS-APL-PN-ANATOMICAL-LOCALIZATION / NO-DYNAMICS-CANDIDATE',
'candidate':False,'previous_static_spatial_block_resolved_by_user_authorized_reference_data':True,
'old_static_audit_retained_without_overwrite':True,'canonical_neurons':166700,'canonical_edges':25582938,
'APL_PN_edges':268,'APL_target_PNs':259,'APL_PN_contacts':4600,'calyx_contacts':3820,
'calyx_fraction':3820/4600,'ROI_unspecified_contacts':731,'other_ROI_contacts':49,
'watched_PN_contacts':247,'watched_calyx_contacts':228,'watched_unspecified_contacts':19,
'complete_pair_checks':pairs,'frozen_trials_pass':gpu['pass'],'frozen_trials_count':len(gpu['trials']),
'old_scientific_files_verified':post['checked'],'old_file_integrity_pass':post['pass'],
'external_MD5_pass':external['pass'],'external_SHA256':external['sha256'],
'brain_dynamics_changed':False,'training':False,'receptor_or_terminal_gain_calibrated':False,
'bouton_identity_confirmed':False,'ComfyUI_stopped_or_unloaded':False,'top_level_gate_fraction':'5/10',
'failures_preserved':['initial experiment-directory permission before any output','first GPU build lookup of Ninja failed before simulation','first aria2 checksum argument invalid before download'],
'finalized_utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime())}
save(EXP/'audit/final-summary.json',result)
with (MODEL/'REPORT.md').open('rb') as src,(EXP/'REPORT.md').open('xb') as dst:shutil.copyfileobj(src,dst)
model_count=seal(MODEL);experiment_count=seal(EXP)
verified=[]
for base in (MODEL,EXP):
manifest=json.loads((base/'manifest.json').read_text());bad=[r['path'] for r in manifest['files'] if digest(base/r['path'])!=r['sha256']]
assert not bad;verified.append({'path':str(base),'files':len(manifest['files']),'pass':not bad})
registry=ROOT/'registry/phase4aa-apl-pn-scope';registry.mkdir(exist_ok=False)
records=[]
for p in sorted(EXP.rglob('*')):
if not p.is_file() or p.suffix not in ('.json','.csv','.md','.sha256') or p.stat().st_size>2*1024**2:continue
dst=registry/'evidence'/p.relative_to(EXP);dst.parent.mkdir(parents=True,exist_ok=True)
with p.open('rb') as src,dst.open('xb') as out:shutil.copyfileobj(src,out)
records.append({'original_path':str(p.relative_to(ROOT)),'copy_path':str(dst.relative_to(registry)),'sha256':digest(p),'bytes':p.stat().st_size})
save(registry/'evidence-index.json',records);save(registry/'seal-verification.json',verified)
doc=ROOT/'docs/progress/phase4aa-apl-pn-scope.md';doc.parent.mkdir(parents=True,exist_ok=True)
with (MODEL/'REPORT.md').open('rb') as src,doc.open('xb') as dst:shutil.copyfileobj(src,dst)
print(json.dumps({'result':result['status'],'model_files':model_count,'experiment_files':experiment_count,'evidence_copies':len(records),'all_seals_pass':True}),flush=True)
if __name__=='__main__':main()