Seal the locked 120-pair sample and prepare bounded blind geometry export

This commit is contained in:
Frank14f committed 2026-11-14 19:29:47 +08:00
1 parent 24d2da0fe7
commit 6d61c08686
16 files changed
+483

No files matched your search

@@ -0,0 +1,31 @@
{
"scope": "120 locked same-key blind pairs: geometry-only extraction of 232 unique parts, original-unit surfaces and uniform views; no descriptors/registration/classification/training/GPU",
"parts": 232,
"selected_tets": 37464738,
"selected_max_tets": 922165,
"existing_cache_parts": 14,
"e1_baseline_charged_seconds": 1725.366982,
"baseline_note": "1695.366982 previous conservative charge +30 seconds current code/sampling/synthetic preparation reserve, not measurement",
"phase_cpu_seconds": 28800,
"phase_disk_bytes": 8589934592,
"e1_total_cpu_seconds": 57600,
"e1_total_disk_bytes": 26843545600,
"per_part_wall_seconds": 1800,
"per_part_tree_rss_bytes": 1342177280,
"sequential": true,
"retry": false,
"first_five_cost_checkpoint": true,
"preestimate": "232/624 parts, 37.1% tets; old geometry+distance historical scenario about 1.16 serial wall h /2.33 two-thread CPU-h. Renderer at real surface size not yet measured. First five cost checkpoint before extending; hard caps remain authoritative.",
"source_sha256": {
"tools/run_g1_blind_extraction.py": "b43bb9c44f8468ab84ec8abab2e8ba1a07ca5d5a42a32f15a40c7d7194a5833f",
"tools/extract_g1_blind_surface.py": "19db0d00e6c031d867e66d80b7aab281eac3864ec47640c4ca347895024f431a",
"tools/render_g1_blind_surface.py": "98a82a9ad8269ac44a51c6c8602db80528534c7fee8494626bf93c177ed17d81",
"tools/g1_blind_geometry.py": "9f8303264231fd16f011817998758bd9c9221e6488a4b87a16e8b5e719e0845c",
"tools/g1_registration_cost.py": "c3d722a8cfd067dfd726f8a8729e72c37dbc63e2c24ba1b0e3d767d47f7756ba",
"tools/s2_e1_supervisor.py": "6753c9ceb0b932047ba505bd15681f109e9407bdb58fd96c55e1431a3f1b4a02",
"tools/audit_samples.py": "a3daf70ec3bcb77bf46d9dc4887d552cf7c422117880a169969780012278cd70",
"tools/boundary_distance.py": "a45c1cbce92521a96eb814913b4f465b926c0b3883932ab0b7c37d11db113ed7"
},
"sealed_mapping_sha256": "3a9495efad4196763713c20f8b9158d86fce3fb60409242208b67bcb481e37f9",
"units": "VTU no explicit physical-unit tag; preserve coordinates and raw-unit axes, no assertion all are mm"
}
@@ -0,0 +1,78 @@
{
"status": "SAMPLED_AND_MAPPING_SEALED_NOT_EXTRACTED_OR_REVIEWED",
"sampling_ruling": "1794655144.867149",
"sampled_pairs": 120,
"sampled_source_keys": 96,
"unique_geometry_cases": 232,
"strata": [
{
"stratum": 0,
"key_size_min": 2,
"key_size_max": 2,
"keys": 35,
"frame_pairs": 35,
"quota": 30,
"sampled": 30,
"sampled_keys": 30,
"carry_to_next": 0,
"key_draw_count_histogram": {
"1": 30
}
},
{
"stratum": 1,
"key_size_min": 3,
"key_size_max": 5,
"keys": 51,
"frame_pairs": 218,
"quota": 45,
"sampled": 45,
"sampled_keys": 45,
"carry_to_next": 0,
"key_draw_count_histogram": {
"1": 45
}
},
{
"stratum": 2,
"key_size_min": 6,
"key_size_max": null,
"keys": 21,
"frame_pairs": 1695,
"quota": 45,
"sampled": 45,
"sampled_keys": 21,
"carry_to_next": 0,
"key_draw_count_histogram": {
"3": 3,
"2": 18
}
}
],
"selected_key_exposure_counts": {
"UNKNOWN_EXPOSURE_CLUSTER": 64,
"EXPOSED_CLUSTER": 32
},
"pair_exposure_counts": {
"UNKNOWN_EXPOSURE_CLUSTER": 71,
"EXPOSED_CLUSTER": 49
},
"claim": "same-key relationship pool only; not certified natural positives, not independent unexposed or unbiased cross-key validation",
"unblinding": "Mold labels frozen and committed before Grok verifies seals and identity join",
"post_review_split": "child1 reserved, not consumed; dominant-class key stratification, rigid<template<variant ties, alternating heldout/development starting heldout; each key at most once per class",
"sealed_files": [
{
"file": "geometry-source-index.json",
"bytes": 32467,
"sha256": "1647def37bd46e09479bf598ec8fcecb33a8bb4946a978aa3adbc718d582cb13"
},
{
"file": "sampling-and-mapping.json",
"bytes": 94908,
"sha256": "3a9495efad4196763713c20f8b9158d86fce3fb60409242208b67bcb481e37f9"
}
],
"code_sha256": "d7352416fa2da8a277e7569ffb1d0fe83a1e1528b0883d40f96b35d5ab8f99ac",
"no_geometry_read": true,
"no_candidates_or_registration": true
}
@@ -0,0 +1,11 @@
{
"pairs": 120,
"unique_source_keys": 96,
"unique_parts": 232,
"same_key_only": true,
"unique_unordered_pairs": true,
"stratum_quotas_pass": true,
"max_per_key_three_pass": true,
"no_confirmed_positive_or_split_assignment": true,
"geometry_not_yet_read": true
}
@@ -0,0 +1,58 @@
{
"scope": "counts from existing sealed inventory only, no sampling or inventory rerun",
"multi_part_keys": 107,
"parts_in_multi_part_keys": 482,
"unordered_same_key_pairs": 1948,
"key_size_histogram": {
"2": 35,
"3": 32,
"4": 17,
"5": 2,
"6": 4,
"7": 4,
"8": 2,
"9": 2,
"10": 1,
"11": 1,
"12": 1,
"13": 1,
"15": 1,
"19": 3,
"34": 1
},
"illustrative_bins_not_selected": [
{
"illustrative_size_range": [
2,
2
],
"keys": 35,
"parts": 70,
"unordered_pairs": 35,
"known_exposed_keys": 9,
"unknown_keys": 26
},
{
"illustrative_size_range": [
3,
5
],
"keys": 51,
"parts": 174,
"unordered_pairs": 218,
"known_exposed_keys": 13,
"unknown_keys": 38
},
{
"illustrative_size_range": [
6,
null
],
"keys": 21,
"parts": 238,
"unordered_pairs": 1695,
"known_exposed_keys": 14,
"unknown_keys": 7
}
]
}
@@ -0,0 +1,11 @@
{
"returncode": 0,
"wall_seconds": 0.20782222098205239,
"cpu_seconds": 0.204697,
"peak_rss_bytes": 35905536,
"scope": "synthetic triangles only; no real pair sampled or extracted",
"code_sha256": {
"tools/g1_blind_geometry.py": "9f8303264231fd16f011817998758bd9c9221e6488a4b87a16e8b5e719e0845c",
"tools/test_g1_blind_geometry.py": "a1532a70a247b20166f5622c8cfd34bed1a852442b6a083d252be603f358841a"
}
}
@@ -0,0 +1,12 @@
test_changed_payload_rejected (test_g1_blind_geometry.BlindGeometryTests) ... ok
test_extra_field_and_file_rejected (test_g1_blind_geometry.BlindGeometryTests) ... ok
test_geometry_only_and_original_scale (test_g1_blind_geometry.BlindGeometryTests) ... ok
test_invalid_right_side_leaves_no_partial_pair (test_g1_blind_geometry.BlindGeometryTests) ... ok
test_manifest_identity_property_rejected (test_g1_blind_geometry.BlindGeometryTests) ... ok
test_named_id_rejected (test_g1_blind_geometry.BlindGeometryTests) ... ok
test_no_overwrite (test_g1_blind_geometry.BlindGeometryTests) ... ok
----------------------------------------------------------------------
Ran 7 tests in 0.012s
OK
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

@@ -0,0 +1,6 @@
{
"scope": "synthetic tetrahedron only",
"wall_seconds": 1.0310552350129,
"cpu_seconds": 3.2376250000000004,
"peak_rss_bytes": 96862208
}
@@ -0,0 +1,30 @@
# 首批120对同来源键盲包:抽样与准备合同
Claude原串1794654785.492589指定同key盲审池,1794655144.867149锁定抽样。此任务为现有E1预算内几何材料准备,不生成正式候选、不运行配准、不训练或使用GPU。同key关系尚未确认,不能预写正例,更不能称跨key无偏留验。
抽样框来自已封存盘点,107个多件key、482件、1948个无序同key对。key大小2、3–5、≥6三层分别35/51/21个key和35/218/1695对,配额30/45/45。每层先将稳定排序的key置乱,固定该顺序轮转,每轮每key从剩余字典序无序对中均匀抽一对;每key最多3对、无放回。无缺额转移。
SeedSequence([2026111413]).spawn(2),child0使用PCG64抽120对,child1保留给审后分割未消费。抽到96个key、232件几何;各层30/45/21个key,第三层18key各2对、3key各3对。每对无条件边际入样概率为q/(层内key数×该key无序对数),不把实现后的key次数当边际概率。映射内保留概率、暴露标志和完整原件,另用封存随机秘密生成匿名ID及左右顺序,不让层序/件号成为盲ID。
96个选中key中32含已知开发暴露、64unknown;120对相应49/71。保留这些标记,报告称“同来源键关系池”。盲审后按完整key分开发/留验,主类按确认件对多数、平手rigid<template<variant;各主类由child1置乱并交替,奇数多出的key给留验。每key每类最多贡献一个确认正对,可计于多类。30/15/15不足照实标“预算不可验证”。目前没有盲审标签或任何开发/留验分配。
近层为两路min-rank的(k,3k],远层>10k,跨路重复对计一次;中段(3k,10k]不抽,不据两层无遗漏声称全库召回。以上只锁口径,当前不做检索或筛外抽样。
## 盲包内容与托管
MeltAstra托管身份、匿名映射、概率及种子;MoldAstra仅收匿名几何和空白判定表;盲审标签先冻结提交,再由Grok核实封存SHA256,按Claude顺序揭盲。旧盘点5份封存文件不修改;本轮新采样映射另行封存。
- sampling-and-mapping.json:3a9495efad4196763713c20f8b9158d86fce3fb60409242208b67bcb481e37f9
- geometry-source-index.json:1647def37bd46e09479bf598ec8fcecb33a8bb4946a978aa3adbc718d582cb13
只导出真实tet域的外表面坐标和三角面。已有缓存按允许数组读取;新件从VTU几何前缀读取,并在PointData/CellData前停止。审员文件不含来源key、身份、排名、残差、过程量或场标签。PLY保留完整原单位数值,不配准/缩放/简化;只移除不属于表面的内点。VTU无绝对单位标签,图轴标原坐标单位,不无条件写mm。
每件统一提供XY/XZ/YZ/斜视图和斜视固定四区局部图。图仅为有限像素投影,固定分区不等于已识别所有孔桥;完整PLY供进一步检查。无法辨认关系或局部结构时允许UNRESOLVED,不自动判无关。图像仅作视图中心平移,不改变PLY坐标或比例。
几何导出7项合成检查通过:拒绝身份字段/额外文件、保持原尺度、拒绝篡改、拒绝非匿名ID、输入失败不留部分pair、禁止覆盖。仅用合成三角形;统一渲染另用合成四面体检查,无真实对预审。
## 资源与实际状态
232件含37,464,738个tet,最大单件922,165;14件有可复用表面缓存。队列严格串行,阶段≤8 CPU-h/8 GiB,E1累计≤16 CPU-h/25 GiB;单件≤30分钟/1.25 GiB进程树RSS。worker与监督自CPU分别入账,失败保留、无替换或自动重试。先做前5件实测外推,预算情景超额即停;它不是代表性上界。完整源hash和合同在extraction-contract.json。
本稿为抽样及准备检查点:映射已封存,几何队列正在执行,120对盲包尚未交付。最终件数、失败、全包hash和实际资源以完成回执为准。
+34
View File
@@ -0,0 +1,34 @@
"""One supervised extraction/render task, addressed by sealed-list ordinal."""
from pathlib import Path
from zipfile import ZipFile
import hashlib,json,sys,time,resource
import numpy as np
from g1_registration_cost import geometry_only
from g1_blind_geometry import surface,ply_bytes
from render_g1_blind_surface import render_surface
ROOT=Path('artifacts/s2-g1-blind120-2026-11-14')
def main():
start=time.monotonic();index=int(sys.argv[1]);c=json.loads((ROOT/'extraction-contract.json').read_text())
for p,h in c['source_sha256'].items():
if hashlib.sha256(Path(p).read_bytes()).hexdigest()!=h:raise ValueError('Extraction code changed')
mapping=json.loads((ROOT/'custodian/sampling-and-mapping.json').read_text());case=mapping['unique_cases'][index]
asset=hashlib.sha256(bytes.fromhex(mapping['anonymous_id_secret_hex'])+b'asset\0'+case.encode()).hexdigest()[:32]
out=ROOT/'custodian/geometry'/asset;out.mkdir(parents=True,exist_ok=False)
st=Path('data.zip').stat();verification=json.loads(Path('artifacts/intake-2026-11-13/archive_verification.json').read_text())
if (st.st_size,st.st_mtime_ns,st.st_ino)!=(verification['bytes'],verification['mtime_ns'],verification['inode']):raise ValueError('Archive provenance changed')
entries=json.loads((ROOT/'custodian/geometry-source-index.json').read_text())['cases'];entry=next(e for e in entries if e['case']==case)
usable=[e for e in entry['existing_surface_caches'] if not e['contains_field_labels']]
if usable:
e=usable[0];p=Path(e['path']);stat=p.stat()
if (stat.st_size,stat.st_mtime_ns)!=(e['bytes'],e['mtime_ns']):raise ValueError('Cache changed since inventory')
with np.load(p,allow_pickle=False) as z:x=z[e['surface_coordinate_key']];f=z[e['surface_index_key']]
source_mode='existing geometry cache, coordinate and boundary arrays only'
else:
with ZipFile('data.zip') as z:
with z.open(case+'_sim.vtu') as stream:g=geometry_only(stream)
x=g['points'];f=g['boundary'];source_mode='geometry prefix only, stop before PointData/CellData'
x,f=surface(x,f);(out/'surface.ply').write_bytes(ply_bytes(x,f));render_surface(x,f,out)
receipt={'index':index,'asset_id':asset,'source_mode':source_mode,'vertices':len(x),'triangles':len(f),'files':[{'name':p.name,'bytes':p.stat().st_size,'sha256':hashlib.sha256(p.read_bytes()).hexdigest()} for p in sorted(out.iterdir())],'wall_seconds':time.monotonic()-start,'cpu_seconds':sum(resource.getrusage(resource.RUSAGE_SELF)[:2]),'peak_rss_bytes':resource.getrusage(resource.RUSAGE_SELF).ru_maxrss*1024,'registration':False,'labels_read':False,'geometry_modified':'interior unused vertices omitted; numerical coordinate values and boundary triangles preserved; view centering only in PNG'}
(out/'receipt.json').write_text(json.dumps(receipt,indent=2)+'\n');print(json.dumps({k:receipt[k] for k in ['index','vertices','triangles','wall_seconds','cpu_seconds','peak_rss_bytes']}))
if __name__=='__main__':main()
+55
View File
@@ -0,0 +1,55 @@
"""Geometry-only blind-pair exporter. No dataset access, sampling or source IDs."""
from pathlib import Path
import hashlib,json,re
import numpy as np
UNITS='Original numerical coordinate units; source VTU carries no physical-unit tag. No unit conversion, fitting, registration, scaling or simplification applied.\n'
def surface(points, triangles):
x=np.asarray(points);f=np.asarray(triangles)
if x.ndim!=2 or x.shape[1]!=3 or not len(x) or not np.issubdtype(x.dtype,np.number) or not np.isfinite(x).all():raise ValueError('Invalid coordinates')
if f.ndim!=2 or f.shape[1]!=3 or not len(f) or not np.issubdtype(f.dtype,np.integer):raise ValueError('Invalid triangles')
if f.min()<0 or f.max()>=len(x):raise ValueError('Triangle index outside coordinate table')
if np.any(np.diff(np.sort(f,axis=1),axis=1)==0):raise ValueError('Repeated vertex in triangle')
used=np.unique(f);return x[used].astype(np.float64),np.searchsorted(used,f)
def ply_bytes(x,f):
header=f'ply\nformat ascii 1.0\nelement vertex {len(x)}\nproperty double x\nproperty double y\nproperty double z\nelement face {len(f)}\nproperty list uchar int vertex_indices\nend_header\n'
vertices=''.join(' '.join(format(float(v),'.17g') for v in row)+'\n' for row in x)
faces=''.join('3 '+' '.join(str(int(v)) for v in row)+'\n' for row in f)
return (header+vertices+faces).encode('ascii')
def write_pair(parent, anonymous_id, left, right):
if not re.fullmatch(r'[0-9a-f]{32}',anonymous_id):raise ValueError('Anonymous ID must be opaque 128-bit hex')
if len(left)!=2 or len(right)!=2:raise ValueError('Only coordinates and triangles accepted')
a=surface(*left);b=surface(*right)
payload={'left.ply':ply_bytes(*a),'right.ply':ply_bytes(*b),'units.txt':UNITS.encode('ascii')}
root=Path(parent)/anonymous_id;root.mkdir(parents=True,exist_ok=False)
for name,data in payload.items():(root/name).write_bytes(data)
manifest={'format':'blind-surface-pair-v1','anonymous_pair_id':anonymous_id,
'files':[{'name':name,'bytes':len(data),'sha256':hashlib.sha256(data).hexdigest()} for name,data in sorted(payload.items())]}
(root/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
return root
def validate_pair(root):
root=Path(root);m=json.loads((root/'manifest.json').read_text())
if set(m)!={'format','anonymous_pair_id','files'} or m['format']!='blind-surface-pair-v1':raise ValueError('Unexpected manifest properties')
if not re.fullmatch(r'[0-9a-f]{32}',root.name) or m['anonymous_pair_id']!=root.name:raise ValueError('Identity mismatch')
if {p.name for p in root.iterdir()}!={'left.ply','right.ply','units.txt','manifest.json'}:raise ValueError('Unexpected blind file')
if len(m['files'])!=3 or {r['name'] for r in m['files']}!={'left.ply','right.ply','units.txt'}:raise ValueError('Unexpected payload')
for r in m['files']:
if set(r)!={'name','bytes','sha256'}:raise ValueError('Unexpected payload properties')
data=(root/r['name']).read_bytes()
if len(data)!=r['bytes'] or hashlib.sha256(data).hexdigest()!=r['sha256']:raise ValueError('Payload changed')
if (root/'units.txt').read_text()!=UNITS:raise ValueError('Unexpected units content')
for name in ['left.ply','right.ply']:
lines=(root/name).read_text('ascii').splitlines()
if len(lines)<9:raise ValueError('Truncated PLY')
n=int(lines[2].split()[-1]);nf=int(lines[6].split()[-1])
expected=['ply','format ascii 1.0',f'element vertex {n}','property double x','property double y','property double z',f'element face {nf}','property list uchar int vertex_indices','end_header']
if lines[:9]!=expected or len(lines)!=9+n+nf:raise ValueError('Unexpected PLY fields')
x=np.array([[float(v) for v in row.split()] for row in lines[9:9+n]])
faces=[row.split() for row in lines[9+n:]]
if any(len(row)!=4 or row[0]!='3' for row in faces):raise ValueError('Nontriangle face')
f=np.array([[int(v) for v in row[1:]] for row in faces]);surface(x,f)
return {'status':'GEOMETRY_ONLY_SCHEMA_AND_HASH_PASS','anonymous_pair_id':root.name}
+48
View File
@@ -0,0 +1,48 @@
"""Locked same-key sampling only; identities stay in local custodian directory."""
from pathlib import Path
from itertools import combinations
from collections import Counter
import hashlib,json,os,secrets
import numpy as np
ROOT=Path('artifacts/s2-g1-blind120-2026-11-14')
def save(path,x):path.write_text(json.dumps(x,indent=2,ensure_ascii=False)+'\n')
def main():
ROOT.mkdir(exist_ok=False);sealed=ROOT/'custodian';sealed.mkdir(mode=0o700);public=ROOT/'public';public.mkdir()
old=Path('artifacts/s2-g1-inventory-2026-11-14/custodian')
clusters=json.loads((old/'source_clusters.json').read_text());parts={r['case']:r for r in json.loads((old/'parts.json').read_text())}
rng=np.random.Generator(np.random.PCG64(np.random.SeedSequence([2026111413]).spawn(2)[0]))
selected=[];strata=[];carry=0
for si,(lo,hi,quota) in enumerate([(2,2,30),(3,5,45),(6,10**9,45)]):
groups=sorted((g for g in clusters if lo<=len(g['members'])<=hi),key=lambda g:g['source_key'])
order=rng.permutation(len(groups)).tolist();pools={g['source_key']:list(combinations(sorted(g['members']),2)) for g in groups}
frame_pairs=sum(len(v) for v in pools.values());counts=Counter();rows=[];target=quota+carry
while len(rows)<target:
progress=False
for gi in order:
if len(rows)==target:break
g=groups[gi];key=g['source_key']
if counts[key]>=3 or not pools[key]:continue
pair=pools[key].pop(int(rng.integers(len(pools[key]))));counts[key]+=1;progress=True
rows.append({'a':pair[0],'b':pair[1],'source_key':key,'stratum':si,'frame_pairs_within_key':len(g['members'])*(len(g['members'])-1)//2,'source_cluster_state':g['state'], 'endpoint_exposure':[parts[c]['exposure_state'] for c in pair]})
if not progress:break
carry=target-len(rows)
# Current locked frame has no key shortage inside any round; exact
# marginal pair inclusion = expected key draws / key pair count.
assert not carry and all(len(g['members'])*(len(g['members'])-1)//2>=min(3,(target+len(groups)-1)//len(groups)) for g in groups)
for row in rows:row['marginal_inclusion_probability']=len(rows)/len(groups)/row['frame_pairs_within_key']
selected.extend(rows);strata.append({'stratum':si,'key_size_min':lo,'key_size_max':None if hi==10**9 else hi,'keys':len(groups),'frame_pairs':frame_pairs,'quota':quota,'sampled':len(rows),'sampled_keys':len(counts),'carry_to_next':carry,'key_draw_count_histogram':dict(Counter(counts.values()))})
assert len(selected)==120 and len({(r['a'],r['b']) for r in selected})==120
secret=secrets.token_bytes(32)
for r in selected:
digest=hashlib.sha256(secret+b'pair\0'+r['a'].encode()+b'\0'+r['b'].encode()).hexdigest();r['anonymous_pair_id']=digest[:32]
swap=int(digest[32],16)%2;r['left'],r['right']=(r['b'],r['a']) if swap else (r['a'],r['b'])
r['confirmed_relation']=None;r['development_heldout_assignment']=None
selected.sort(key=lambda r:r['anonymous_pair_id']);unique=sorted({r[k] for r in selected for k in ['a','b']})
save(sealed/'sampling-and-mapping.json',{'seed_sequence':[2026111413],'sampling_spawn_key':[0],'split_spawn_key_reserved':[1],'bit_generator':'PCG64','anonymous_id_secret_hex':secret.hex(),'pairs':selected,'unique_cases':unique,'source_inventory_manifest_sha256':hashlib.sha256((old/'manifest.json').read_bytes()).hexdigest(),'ordering':'keys sorted, pairs lexicographic, one permuted key order per stratum reused each round, rng.integers selects uniformly from remaining sorted pairs','probability':'unconditional marginal within fixed stratum; q/(number_of_keys * pairs_within_key); not realized key count / pairs_within_key'})
save(sealed/'geometry-source-index.json',{'cases':[{'case':c,'existing_surface_caches':parts[c]['surface_caches']} for c in unique]})
for p in sealed.iterdir():p.chmod(0o600)
sealed_manifest=[{'file':p.name,'bytes':p.stat().st_size,'sha256':hashlib.sha256(p.read_bytes()).hexdigest()} for p in sorted(sealed.iterdir())]
summary={'status':'SAMPLED_AND_MAPPING_SEALED_NOT_EXTRACTED_OR_REVIEWED','sampling_ruling':'1794655144.867149','sampled_pairs':120,'sampled_source_keys':len({r['source_key'] for r in selected}),'unique_geometry_cases':len(unique),'strata':strata,'selected_key_exposure_counts':dict(Counter({r['source_key']:r['source_cluster_state'] for r in selected}.values())),'pair_exposure_counts':dict(Counter(r['source_cluster_state'] for r in selected)),'claim':'same-key relationship pool only; not certified natural positives, not independent unexposed or unbiased cross-key validation','unblinding':'Mold labels frozen and committed before Grok verifies seals and identity join','post_review_split':'child1 reserved, not consumed; dominant-class key stratification, rigid<template<variant ties, alternating heldout/development starting heldout; each key at most once per class','sealed_files':sealed_manifest,'code_sha256':hashlib.sha256(Path(__file__).read_bytes()).hexdigest(),'no_geometry_read':True,'no_candidates_or_registration':True}
save(public/'sample-summary-and-seals.json',summary);print(json.dumps(summary,indent=2))
if __name__=='__main__':main()
+39
View File
@@ -0,0 +1,39 @@
"""Uniform CPU-only geometry views; no identity, label or registration inputs."""
import gc
from pathlib import Path
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from PIL import Image
def render_surface(x, f, output):
output=Path(output);tri=x[f];center=(x.min(0)+x.max(0))/2;tri=tri-center
normal=np.cross(tri[:,1]-tri[:,0],tri[:,2]-tri[:,0]);length=np.linalg.norm(normal,axis=1)
if np.any(length<=0):raise ValueError('Degenerate triangle in rendered surface')
normal/=length[:,None]
iso=np.array([[1/np.sqrt(2),-1/np.sqrt(2),0],[1/np.sqrt(6),1/np.sqrt(6),-2/np.sqrt(6)],[1/np.sqrt(3)]*3])
matrices=[np.eye(3),np.eye(3)[[0,2,1]],np.eye(3)[[1,2,0]],iso]
titles=['XY view','XZ view','YZ view','Oblique view']
def panel(matrix,title,crop=None):
p=tri@matrix.T;order=np.argsort(p[:,:,2].mean(1),kind='stable');xy=p[order,:,:2]
shade=.3+.65*np.abs((normal@matrix[2])[order]);colors=np.column_stack([.18*shade,.62*shade,.85*shade,np.ones(len(shade))])
fig,ax=plt.subplots(figsize=(6.4,6.4),dpi=110)
ax.add_collection(PolyCollection(xy,facecolors=colors,edgecolors='none',rasterized=True))
low=p[:,:,:2].min(axis=(0,1));high=p[:,:,:2].max(axis=(0,1));span=np.maximum(high-low,1e-12)
if crop is None:lo=low-.04*span;hi=high+.04*span
else:
ix,iy=crop;mid=(low+high)/2;lo=np.array([low[0] if ix==0 else mid[0],low[1] if iy==0 else mid[1]]);hi=np.array([mid[0] if ix==0 else high[0],mid[1] if iy==0 else high[1]])
ax.set_xlim(lo[0],hi[0]);ax.set_ylim(lo[1],hi[1]);ax.set_aspect('equal');ax.set_title(title)
ax.set_xlabel('Original coordinate units, centered for view');ax.set_ylabel('Original coordinate units')
fig.tight_layout();fig.canvas.draw();im=Image.fromarray(np.asarray(fig.canvas.buffer_rgba()).copy()).convert('RGB');plt.close(fig);gc.collect();return im
whole=Image.new('RGB',(1408,1408),'white')
for i,(mat,title) in enumerate(zip(matrices,titles)):
im=panel(mat,title);whole.paste(im,(704*(i%2),704*(i//2)))
whole.save(output/'overview.png')
details=Image.new('RGB',(1408,1408),'white')
for i,crop in enumerate([(0,0),(1,0),(0,1),(1,1)]):
im=panel(iso,f'Oblique quadrant {i+1}; fixed grid, not feature selection',crop);details.paste(im,(704*(i%2),704*(i//2)))
details.save(output/'detail-grid.png')
+34
View File
@@ -0,0 +1,34 @@
"""One sequential, bounded E1 geometry-only queue; never registers pairs."""
from pathlib import Path
import fcntl,json,resource,sys,os
from s2_e1_supervisor import supervise,save
ROOT=Path('artifacts/s2-g1-blind120-2026-11-14')
def main():
os.environ['MPLCONFIGDIR']=str((ROOT/'matplotlib-cache').resolve())
private=ROOT/'custodian';c=json.loads((ROOT/'extraction-contract.json').read_text())
with (private/'batch.lock').open('a') as lock:
fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
if (private/'batch-started.json').exists():raise FileExistsError('No silent rerun')
save(private/'batch-started.json',{'parts':c['parts'],'scope':'geometry extraction and uniform views only'})
baseline=c['e1_baseline_charged_seconds'];save(ROOT/'ledger.json',{'cpu_seconds_charged':baseline,'attempts':[{'name':'previous_e1_plus_current_code_reserve','cpu_seconds':baseline,'status':'BASELINE_AND_RESERVE'}]})
receipts=[];last=sum(resource.getrusage(resource.RUSAGE_SELF)[:2])
for index in range(c['parts']):
ledger=json.loads((ROOT/'ledger.json').read_text());phase=ledger['cpu_seconds_charged']-baseline
left=min(c['phase_cpu_seconds']-phase,57600-ledger['cpu_seconds_charged'])
if left<=0:save(private/'batch-stopped.json',{'reason':'CPU budget before launch','completed':len(receipts)});return
limits=dict(total_cpu_seconds=57600,job_cpu_seconds=min(1800,left),job_wall_seconds=1800,tree_rss_bytes=1342177280,disk_bytes=8*1024**3,max_processes=8)
r=supervise([sys.executable,'tools/extract_g1_blind_surface.py',str(index)],ROOT,f'blind-geometry-{index:03}',limits)
now=sum(resource.getrusage(resource.RUSAGE_SELF)[:2]);overhead=now-last;last=now
ledger=json.loads((ROOT/'ledger.json').read_text());ledger['cpu_seconds_charged']+=overhead;ledger['attempts'].append({'name':f'supervisor-self-{index:03}','cpu_seconds':overhead,'status':'MEASURED_SELF_CPU'});save(ROOT/'ledger.json',ledger)
if ledger['cpu_seconds_charged']>=57600 or ledger['cpu_seconds_charged']-baseline>=c['phase_cpu_seconds']:
save(private/'batch-stopped.json',{'reason':'worker plus supervisor budget exhausted','index':index,'e1_total_charged_seconds':ledger['cpu_seconds_charged']});return
receipts.append(r);print(json.dumps({'index':index,'status':r['status'],'worker_cpu_seconds':r['cpu_seconds'],'supervisor_cpu_seconds':overhead,'peak_rss_bytes':r['peak_tree_rss_bytes']}),flush=True)
if r['status']!='PASS':save(private/'batch-stopped.json',{'reason':'first failed extraction, no replacement or automatic retry','index':index});return
if index==4:
measured=ledger['cpu_seconds_charged']-baseline
scenario=max(x['cpu_seconds'] for x in receipts)*c['parts']+(measured-sum(x['cpu_seconds'] for x in receipts))*c['parts']/5
save(private/'first-five-cost-checkpoint.json',{'parts':5,'charged_cpu_seconds':measured,'full_queue_max_sample_scenario_seconds':scenario,'qualification':'geometry/render preparation only; first sorted five not representative or upper bound'})
if scenario>min(c['phase_cpu_seconds'],57600-baseline):
save(private/'batch-stopped.json',{'reason':'first five preparation cost extrapolation exceeds available budget','scenario_seconds':scenario});return
save(private/'batch-complete.json',{'parts':len(receipts),'worker_cpu_seconds':sum(r['cpu_seconds'] for r in receipts),'e1_total_charged_seconds':ledger['cpu_seconds_charged'],'all_pass':True})
if __name__=='__main__':main()
+36
View File
@@ -0,0 +1,36 @@
import json,tempfile,unittest
from pathlib import Path
import numpy as np
from g1_blind_geometry import write_pair,validate_pair
class BlindGeometryTests(unittest.TestCase):
def setUp(self):
self.temp=tempfile.TemporaryDirectory();self.root=Path(self.temp.name)
self.x=np.array([[4.,3.,2.],[5.,3.,2.],[4.,4.,2.],[999.,999.,999.]])
self.f=np.array([[0,1,2]]);self.id='a'*32
def tearDown(self):self.temp.cleanup()
def export(self):return write_pair(self.root,self.id,(self.x,self.f),(self.x*2,self.f))
def test_geometry_only_and_original_scale(self):
p=self.export();self.assertEqual(validate_pair(p)['status'],'GEOMETRY_ONLY_SCHEMA_AND_HASH_PASS')
a=(p/'left.ply').read_text();b=(p/'right.ply').read_text()
self.assertIn('4 3 2\n',a);self.assertIn('8 6 4\n',b);self.assertNotIn('999',a)
def test_named_id_rejected(self):
with self.assertRaises(ValueError):write_pair(self.root,'source-key',(self.x,self.f),(self.x,self.f))
def test_extra_field_and_file_rejected(self):
p=self.export();(p/'labels.json').write_text('{}')
with self.assertRaises(ValueError):validate_pair(p)
def test_manifest_identity_property_rejected(self):
p=self.export();m=json.loads((p/'manifest.json').read_text());m['source_key']='hidden';(p/'manifest.json').write_text(json.dumps(m))
with self.assertRaises(ValueError):validate_pair(p)
def test_changed_payload_rejected(self):
p=self.export();(p/'left.ply').write_text((p/'left.ply').read_text()+'0\n')
with self.assertRaises(ValueError):validate_pair(p)
def test_invalid_right_side_leaves_no_partial_pair(self):
bad=self.x.copy();bad[0,0]=np.nan
with self.assertRaises(ValueError):write_pair(self.root,self.id,(self.x,self.f),(bad,self.f))
self.assertFalse((self.root/self.id).exists())
def test_no_overwrite(self):
self.export()
with self.assertRaises(FileExistsError):self.export()
if __name__=='__main__':unittest.main()