Count 2012 frozen candidates and start bounded registration with first-100 checkpoint

This commit is contained in:
Frank14f committed 2026-11-14 22:07:12 +08:00
1 parent ff439e81fc
commit d4e26d48d0
17 files changed
+16816 -3

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,93 @@
{
"status": "CANDIDATES_COUNTED_NOT_REGISTERED",
"parts": 624,
"source_keys": 249,
"k_per_route": 3,
"route_unordered_counts": {
"physical": 1336,
"scale_free": 1331
},
"exact_cross_key_pairs": 0,
"historical_cross_key_pairs": 30,
"historical_same_key_excluded": 0,
"union_pairs": 2012,
"above_4000_report_before_registration": false,
"candidate_sha256": "37a38f4ea332d7103a51945cc65fe5594b663a24d5277448ab7452230a3a835f",
"calibration_thresholds_sha256": "93376174ddb8287eee26b86763c0269a5cd887433fbd2841b679b4041f61c862",
"scalers": {
"physical": {
"median": [
2.6173151829640786,
-0.3045558594067112,
0.029904383363320203,
0.2437022003100236,
0.4876716117358333,
1.029985697797736,
1.4512308147113075,
3.351961566706037
],
"iqr": [
0.49580997254802783,
1.888952835752156,
0.06046925086994756,
0.32119225683644126,
0.24126089029510706,
0.1339849269342297,
0.1945938086773511,
0.975402021880055
],
"kept_columns": [
0,
1,
2,
3,
4,
5,
6,
7
],
"zero_iqr_columns": [],
"development_source_keys": 22,
"weighting": "within-source-key median over calibration parts, then source-key-equal median/IQR"
},
"scale_free": {
"median": [
2.6173151829640786,
-0.3045558594067112,
0.029904383363320203,
0.2437022003100236,
0.4876716117358333,
1.029985697797736,
1.4512308147113075
],
"iqr": [
0.49580997254802783,
1.888952835752156,
0.06046925086994756,
0.32119225683644126,
0.24126089029510706,
0.1339849269342297,
0.1945938086773511
],
"kept_columns": [
0,
1,
2,
3,
4,
5,
6
],
"zero_iqr_columns": [],
"development_source_keys": 22,
"weighting": "within-source-key median over calibration parts, then source-key-equal median/IQR"
}
},
"max_min_rank": 79,
"all_relations_unreviewed": true,
"worker_cpu_seconds_fingerprints": 1322.3833589999995,
"count_cpu_seconds": 0.8972439999999999,
"count_wall_seconds": 0.563320167013444,
"cross_key_recall_certified": false,
"registration_started": false
}
@@ -0,0 +1,15 @@
{
"ruling": "1794664685.158429",
"status": "CLOSED_BY_CLAUDE_NO_FIX_REQUIRED",
"calibration_ids": [
"calib-001",
"calib-016",
"calib-031",
"calib-037",
"calib-052"
],
"assigned_operational_label": "branch-ambiguous (near-symmetric)",
"rule": "Name better branch only if its residual < route tau and other branch residual >2 times larger; otherwise ambiguous",
"no_rerun_or_threshold_change": true,
"grouping_unaffected": true
}
@@ -0,0 +1,8 @@
{
"pid": 2,
"started_unix": 1794665098.3784895,
"jobs": 2012,
"pairs": 2012,
"workers": 16,
"contract_sha256": "c4271622e1775d430324dd8e8ad4524006184122079d2fc3bbb8fd0ba6a349d8"
}
@@ -0,0 +1,51 @@
{
"authorizing_rulings": [
"1794661944.308269",
"1794662380.787319",
"1794664166.242149",
"1794664685.158429",
"1794664857.650469"
],
"count_report_before_registration": "1794664837.008399",
"pairs": 2012,
"thresholds": {
"physical": 0.015960230614351954,
"scale_free": 0.015960230614352394
},
"code_sha256": {
"tools/prepare_g1_candidate_registration.py": "cd50a0c5072415f39e620ec4fada5a7f2984536de0df3652a847638413986743",
"tools/g1_register_candidates.py": "9b4ab4dc771c289856d1723d374aa2c3a9160a6843e2b4d4a7cbe8b59ecfc630",
"tools/run_g1_registered_candidates.py": "b82bbba72f8747657dc959733517bb460ea10a058ab4da994935f34e95b3f0a4",
"tools/g1_registration_cost.py": "c3d722a8cfd067dfd726f8a8729e72c37dbc63e2c24ba1b0e3d767d47f7756ba",
"tools/g1_candidate_fingerprints.py": "2d027bd95f8da2cbfc0381d051f6a37949a5abe6b27e6b37d747d43c5b6612a0",
"tools/s2_e1_supervisor.py": "6753c9ceb0b932047ba505bd15681f109e9407bdb58fd96c55e1431a3f1b4a02",
"tools/audit_samples.py": "a3daf70ec3bcb77bf46d9dc4887d552cf7c422117880a169969780012278cd70",
"tools/boundary_distance.py": "a45c1cbce92521a96eb814913b4f465b926c0b3883932ab0b7c37d11db113ed7",
"tools/g1_registration_checkpoint.py": "e37c8858c3782fd656a893971e76948beb2b745be30e064b9fef3485362013ab"
},
"input_sha256": {
"artifacts/s2-g1-registration-2026-11-14/custodian/plan.json": "61f4695b7fdf16d747bdebafc1d0c6d362087e250e9d85a36ccce3b3caa71af6",
"artifacts/s2-g1-candidates-2026-11-14/public/candidate-count.json": "9d083b21cf3267bdf4c4089e1f54a5fa83bb744d2cae1e6b6936f6dbe5b2e49a",
"artifacts/s2-g1-candidates-2026-11-14/custodian/candidate-pairs.json": "37a38f4ea332d7103a51945cc65fe5594b663a24d5277448ab7452230a3a835f",
"artifacts/s2-g1-copy-calibration-2026-11-14/public/calibration-thresholds.json": "93376174ddb8287eee26b86763c0269a5cd887433fbd2841b679b4041f61c862"
},
"workers": 16,
"per_pair_wall_seconds": 1800,
"per_worker_rss_bytes": 1342177280,
"aggregate_rss_bytes": 21474836480,
"worker_cpu_budget_seconds": 360000,
"wall_seconds": 28800,
"disk_bytes": 21474836480,
"protocol": "Unchanged g1_registration_cost.register; both det branches, both routes, fixed 2000 area PPS, full triangle two-way P95",
"engineering_rule": "physical raw/mean Rg with ratio<=1.05, scale_free unchanged; best eligible route/threshold <=1 link; (1,2] band review; >2 outside rule, not certified unrelated",
"failure_policy": "retain failed attempts; check >2% at every 100 terminal jobs and final partial batch; no retries/replacements",
"budget_accounting": "worker and supervision recorded separately; aggregate stop conservatively also includes supervision",
"simulation_fields_training_gpu": false,
"components_frozen": false,
"pending_before_component_freeze": [
"anonymous threshold-band review; unresolved merges per ruling"
],
"first_100_checkpoint": "Launch only first 100 fixed-rank pairs until all terminal; report measured mean CPU, >=14-start share, load/cache sensitivity; stop if projection>100 CPU-h or >=14-start share>85%",
"branch_label": "Name better det branch only below own tau and when other branch >2x; otherwise branch-ambiguous (near-symmetric)",
"calibration_mirror_flags_closed_by": "1794664685.158429"
}
@@ -0,0 +1,53 @@
(5 total) ===
--- Reply 1 of 5 ---
From: ClaudeWorker (local) <botuser-T0C8JMA61UY-B0C7YUHNDFC@slack-bots.com> (U0C7SSQLBJ7)
Time: 2026-11-14 21:57:38 CST
Message TS: 1794664658.509629
Accepted; working on: “@⁠TRON 完整校准成果与候选准备已固定 <https://gitea.frank14f.online/Frank14f/MeltMind/>…”
--- Reply 2 of 5 ---
From: ClaudeWorker (local) <botuser-T0C8JMA61UY-B0C7YUHNDFC@slack-bots.com> (U0C7SSQLBJ7)
Time: 2026-11-14 21:58:05 CST
Message TS: 1794664685.158429
*Claude: the 4 remaining mirror cases are closed. They are benign and no fix is needed.*
In all 5 cases both branches have residuals of about 0.0008–0.0024. That is roughly 7–20× below τ = 0.016 and at the level of the 2,000-point sampling noise; the two natural rigid pairs are similar at 0.0013–0.0014. These parts are close enough to mirror-symmetric that a proper rotation fits about as well as the reflection. That is a property of the shapes, not a sign the branch assignment is broken.
*Effect:*
• *Grouping is unaffected.* Either branch is below τ, so the pair links either way.
• *Labelling rule, so the "rigid vs mirror" relation class isn't over-claimed:* the better branch is named only if both
• its residual is < τ, *and*
• the other branch's residual is more than 2× larger.
Otherwise the class is recorded as *"branch-ambiguous (near-symmetric)"*. On that rule, all 5 calibration cases (ratios 1.05–1.87) are branch-ambiguous.
The candidate-fingerprint queue continues as described: 8 CPU-h of preparation budget, kept separate from the 100 CPU-h registration budget. Next up is the deduplicated count.
--- Reply 3 of 5 ---
From: Frank14f <frank14wyq@gmail.com> (U0C7U0YA91S)
Time: 2026-11-14 22:00:37 CST
Message TS: 1794664837.008399
<@U0C7SSQLBJ7|ClaudeWorker (local)> <@U0C7U1KJVPE|frank14wyq-tron> 正式配准前计数:624/624件note16指纹全部PASS,0失败。物理路k=3得到1336个无序跨键对,scale-free路1331对;双路/双向及历史30对合并后共 _2012 对_,精确跨键表面匹配0对。来源键249;24件校准开发件归22键等权定标,未有零IQR列。候选全为UNREVIEWED,未下几何关系结论;旧候选可在k外保留,最终min-rank最大79。
候选表SHA `37a38f4ea332d7103a51945cc65fe5594b663a24d5277448ab7452230a3a835f`,阈值文件SHA `93376174ddb8287eee26b86763c0269a5cd887433fbd2841b679b4041f61c862`。指纹worker CPU1322.38秒,监督/协调276.30秒,墙钟282.03秒,峰值聚合RSS约1.69GiB。
2012低于已放行4000,不缩k、不新增审批。计数回执正在固定;接下来沿冻结min-rank顺序和原det协议,按≤100 worker CPU-h、≤16workers、单对30分钟/1.25GiB、失败率检查启动配准。4个镜像分支定点项仍保留到组件冻结前,计数没有因此停住。
*发送工具* <@U0C7NBV22BG|ChatGPT>
--- Reply 4 of 5 ---
From: ClaudeWorker (local) <botuser-T0C8JMA61UY-B0C7YUHNDFC@slack-bots.com> (U0C7SSQLBJ7)
Time: 2026-11-14 22:00:38 CST
Message TS: 1794664838.633919
Accepted; working on: “@⁠TRON 正式配准前计数:624/624件note16指纹全部PASS,0失败。物理路k=3得到1336个无序跨键对,scale-fre…”
--- Reply 5 of 5 ---
From: ClaudeWorker (local) <botuser-T0C8JMA61UY-B0C7YUHNDFC@slack-bots.com> (U0C7SSQLBJ7)
Time: 2026-11-14 22:00:57 CST
Message TS: 1794664857.650469
*Claude: count accepted. Registration go, with two reminders.*
• *2,012 pairs* (deduplicated physical ∪ scale-free ∪ old 30) is under the 4,000 limit. Registration runs with the frozen min-rank order and the det protocol.
• *Checkpoint after the first 100 pairs:* project the total worker CPU from the measured per-pair mean, the share of 14-start pairs and cold-cache effects. Stop and report if the projection is above 100 CPU-h, or if more than 85 % of pairs need 14 starts. Failure rate is checked every 100 pairs (strictly > 2 % stops).
• *The 4 mirror items are already closed* (my reply just before this one): they are classed "branch-ambiguous (near-symmetric)", grouping is unaffected, and nothing is pending before the components are frozen. Please apply the same labelling rule to the new candidate pairs.
After registration: link at or below τ in either route or branch; band-review the pairs between τ and 2τ (UNRESOLVED counts as a merge); then freeze the components.
@@ -0,0 +1,17 @@
{
"status": "REGISTRATION_QUEUE_FROZEN_NOT_STARTED",
"pairs": 2012,
"unique_parts": 624,
"contract_sha256": "c4271622e1775d430324dd8e8ad4524006184122079d2fc3bbb8fd0ba6a349d8",
"plan_sha256": "61f4695b7fdf16d747bdebafc1d0c6d362087e250e9d85a36ccce3b3caa71af6",
"candidate_sha256": "37a38f4ea332d7103a51945cc65fe5594b663a24d5277448ab7452230a3a835f",
"thresholds_sha256": "93376174ddb8287eee26b86763c0269a5cd887433fbd2841b679b4041f61c862",
"workers": 16,
"worker_cpu_hours": 100,
"per_pair_minutes": 30,
"count_previously_reported": true,
"no_new_geometry_extraction": true,
"no_new_approval_gate": true,
"first_100_checkpoint": true,
"latest_ruling": "1794664857.650469"
}
@@ -0,0 +1,7 @@
{
"passed": 5,
"failed": 0,
"reported_test_seconds": 0.003,
"source": "tools/test_g1_registration_rule.py",
"scope": "physical units/size gate; band endpoints; branch labels; first100 cost and start-share boundaries"
}
@@ -0,0 +1,29 @@
{
"completed_jobs": 15,
"active_jobs": [
4,
6,
14,
17,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30
],
"next_job": 31,
"completed_worker_cpu_seconds": 1202.0805939999998,
"live_tree_cpu_seconds": 914.1700000000002,
"active_tree_rss_bytes": 2396762112,
"stop_reason": null,
"elapsed_seconds": 133.16809671500232,
"snapshot_only": true,
"snapshot_utc": "2026-11-14T14:07:12.015914+00:00"
}
+9 -1
View File
@@ -1,5 +1,13 @@
# G1 双路 k=3 候选:缺失指纹与计数合同
## 完成回执
624/624 件指纹全部完成、0失败。物理路1336对、尺度无关路1331对,两路并集2010对;历史30对中28对已在并集中、2对额外加入,最终 **2012 个跨键无序候选**。精确跨键表面网格匹配0对,来源键共249个,24件开发几何对应22键,所有特征IQR非零。最终最大min-rank为79,来自保留的历史候选;没有因k=3丢掉这些补充召回。所有候选关系仍为UNREVIEWED,不把计数当作边真值。
候选表SHA256 `37a38f4ea332d7103a51945cc65fe5594b663a24d5277448ab7452230a3a835f`,公开完整计数/缩放参数见 `public/candidate-count.json`。worker CPU1322.383359秒,监督/协调276.297624秒,墙钟282.03秒,峰值聚合RSS约1.69GiB,产物429,064,192字节。计数额外约0.90 CPU秒。
已在 [22:00:37 原串](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794664837008399) 报数;Claude 随后接受并放行固定队列,新增首100对外推检查点。2012对低于4000上限,无需降k或增加用户审批。当前衔接 [正式配准合同与启动记录](s2-g1-registration-2026-11-14.md)。以下保留事前合同。
校准结束且 Claude 于 Slack `1794664166.242149` 接受阈值后,按 Mold note16 的既有向量补齐 624 件指纹。24 件复用已有无标签四面体缓存;600 件的旧表面/点云缓存缺失准确体积二阶矩,因此仅读 VTU 几何前缀补齐。没有重做校准、盲审或见证。
形状向量为 log(A/Rg²)、log(V/Rg³)、体积中心协方差有序特征值除以迹的前两项、面积 PPS 半径/Rg 的 P10/P50/P90。物理路追加 log(Rg/原数值长度单位)。V、中心、协方差按线性四面体解析积分,面积按真实 tet 外表面三角形精确求和。为与固定配准一致,Rg 仍采用 tet 体积/4 的节点二阶矩求积;不悄悄替换为精确协方差迹的平方根。径向分位数使用原 2000 面积 PPS 和数字前缀随机流,取 inverted_cdf 分位数。
@@ -14,4 +22,4 @@
合同 SHA256 `471dbd2f40992bc9d861f5bd7d371ee5a74d65ccf4923720e258372ec7d07c1c`,计划 SHA256 `56ce9d88b14092d7cf782bb4b86328a9fae1ebbf1783457223bbe42007ddb605`,固定阈值文件 SHA256 `93376174ddb8287eee26b86763c0269a5cd887433fbd2841b679b4041f61c862`。启动前曾把100小时错放入准备合同,已在任何作业启动前更正为8小时;原未执行合同保留在 `superseded-before-start/`,实际运行以当前合同摘要为准。
根目录 `artifacts/s2-g1-candidates-2026-11-14/`,实时进度见 `progress.json`,既有队列不得重复启动。`batch-complete.json` 出现且全部成功后运行 `tools/count_g1_candidates.py`,生成私有完整候选表和公开 `public/candidate-count.json`。当前文档不宣称指纹已齐、计数已出或配准已启动;完成时另加回执。
根目录 `artifacts/s2-g1-candidates-2026-11-14/`,既有队列已经结束,不得重复启动。`batch-complete.json` 和 `public/candidate-count.json` 为完整完成证据,私有完整候选表供执行使用。
+2 -2
View File
@@ -11,7 +11,7 @@
两对自然视觉 rigid 的物理归一残差为 0.001441865、0.001336756,Rg 比为 1.000043332、1.000009353。它们仍不是自然跨键召回证书。
5 个镜像复制在两路均为 det+ 更优,下表列物理路归一残差;尺度无关路的独立完整数值在回执中,数值接近。
5 个镜像复制在两路均为 det+ 更优,下表列物理路归一残差及21:49时的初次登记;尺度无关路的独立完整数值在回执中,数值接近。**后续关闭:Claude 在21:58的 `1794664685.158429` 已将五项统一记为 `branch-ambiguous (near-symmetric)`,无需修正或重跑,分组不受影响;此前组件冻结前的待复核项已关闭。** 只有更优分支残差严格小于该路τ且另一分支残差大于其2倍时才命名分支。该规则为操作性分支标签,不是额外独立测得的对称性/采样噪声证书;原始数值和初次标记均保留。
| 复制 ID | det− | det+ | det−/det+ | 按 Claude 10% 规则登记 |
|---|---:|---:|---:|---|
@@ -21,7 +21,7 @@
| calib-037 | 0.001388851 | 0.000953194 | 1.4570 | 组件冻结前复核 |
| calib-052 | 0.002396691 | 0.001282415 | 1.8689 | 组件冻结前复核 |
没有剔除或重新拟合这些结果;分支分配或局部最优的原因尚未由此单独判定。该检查不阻塞候选计数。worker CPU 4,523.280827 秒,监督与协调 46.871647 秒,墙钟 1,156.55 秒,峰值聚合 RSS 约 842 MiB;产物根目录结束时 21,094,400 字节。原始逐起点/分支记录已按匿名校准 ID 导出到 `public/registration-details/`,完整分布及阈值在 `public/calibration-thresholds.json`,摘要和镜像并排记录在 `public/completion-summary.json`。
没有剔除或重新拟合这些结果;按上述裁量关闭,原数值证据不变。worker CPU 4,523.280827 秒,监督与协调 46.871647 秒,墙钟 1,156.55 秒,峰值聚合 RSS 约 842 MiB;产物根目录结束时 21,094,400 字节。原始逐起点/分支记录已按匿名校准 ID 导出到 `public/registration-details/`,完整分布及阈值在 `public/calibration-thresholds.json`,摘要和镜像并排记录在 `public/completion-summary.json`,后续关闭决定在 `public/mirror-flag-closure.json`。
下文保留启动时合同和首个检查点的历史记录。当前校准已结束,后续进入 [双路候选计数](s2-g1-candidates-2026-11-14.md),不会再启动校准队列。
+15
View File
@@ -0,0 +1,15 @@
# G1 正式配准:2012 对固定队列
候选计数已先于配准报告。Claude 在 [22:00:57](https://arcticnimbus.slack.com/archives/C0C78UFKGRM/p1794664857650469) 明确接受2012对并放行,实际队列已经启动,16个worker按冻结的 min-rank、a、b 顺序领取作业。没有重生成候选、读取仿真场、重新提取几何、改阈值或运行模型训练/GPU。
使用624件已完成指纹阶段的只含 points/boundary/center/rg 的几何缓存,逐输入SHA核对。配准仍为固定2000面积PPS、原PCA/退化起点、双det分支、物理/各自Rg归一两路、完整三角面双向P95。物理路除以两件平均Rg,且max/min Rg≤1.05;每路沿已冻结的独立τ。
工程状态由合格路线的最小 residual/τ 决定:≤1为规则连边,(1,2]为后续匿名阈值带审阅,>2只标OUTSIDE_FIXED_RULE,不认证无亲缘或跨键召回。分支只在残差严格低于本路τ且另一分支大于2倍时命名,否则使用Claude指定的 `branch-ambiguous (near-symmetric)` 操作性标签;域外候选的该标签不构成近对称的几何断言。关系真值仍为UNREVIEWED,组件尚未冻结。
资源上限保持100 worker CPU-h、16 workers、8小时墙钟、20GiB产物/聚合RSS、每对30分钟及1.25GiB进程树RSS。监督CPU单列,同时总限额检查保守计入监督。每100个终结作业及最终不足100的尾批检查失败率,严格大于2%停报;失败CPU/输出保留,不重试或替换。
新增首100对检查点已在任何实际作业前写入合同:仅发放冻结顺序的前100对,等这100对全部终结再决定是否发放第101对。报告实测平均worker CPU×2012的外推、成功对均值、每对最大分支起点数≥14的占比及分组成本、几何加载耗时。14起点及更重情况占比严格>85%或外推超过100 CPU-h即停报。OS缓存不主动清空,先前几何准备可能已预热;另报把观测加载最大值减均值作为额外CPU的保守敏感性情景,不冒称独立冷缓存测试或上界。
阈值、尺寸门槛、复核带端点、分支标签及首100对预算/起点边界共5项合成检查通过。运行合同SHA256 `c4271622e1775d430324dd8e8ad4524006184122079d2fc3bbb8fd0ba6a349d8`,候选计划SHA256 `61f4695b7fdf16d747bdebafc1d0c6d362087e250e9d85a36ccce3b3caa71af6`。22:00的新裁量在启动前覆盖旧准备合同,原未执行版本留在本地 `superseded-before-start/` 供追溯。
根目录 `artifacts/s2-g1-registration-2026-11-14/`。`batch-started.json` 给实际启动时刻,`progress.json` 实时更新;首100对结束时写 `public/first-100-checkpoint.json`,通过后自动继续,超限则停止并留证据。不得重新启动第二条队列,也不得在运行中修改合同钉住的源码。后续为匿名阈值带审阅(UNRESOLVED保守并组)再冻结组件;五个校准镜像标记已由Claude关闭,不另加复审门。
+51
View File
@@ -0,0 +1,51 @@
"""Register frozen candidates and apply the fixed engineering rule, no field labels."""
from pathlib import Path
import argparse,hashlib,json,os,resource,time
import numpy as np
from g1_registration_cost import register
from g1_candidate_fingerprints import check_contract
from s2_e1_supervisor import save
ROOT=Path(os.environ.get('MELTMIND_G1_REGISTRATION_ROOT','artifacts/s2-g1-registration-2026-11-14'))
def engineering_rule(routes,rga,rgb,thresholds):
ratio=max(rga,rgb)/min(rga,rgb);mean=(rga+rgb)/2;report={};scores=[]
for name in ['physical','scale_free']:
rows=[r for r in routes if r['route']==name]
if len(rows)!=2 or {r['parity'] for r in rows}!={-1,1}:raise ValueError('Missing det branch')
branches={str(r['parity']):r['residual_max_two_way_area_pps_p95']/(mean if name=='physical' else 1.) for r in rows}
best=min(branches,key=lambda k:(branches[k],k));other='-1' if best=='1' else '1';value=branches[best]
if not np.isfinite(value) or value<0 or thresholds[name]<=0:raise ValueError('Invalid residual/threshold')
eligible=name=='scale_free' or ratio<=1.05;score=value/thresholds[name]
label=('det'+('+' if best=='1' else '-')+' preferred') if eligible and value<thresholds[name] and branches[other]>2*value else 'branch-ambiguous (near-symmetric)'
report[name]={'best_residual':value,'size_gate_pass':eligible,'threshold':thresholds[name],'normalized_score':score,
'branch_residuals':branches,'branch_label':label}
if eligible:scores.append(score)
score=min(scores)
return {'routes':report,'rg_ratio':ratio,'combined_score':score,
'engineering_status':'LINK_UNDER_FIXED_RULE' if score<=1 else 'BAND_REVIEW_REQUIRED' if score<=2 else 'OUTSIDE_FIXED_RULE',
'not_a_relatedness_or_recall_certificate':True}
def main():
ap=argparse.ArgumentParser();ap.add_argument('index',type=int);args=ap.parse_args();c=check_contract(ROOT)
plan=json.loads((ROOT/'custodian/plan.json').read_text());pair=plan['jobs'][args.index];start=time.monotonic();g=[]
for case in [pair['a'],pair['b']]:
cache=plan['geometry_cache'][case];p=Path(cache['path'])
if hashlib.sha256(p.read_bytes()).hexdigest()!=cache['sha256']:raise ValueError('Frozen geometry cache changed')
with np.load(p,allow_pickle=False) as z:
if set(z.files)!={'points','boundary','center','rg'}:raise ValueError('Unexpected non-geometry cache member')
g.append({k:z[k] for k in z.files})
loaded=time.monotonic()-start;registration_start=time.monotonic()
routes=register(g[0],g[1],int(pair['a'].split('_')[0]),int(pair['b'].split('_')[0]))
decision=engineering_rule(routes,float(g[0]['rg']),float(g[1]['rg']),c['thresholds'])
dest=ROOT/'custodian/results'/f'pair-{args.index:04d}.json'
if dest.exists():raise FileExistsError('Result already exists; no retry')
save(dest,{'index':args.index,'pair':pair,'routes':routes,'engineering_rule':decision,
'cpu_seconds':sum(resource.getrusage(resource.RUSAGE_SELF)[:2]),'wall_seconds':time.monotonic()-start,
'geometry_load_wall_seconds':loaded,'registration_wall_seconds':time.monotonic()-registration_start,
'max_starts_per_branch':max(len(r['starts']) for r in routes),
'peak_rss_bytes':resource.getrusage(resource.RUSAGE_SELF).ru_maxrss*1024,'simulation_fields_read':False,
'geometric_relationship':'UNREVIEWED','components_frozen':False})
print(json.dumps({'index':args.index,'status':'REGISTRATION_COMPLETE','engineering_status':decision['engineering_status']}),flush=True)
if __name__=='__main__':main()
+26
View File
@@ -0,0 +1,26 @@
"""First fixed-rank block cost projection; no fitting or changes to k/thresholds."""
from statistics import mean
def first_block_projection(records,total_pairs):
if len(records)!=100:raise ValueError('First checkpoint requires exactly 100 terminal pairs')
cpu=[r['cpu_seconds'] for r in records];good=[r for r in records if r['status']=='PASS']
failed=len(records)-len(good);starts=sum(r.get('max_starts_per_branch',14)>=14 for r in records)
central=mean(cpu)*total_pairs/3600
successes=mean(r['cpu_seconds'] for r in good)*total_pairs/3600 if good else central
loads=[r.get('geometry_load_wall_seconds',0) for r in good]
load_delta=max(loads)-mean(loads) if loads else 0
sensitivity=max(central,successes)+load_delta*total_pairs/3600
by_cohort={str(heavy):[r['cpu_seconds'] for r in good if (r.get('max_starts_per_branch',0)>=14)==heavy] for heavy in [False,True]}
reasons=[]
if failed/100>.02:reasons.append('failure_rate_over_2_percent')
if starts/100>.85:reasons.append('fourteen_or_more_start_share_over_85_percent')
if max(central,sensitivity)>100:reasons.append('projected_worker_cpu_over_100_hours')
return {'pairs':100,'total_queue_pairs':total_pairs,'mean_worker_cpu_seconds':mean(cpu),
'projected_worker_cpu_hours':central,'successful_pair_mean_projection_hours':successes,
'high_load_as_cpu_sensitivity_hours':sensitivity,'fourteen_or_more_start_pairs':starts,
'fourteen_or_more_start_share':starts/100,'failed_pairs':failed,
'worker_cpu_by_start_cohort':{k:mean(v) if v else None for k,v in by_cohort.items()},
'geometry_load_wall_seconds_mean':mean(loads) if loads else None,'geometry_load_wall_seconds_max':max(loads) if loads else None,
'cache_note':'OS cache not flushed; fingerprint preparation warms it. Measured NPZ/hash load included in worker CPU. High-load sensitivity charges max-minus-mean observed load wall time as extra CPU, not a measured cold-cache guarantee.',
'sampling_note':'First 100 in fixed min-rank order; not a random cost sample or certified upper bound',
'decision':'STOP_AND_REPORT' if reasons else 'CONTINUE','stop_reasons':reasons}
@@ -0,0 +1,48 @@
"""Freeze the counted <=4000 candidate queue under the already granted G1 budget."""
from pathlib import Path
import hashlib,json
from g1_register_candidates import ROOT
from s2_e1_supervisor import save
def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest()
def main():
source=Path('artifacts/s2-g1-candidates-2026-11-14');count=source/'public/candidate-count.json'
summary=json.loads(count.read_text());candidates=source/'custodian/candidate-pairs.json'
assert summary['status']=='CANDIDATES_COUNTED_NOT_REGISTERED' and summary['union_pairs']<=4000
assert sha(candidates)==summary['candidate_sha256']
pairs=json.loads(candidates.read_text())['pairs'];assert len(pairs)==summary['union_pairs']
assert pairs==sorted(pairs,key=lambda r:(r['min_rank'],r['a'],r['b']))
thresholds=Path('artifacts/s2-g1-copy-calibration-2026-11-14/public/calibration-thresholds.json')
assert sha(thresholds)==summary['calibration_thresholds_sha256']
t=json.loads(thresholds.read_text());assert t['status']=='CALIBRATION_THRESHOLDS_FROZEN'
ROOT.mkdir(exist_ok=False);private=ROOT/'custodian';private.mkdir(mode=0o700);(private/'results').mkdir();(ROOT/'public').mkdir()
cases=sorted({r[k] for r in pairs for k in ['a','b']});cache={}
for case in cases:
path=source/'custodian/fingerprints'/case/'geometry.npz';cache[case]={'path':str(path),'sha256':sha(path)}
save(private/'plan.json',{'jobs':pairs,'geometry_cache':cache,'candidate_sha256':sha(candidates),'ordering':'frozen min_rank, a, b'})
(private/'plan.json').chmod(0o600)
code=['prepare_g1_candidate_registration','g1_register_candidates','run_g1_registered_candidates','g1_registration_checkpoint',
'g1_registration_cost','g1_candidate_fingerprints','s2_e1_supervisor','audit_samples','boundary_distance']
c={'authorizing_rulings':['1794661944.308269','1794662380.787319','1794664166.242149','1794664685.158429','1794664857.650469'],
'count_report_before_registration':'1794664837.008399','pairs':len(pairs),'thresholds':t['thresholds'],
'code_sha256':{f'tools/{x}.py':sha(f'tools/{x}.py') for x in code},
'input_sha256':{str(p):sha(p) for p in [private/'plan.json',count,candidates,thresholds]},
'workers':16,'per_pair_wall_seconds':1800,'per_worker_rss_bytes':1342177280,
'aggregate_rss_bytes':20*1024**3,'worker_cpu_budget_seconds':100*3600,'wall_seconds':8*3600,'disk_bytes':20*1024**3,
'protocol':'Unchanged g1_registration_cost.register; both det branches, both routes, fixed 2000 area PPS, full triangle two-way P95',
'engineering_rule':'physical raw/mean Rg with ratio<=1.05, scale_free unchanged; best eligible route/threshold <=1 link; (1,2] band review; >2 outside rule, not certified unrelated',
'failure_policy':'retain failed attempts; check >2% at every 100 terminal jobs and final partial batch; no retries/replacements',
'first_100_checkpoint':'launch only first 100 fixed-rank pairs until all terminal; report mean CPU and >=14-start share and load-cache sensitivity; stop if projection>100 CPU-h or >=14-start share>85%',
'branch_label':'name better det branch only if residual strictly below route tau and other branch >2 times larger; otherwise branch-ambiguous (near-symmetric)',
'budget_accounting':'worker and supervision recorded separately; aggregate stop conservatively also includes supervision',
'simulation_fields_training_gpu':False,'components_frozen':False,
'pending_before_component_freeze':['anonymous threshold-band review; unresolved merges per ruling'],
'calibration_mirror_flags_closed_by':'1794664685.158429'}
save(ROOT/'contract.json',c)
save(ROOT/'public/preparation.json',{'status':'REGISTRATION_QUEUE_FROZEN_NOT_STARTED','pairs':len(pairs),'unique_parts':len(cases),
'contract_sha256':sha(ROOT/'contract.json'),'plan_sha256':sha(private/'plan.json'),'candidate_sha256':sha(candidates),
'thresholds_sha256':sha(thresholds),'workers':16,'worker_cpu_hours':100,'per_pair_minutes':30,
'count_previously_reported':True,'no_new_geometry_extraction':True,'no_new_approval_gate':True})
print((ROOT/'public/preparation.json').read_text())
if __name__=='__main__':main()
+117
View File
@@ -0,0 +1,117 @@
"""Frozen min-rank candidate registration; bounded workers, CPU, disk and failure checkpoints."""
from pathlib import Path
import argparse
import fcntl
import json
import os
import resource
import signal
import subprocess
import sys
import time
import psutil
from g1_register_candidates import ROOT, check_contract
from s2_e1_supervisor import supervise, save, disk_usage, stop_group
from g1_registration_checkpoint import first_block_projection
def guard(index):
c=check_contract(ROOT);plan=json.loads((ROOT/'custodian/plan.json').read_text());n=1
job=ROOT/'jobs'/f'job-{index:02d}';job.mkdir(parents=True,exist_ok=True)
limit=n*c['per_pair_wall_seconds']
r=supervise([sys.executable,'tools/g1_register_candidates.py',str(index)],job,'worker',
dict(total_cpu_seconds=limit+1,job_cpu_seconds=limit,job_wall_seconds=limit,
tree_rss_bytes=c['per_worker_rss_bytes'],disk_bytes=c['disk_bytes'],max_processes=2),poll=.25)
save(job/'guard-result.json',{'worker':r,'supervisor_cpu_seconds':sum(resource.getrusage(resource.RUSAGE_SELF)[:2])})
return 0 if r['status']=='PASS' else 1
def terminate_workers(active):
# Guards stay alive to reap killed workers and write failure receipts.
for p,_ in active.values():
try:
for child in psutil.Process(p.pid).children():stop_group(child.pid)
except psutil.NoSuchProcess:pass
def run():
c=check_contract(ROOT);plan=json.loads((ROOT/'custodian/plan.json').read_text())
lock=(ROOT/'batch.lock').open('a');fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
if (ROOT/'batch-started.json').exists():raise FileExistsError('Batch already attempted; no automatic restart')
env=dict(os.environ,OMP_NUM_THREADS='1',OPENBLAS_NUM_THREADS='1',MKL_NUM_THREADS='1',NUMEXPR_NUM_THREADS='1',CUDA_VISIBLE_DEVICES='')
save(ROOT/'batch-started.json',{'pid':os.getpid(),'started_unix':time.time(),'jobs':len(plan['jobs']),'pairs':len(plan['jobs']),'workers':c['workers'],'contract_sha256':__import__('hashlib').sha256((ROOT/'contract.json').read_bytes()).hexdigest()})
started=time.monotonic();active={};done=[];next_index=0;reason=None;peak_rss=0;first_checkpoint_done=False
def interrupted(*_):
nonlocal reason
reason='coordinator_interrupted'
signal.signal(signal.SIGTERM,interrupted);signal.signal(signal.SIGINT,interrupted)
try:
while active or (next_index<len(plan['jobs']) and reason is None):
while reason is None and len(active)<c['workers'] and next_index<len(plan['jobs']) and (first_checkpoint_done or next_index<100):
i=next_index;next_index+=1;path=ROOT/'jobs'/f'job-{i:02d}';path.mkdir(parents=True,exist_ok=True)
log=(path/'guard.log').open('x')
p=subprocess.Popen([sys.executable,__file__,'--guard',str(i)],env=env,stdout=log,stderr=subprocess.STDOUT,start_new_session=True)
active[i]=(p,log)
print(json.dumps({'event':'STARTED','job':i,'guard_pid':p.pid}),flush=True)
for i,(p,log) in list(active.items()):
code=p.poll()
if code is not None:
log.close();path=ROOT/'jobs'/f'job-{i:02d}'/'guard-result.json'
result=json.loads(path.read_text()) if path.exists() else {'worker':{'status':'GUARD_FAILED','cpu_seconds':0},'supervisor_cpu_seconds':0}
done.append({'index':i,'returncode':code,**result});del active[i]
if len(done)%100==0 and sum(r['worker']['status']!='PASS' for r in done)/len(done)>.02:
reason='failure_rate_over_2_percent'
print(json.dumps({'event':'FINISHED','job':i,'status':result['worker']['status'],'completed':len(done)}),flush=True)
if not first_checkpoint_done and len(done)==100:
checkpoint_rows=[]
for record in sorted(done,key=lambda r:r['index']):
row={'status':record['worker']['status'],'cpu_seconds':record['worker']['cpu_seconds']}
path=ROOT/'custodian/results'/f"pair-{record['index']:04d}.json"
if path.exists():
data=json.loads(path.read_text());row.update(max_starts_per_branch=data['max_starts_per_branch'],geometry_load_wall_seconds=data['geometry_load_wall_seconds'])
checkpoint_rows.append(row)
checkpoint=first_block_projection(checkpoint_rows,len(plan['jobs']))
save(ROOT/'public/first-100-checkpoint.json',checkpoint);first_checkpoint_done=True
if checkpoint['decision']=='STOP_AND_REPORT':reason='first_100_projection_stop'
print(json.dumps({'event':'FIRST_100_CHECKPOINT',**checkpoint}),flush=True)
# Evaluate failures at every 100 terminal jobs and at the final partial batch.
if done and len(done)==len(plan['jobs']):
if sum(r['worker']['status']!='PASS' for r in done)/len(done)>.02:reason='failure_rate_over_2_percent'
if time.monotonic()-started>=c['wall_seconds']:reason='global_wall_limit'
if disk_usage(ROOT)>=c['disk_bytes']:reason='global_disk_limit'
live_cpu=live_rss=0
for p,_ in active.values():
try:
for q in [psutil.Process(p.pid)]+psutil.Process(p.pid).children(recursive=True):
try:
t=q.cpu_times();live_cpu+=t.user+t.system+t.children_user+t.children_system;live_rss+=q.memory_info().rss
except psutil.NoSuchProcess:pass
except psutil.NoSuchProcess:pass
peak_rss=max(peak_rss,live_rss)
completed_cpu=sum(r['worker']['cpu_seconds']+r['supervisor_cpu_seconds'] for r in done)
if completed_cpu+live_cpu>=c['worker_cpu_budget_seconds']:reason='global_cpu_limit'
if live_rss>=c['aggregate_rss_bytes']:reason='aggregate_rss_limit'
if reason:terminate_workers(active)
save(ROOT/'progress.json',{'completed_jobs':len(done),'active_jobs':list(active),'next_job':next_index,
'completed_worker_cpu_seconds':sum(r['worker']['cpu_seconds'] for r in done),
'live_tree_cpu_seconds':live_cpu,'active_tree_rss_bytes':live_rss,'stop_reason':reason,'elapsed_seconds':time.monotonic()-started})
if active:time.sleep(.5)
finally:
terminate_workers(active)
for p,log in active.values():
try:p.wait(timeout=10)
except subprocess.TimeoutExpired:stop_group(p.pid);p.wait()
log.close()
failures=sum(r['worker']['status']!='PASS' for r in done)
passed=reason is None and len(done)==len(plan['jobs']) and failures==0
summary={'status':'ALL_REGISTRATIONS_COMPLETE' if passed else 'REGISTRATION_INCOMPLETE',
'jobs':done,'failed_jobs':failures,'failure_rate_at_final_checkpoint':failures/len(done) if done else None,
'stop_reason':reason,'worker_cpu_seconds':sum(r['worker']['cpu_seconds'] for r in done),
'guard_cpu_seconds':sum(r['supervisor_cpu_seconds'] for r in done),
'coordinator_cpu_seconds':sum(resource.getrusage(resource.RUSAGE_SELF)[:2]),
'wall_seconds':time.monotonic()-started,'peak_aggregate_tree_rss_bytes':peak_rss,
'disk_bytes':disk_usage(ROOT),'thresholds_frozen_before_registration':True,'candidate_generation_completed':True,'no_retries':True}
save(ROOT/'batch-complete.json' if passed else ROOT/'batch-incomplete.json',summary)
print(json.dumps({k:v for k,v in summary.items() if k!='jobs'}),flush=True)
return 0 if passed else 1
if __name__=='__main__':
ap=argparse.ArgumentParser();ap.add_argument('--guard',type=int);a=ap.parse_args()
sys.exit(guard(a.guard) if a.guard is not None else run())
+34
View File
@@ -0,0 +1,34 @@
import unittest
from g1_register_candidates import engineering_rule
from g1_registration_checkpoint import first_block_projection
def routes(p1,p2,s1,s2):
return [{'route':route,'parity':parity,'residual_max_two_way_area_pps_p95':value}
for route,parity,value in [('physical',1,p1),('physical',-1,p2),('scale_free',1,s1),('scale_free',-1,s2)]]
class RuleChecks(unittest.TestCase):
def test_physical_mean_rg_and_best_branch(self):
r=engineering_rule(routes(1,.1,1,2),10,10,{'physical':.02,'scale_free':.02})
self.assertEqual(r['engineering_status'],'LINK_UNDER_FIXED_RULE');self.assertAlmostEqual(r['combined_score'],.5)
def test_scale_gate_excludes_even_perfect_physical_fit(self):
r=engineering_rule(routes(0,0,.03,.04),1,2,{'physical':.02,'scale_free':.02})
self.assertFalse(r['routes']['physical']['size_gate_pass']);self.assertEqual(r['engineering_status'],'BAND_REVIEW_REQUIRED')
def test_threshold_and_band_endpoints(self):
for x,status in [(1,'LINK_UNDER_FIXED_RULE'),(2,'BAND_REVIEW_REQUIRED'),(2.01,'OUTSIDE_FIXED_RULE')]:
r=engineering_rule(routes(x,x,x,x),1,1,{'physical':1,'scale_free':1});self.assertEqual(r['engineering_status'],status)
def test_branch_label_requires_strict_threshold_and_twofold_gap(self):
r=engineering_rule(routes(.1,.15,.1,.15),1,1,{'physical':1,'scale_free':1})
self.assertEqual(r['routes']['physical']['branch_label'],'branch-ambiguous (near-symmetric)')
r=engineering_rule(routes(.1,.21,.1,.21),1,1,{'physical':1,'scale_free':1})
self.assertEqual(r['routes']['physical']['branch_label'],'det+ preferred')
def test_first_100_cost_and_start_stop_boundaries(self):
rows=[{'status':'PASS','cpu_seconds':90,'max_starts_per_branch':4,'geometry_load_wall_seconds':.2} for _ in range(100)]
self.assertEqual(first_block_projection(rows,2012)['decision'],'CONTINUE')
for r in rows[:85]:r['max_starts_per_branch']=14
self.assertEqual(first_block_projection(rows,2012)['decision'],'CONTINUE')
rows[85]['max_starts_per_branch']=14
self.assertIn('fourteen_or_more_start_share_over_85_percent',first_block_projection(rows,2012)['stop_reasons'])
for r in rows:r['cpu_seconds']=200
self.assertIn('projected_worker_cpu_over_100_hours',first_block_projection(rows,2012)['stop_reasons'])
if __name__=='__main__':unittest.main(verbosity=2)