tools(phase-37): restruct --redraw VERDICT:cause lifts the engine's done set too (the redraw drew TUs and skipped every unit — 'rows 0'); share_body --retry-excepted (the 51 ledgered classes re-enter the plan); item (h) closed: D58/HD7 landed 196 canonical + 127 K&R; census 1,796 lying / 76 callees; .run pruned 50 → 16 GB (22 GB of gcc pass dumps) | 🛑 T4 in progress — item (g) NEXT (S108)

This commit is contained in:
Drew T
2026-09-12 22:29:20 -06:00
parent 7f02f59456
commit 6991780f07
7 changed files with 110 additions and 61 deletions
File diff suppressed because one or more lines are too long
+47 -47
View File
@@ -1,9 +1,9 @@
{
"summary": {
"head": "06615fe89",
"src_stamp": "9def359d3553fe7a",
"head": "7f02f5945",
"src_stamp": "80b9594f320b8937",
"tool_stamp": "ac697cecc1",
"when": "2026-09-13T03:24:00Z",
"when": "2026-09-13T04:28:44Z",
"files": 7305,
"tus": 4121,
"headers": 3181,
@@ -288,8 +288,8 @@
"extern_fn_decls": 4279270,
"extern_data_decls": 1078774,
"declared_fn_names": 12088,
"multi_spelled_callees": 3814,
"multi_body_names": 6419,
"multi_spelled_callees": 3777,
"multi_body_names": 6418,
"data_symbols_declared": 55548,
"multi_typed_data_symbols": 18493,
"asm_label_aliases": 5158,
@@ -302,59 +302,59 @@
"packed": 63,
"aligned": 12
},
"lying": 2171,
"lying_callees": 189,
"lying": 1796,
"lying_callees": 76,
"lying_kinds": {
"K&R-empty": 1654,
"narrow": 517
"K&R-empty": 1373,
"narrow": 423
},
"kr_sites": 5092,
"kr_callees": 162,
"kr_sites": 5262,
"kr_callees": 199,
"cross_binary": 418,
"cross_callees": 96
},
"struct_map": {
"types": 18730,
"types": 18741,
"explained_sites": 498894,
"deref_sites": 503013,
"explained_pct": 99.2,
"unassigned_sites": 4119,
"conflicts": 729,
"conflicts": 727,
"suspect": 11,
"evidence": {
"param": 36486,
"arg": 10185,
"assign": 14663,
"return": 1524,
"assign": 14665,
"ret-of": 3374,
"assign&": 1052,
"arg": 10173,
"return": 1524,
"assign&": 1050,
"arg&": 270,
"field": 9613
},
"vetoed": {
"arg&-conduit": 14628,
"arg-conduit": 115288,
"arg-no-overlap": 39819,
"assign-multisource": 34568,
"assign&-multisource": 12501,
"field-multisource": 7008,
"ret-of-multisource": 6686,
"assign-multisource": 34568,
"arg&-conduit": 14628,
"field-multisource": 7008,
"ret-of": 679,
"assign&-multisource": 12501,
"arg&-no-overlap": 3456,
"assign": 349,
"assign&": 67,
"assign": 347,
"arg-no-overlap": 43021,
"assign&": 69,
"arg": 182,
"return": 12,
"field": 3224
},
"singletons": 14670,
"multi_body": 4060,
"sites_in_multi_body": 441236,
"singletons": 14677,
"multi_body": 4064,
"sites_in_multi_body": 441229,
"top": [
{
"name": "Unkstruct_800B5CB8",
"sites": 107600,
"bodies": 11189,
"sites": 107598,
"bodies": 11187,
"size_hint": 268,
"fields": 134,
"conflicts": 50,
@@ -366,7 +366,7 @@
"assign": 7400,
"return": 713,
"ret-of": 1477,
"assign&": 20,
"assign&": 18,
"field": 2622
},
"globals_at": [
@@ -382,18 +382,18 @@
},
{
"name": "Unkstruct_80126B58",
"sites": 65458,
"bodies": 17068,
"sites": 65397,
"bodies": 17047,
"size_hint": 588,
"fields": 177,
"fields": 175,
"conflicts": 50,
"sign_mixed": 62,
"sign_mixed": 60,
"merges": {
"assign&": 106,
"param": 2160,
"arg": 1117,
"param": 2100,
"arg": 1086,
"assign": 43,
"field": 52
"field": 51
},
"globals_at": [
"D_80126B58"
@@ -631,15 +631,15 @@
},
{
"name": "Unkstruct_80130D48",
"sites": 2363,
"bodies": 585,
"sites": 2382,
"bodies": 587,
"size_hint": 100,
"fields": 17,
"conflicts": 2,
"fields": 25,
"conflicts": 6,
"sign_mixed": 3,
"merges": {
"field": 1,
"assign": 110
"assign": 112
},
"globals_at": [],
"globals_ptr": [
@@ -762,8 +762,8 @@
"n": 4
},
"global_blocks": {
"n": 2120,
"members": 14230,
"n": 2124,
"members": 14253,
"top": [
{
"base": "0x800cf10c",
@@ -941,9 +941,9 @@
"path": ".run/P37/census/parked.tsv"
},
"timing": {
"walk_s": 40.9,
"decls_s": 191.6,
"total_s": 202.2
"walk_s": 37.5,
"decls_s": 189.4,
"total_s": 200.2
}
},
"dup_layout_classes": [
+10 -10
View File
@@ -1,4 +1,4 @@
type_census — 2026-09-13T03:24:00Z at 06615fe89 (src stamp 9def359d3553fe7a, tool ac697cecc1); 7305 files (4121 TUs + 3181 headers), 99130 function definitions; walk 40.9 s, total 202.2 s
type_census — 2026-09-13T04:28:44Z at 7f02f5945 (src stamp 80b9594f320b8937, tool ac697cecc1); 7305 files (4121 TUs + 3181 headers), 99130 function definitions; walk 37.5 s, total 200.2 s
DEFINITIONS 7255 struct/union bodies (+0 enums): canonical header 1179 · .c file-scope 4085 · .c block-scope 1904 · per-function shared headers 63 · other headers 24 · include/ 0
3143 distinct names · 527 distinct layouts (0 unresolved) · 206 duplicate classes covering 2823 names (tier 1 122 same-named, tier 2 84 opaque; 46 layout-twin classes / 1867 names kept apart) · 585 exact-text classes / 4460 copies · 40 VARIANT names (>1 layout) · 141 dead canonical names · 74 canonical names redefined in .c · 1781 scalar/alias typedefs · 157 forward decls
@@ -6,12 +6,12 @@ CAST SITES deref 503013 = P 409006 + I 60664 + X 13800 + M 19543 (+ A addres
by base: param 276860 · local 149911 · gaddr 40123 · nested 24076 · global 8861 · other 1678 · addr-of 1348 · ident 156
by width: s4 145161 · u2 142775 · s2 131818 · u1 43174 · agg 13472 · p4 12019 · u4 11165 · s1 3429
top bases: a0(param) 92255 · param_1(param) 81595 · arg0(param) 67704 · p(local) 18043 · p(param) 11784 · s0(local) 10368 · cach(local) 8246 · s1(local) 7137 · buf(local) 7067 · flag(local) 5453 · *(s32 *)(a0 + 0x20)(nested) 5215 · iVar2(local) 5160 · dst(local) 4874 · iVar1(local) 4836 · iVar3(local) 4693 · e(local) 3918
DECLARATIONS 99130 function definitions (1894 K&R) · 4279270 extern function declarations over 12088 names (3814 spelled >1 way) · 6419 names with >1 body text · 1078774 data externs over 55548 symbols (18493 typed >1 way) · asm-label aliases 5158 (165 names) · builtins {'memcpy': 301, 'abs': 1} · attributes {'packed': 63, 'aligned': 12}
lying declarations 2171 over 189 callees {'K&R-empty': 1654, 'narrow': 517} · K&R sites (marked, counted apart) 5092 over 162 callees · cross-binary (the fleet's definitions disagree, this binary has none) 418 over 96 callees
STRUCT MAP 18730 types explain 498894/503013 deref sites (99.2 %); unassigned 4119; 4060 types span ≥2 bodies (441236 sites), 14670 single-body; types with conflicts 729, suspect 11
merges by evidence {'param': 36486, 'arg': 10185, 'assign': 14663, 'return': 1524, 'ret-of': 3374, 'assign&': 1052, 'arg&': 270, 'field': 9613}; vetoed {'arg&-conduit': 14628, 'arg-conduit': 115288, 'arg-no-overlap': 39819, 'assign-multisource': 34568, 'assign&-multisource': 12501, 'field-multisource': 7008, 'ret-of-multisource': 6686, 'ret-of': 679, 'arg&-no-overlap': 3456, 'assign': 349, 'assign&': 67, 'arg': 182, 'return': 12, 'field': 3224}
Unkstruct_800B5CB8 sites 107600 bodies 11189 fields 134 size≥0x10c width-conflicts 50 sign-mixed 55 merges {'param': 9454, 'assign': 7400, 'arg': 6955, 'field': 2622} at D_800B5CB8,D_800D3888,D_80181448 ptr D_8006386C,D_80074778,D_80074780
Unkstruct_80126B58 sites 65458 bodies 17068 fields 177 size≥0x24c width-conflicts 50 sign-mixed 62 merges {'param': 2160, 'arg': 1117, 'assign&': 106, 'field': 52} at D_80126B58 ptr D_80126B58
DECLARATIONS 99130 function definitions (1894 K&R) · 4279270 extern function declarations over 12088 names (3777 spelled >1 way) · 6418 names with >1 body text · 1078774 data externs over 55548 symbols (18493 typed >1 way) · asm-label aliases 5158 (165 names) · builtins {'memcpy': 301, 'abs': 1} · attributes {'packed': 63, 'aligned': 12}
lying declarations 1796 over 76 callees {'K&R-empty': 1373, 'narrow': 423} · K&R sites (marked, counted apart) 5262 over 199 callees · cross-binary (the fleet's definitions disagree, this binary has none) 418 over 96 callees
STRUCT MAP 18741 types explain 498894/503013 deref sites (99.2 %); unassigned 4119; 4064 types span ≥2 bodies (441229 sites), 14677 single-body; types with conflicts 727, suspect 11
merges by evidence {'param': 36486, 'assign': 14665, 'ret-of': 3374, 'arg': 10173, 'return': 1524, 'assign&': 1050, 'arg&': 270, 'field': 9613}; vetoed {'arg-conduit': 115288, 'ret-of-multisource': 6686, 'assign-multisource': 34568, 'arg&-conduit': 14628, 'field-multisource': 7008, 'ret-of': 679, 'assign&-multisource': 12501, 'arg&-no-overlap': 3456, 'assign': 347, 'arg-no-overlap': 43021, 'assign&': 69, 'arg': 182, 'return': 12, 'field': 3224}
Unkstruct_800B5CB8 sites 107598 bodies 11187 fields 134 size≥0x10c width-conflicts 50 sign-mixed 55 merges {'param': 9454, 'assign': 7400, 'arg': 6955, 'field': 2622} at D_800B5CB8,D_800D3888,D_80181448 ptr D_8006386C,D_80074778,D_80074780
Unkstruct_80126B58 sites 65397 bodies 17047 fields 175 size≥0x24c width-conflicts 50 sign-mixed 60 merges {'param': 2100, 'arg': 1086, 'assign&': 106, 'field': 51} at D_80126B58 ptr D_80126B58
Unkstruct_8018E71C sites 6745 bodies 396 fields 7 size≥0x10 width-conflicts 0 sign-mixed 0 merges {'param': 18, 'arg': 15, 'assign&': 2} at D_8018E71C
Unkstruct_dac960ce sites 4464 bodies 124 fields 13 size≥0x24c width-conflicts 0 sign-mixed 2 merges {'param': 2}
Unkstruct_0caecd54 sites 4340 bodies 124 fields 23 size≥0xfe width-conflicts 0 sign-mixed 1 merges {'param': 2, 'assign': 1, 'return': 1}
@@ -22,12 +22,12 @@ STRUCT MAP 18730 types explain 498894/503013 deref sites (99.2 %); unassigned
Unkstruct_80128EA8 sites 3311 bodies 632 fields 18 size≥0x38 width-conflicts 0 sign-mixed 13 merges {'arg': 23, 'ret-of': 19, 'field': 7, 'param': 2}
Unkstruct_ade2e8a0 sites 3271 bodies 196 fields 26 size≥0xa4 width-conflicts 3 sign-mixed 9 merges {'param': 268, 'arg': 133}
Unkstruct_1fa9e810 sites 3144 bodies 131 fields 3 size≥0x49 width-conflicts 0 sign-mixed 0 merges {}
GLOBAL BLOCKS 2120 runs of ≥4 adjacent scalar D_ symbols (14230 symbols): 0x800cf10c+0x34 ×29 (D_800CF10C..D_800CF13C) · 0x800a6580+0x3a ×27 (D_800A6580..D_800A65B8) · 0x801998a4+0x57 ×24 (D_801998A4..D_801998FA) · 0x80199840+0x56 ×23 (D_80199840..D_80199895) · 0x801a9608+0x50 ×22 (D_801A9608..D_801A9654) · 0x801ab708+0x54 ×21 (D_801AB708..D_801AB758) · 0x801b0df0+0x4b ×21 (D_801B0DF0..D_801B0E3A) · 0x801b83a0+0x4e ×21 (D_801B83A0..D_801B83ED)
GLOBAL BLOCKS 2124 runs of ≥4 adjacent scalar D_ symbols (14253 symbols): 0x800cf10c+0x34 ×29 (D_800CF10C..D_800CF13C) · 0x800a6580+0x3a ×27 (D_800A6580..D_800A65B8) · 0x801998a4+0x57 ×24 (D_801998A4..D_801998FA) · 0x80199840+0x56 ×23 (D_80199840..D_80199895) · 0x801a9608+0x50 ×22 (D_801A9608..D_801A9654) · 0x801ab708+0x54 ×21 (D_801AB708..D_801AB758) · 0x801b0df0+0x4b ×21 (D_801B0DF0..D_801B0E3A) · 0x801b83a0+0x4e ×21 (D_801B83A0..D_801B83ED)
PARKED (P36) 24 classes / 453 bodies / 691 needed sites → .run/P37/census/parked.tsv; needs {'signature': 13, 'struct': 7, '?': 4}; 22 PARK names are minimum-lever banks
CONTROLS 4/4: player_block_widths OK (D_80078E8C:4/4 D_80078EB2:2/2 D_80078EB4:2/2 D_80078EB6:2/2 D_80078EB8:2/2 [doc-disputed D_80078F08: code 4 vs actor-struct.md 2] [doc-disputed D_80078F0C: code 4 vs actor-struct.md 2]) · matrix_layouts OK (MATRIX=32 MATRIX_L48=48) · prim_layout_class OK (defs in 1192 files, 2 spellings, 1192/1192 in one layout (64 B)) · tu_conflict_D_800A651C OK (s32:1202 | u8[]:9 | OtBlk[]:9 | OtBlk_80016450[]:8 | s32[]:7)
duplicate-layout classes (top 12): 8B×293 names (488 defs): GTESVec, GVec8, SIn_8017E95C, SV… | 8B×202 names (0 defs): Blk8L, Blk8S16, Blk8U, Blk8_80126940… | 32B×170 names (277 defs): M32_8017F154, M32_80188094, MATRIX, MATRIX2… | 8B×153 names (341 defs): Blk8_801807DC, Blk8_8018453C, COL_8001EFE0, MoveT… | 32B×129 names (0 defs): B20, Blk20, Blk20_800CB68C, Blk20_8016DF5C… | 4B×111 names (0 defs): B4, B4_80165140, B4_8017F154, B4_80181970… | 64B×91 names (1428 defs): Prim_8016E7C8, Prim_8016E7C8_8016B6BC, Prim_8016E7C8_8016B9F8, Prim_8016E7C8_8016C2C4… | 8B×82 names (0 defs): B8, B8_17F474, B8_80165140, B8_801851A8… | 8B×63 names (211 defs): Ang_8017E95C, DVEC_80183534, SOut_8017E95C, SVEC… | 4B×60 names (68 defs): PTAG_85910, PTag, PTag293C, PTag_1412A8… | 8B×59 names (0 defs): Bc8_80180E0C, CdFileLoc, Cmd_801805C8, M8_8016B6BC… | 16B×54 names (0 defs): B16, B16_8017CDE4, B16_80183ED8, B16_801841C8…
VARIANT names (top 12): Prim×5, Rec×4, Blk8×4, St×4, S×4, V8×4, Vec8×3, Obj×3, Ent×3, Blk16×2, CdReq×2, Blk4×2
type_census: 7255 definitions (527 layouts, 206 duplicate classes, 40 variant camps) · 503013 cast sites in 69497 bodies over 8 base classes (4 forms + A, coverage OK) · 2171 lying declarations / 189 callees (+5092 K&R sites, +418 cross-binary apart) · controls 4/4
struct_map: 18730 types over 18730 clusters explain 498894/503013 sites (99.2 %); 4119 unassigned sites; 729 types with conflicts
type_census: 7255 definitions (527 layouts, 206 duplicate classes, 40 variant camps) · 503013 cast sites in 69497 bodies over 8 base classes (4 forms + A, coverage OK) · 1796 lying declarations / 76 callees (+5262 K&R sites, +418 cross-binary apart) · controls 4/4
struct_map: 18741 types over 18741 clusters explain 498894/503013 sites (99.2 %); 4119 unassigned sites; 727 types with conflicts
+3
View File
@@ -14,3 +14,6 @@ log: t4_HD7
cycle: batch t4_HD7 committed 1e876b0ec — restruct: batch t4_HD7 rung D — 271 files (headers; 271 drawable) · 289 declaration units: 182 canonical / 0 promoted / 91 K&R marked / 0 aliases typed / 0 __builtin_abs → abs / 107 kept · compiles 41375 in 1381 s wall · final 271/271 identical · written 159 files | check-all: 218 passed, 0 failed of 218
cycle: batch t4_HD8 wrote no file — restruct: batch t4_HD8 rung D — 57 files (headers; 57 drawable) · 0 declaration units: 0 canonical / 0 promoted / 0 K&R marked / 0 aliases typed / 0 __builtin_abs → abs / 0 kept · compiles 0 in 12 s wall · final 57/57 identical · written 0 files
log: t4_HD8
cycle: batch t4_HD8 committed 7f02f5945 — restruct: batch t4_HD8 rung D — 57 files (headers; 57 drawable) · 0 declaration units: 0 canonical / 0 promoted / 0 K&R marked / 0 aliases typed / 0 __builtin_abs → abs / 0 kept · compiles 0 in 12 s wall · final 57/57 identical · written 0 files | (no src change — the previous R22 stands)
cycle: batches 7..8 done
cycle exit=0
+15
View File
@@ -745,6 +745,21 @@ bucketed by what each bucket needs before any plan is proposed. **Candidates for
- **2026-09-12 — T4 batch `t4_HD8`** (`.run/P37/restruct/run_t4_HD8.log`, `batch_t4_HD8.json`): `restruct: batch t4_HD8 rung D — 57 files (headers; 57 drawable) · 0 declaration units: 0 canonical / 0 promoted / 0 K&R marked / 0 aliases typed / 0 __builtin_abs → abs / 0 kept · compiles 0 in 12 s wall · final 57/57 identical · written 0 files` → R22 (`.run/P37/baseline/r22_t4_HD8.log`) **`(no src change — the previous R22 stands)`** (``) → census `(census skipped)`.
- **S108 (continued on Drew's "continue") — item (h) read and closed; the disk; item (g)'s tool.** The 593 "no visible definition" rows were
STALE VERDICTS, not a disagreement: the engine resolves every one now (`defs_visible('src/md_MAIN_013/md_MAIN_013.c')['func_80128EA8']` → the
shared header), but the first `DECL-NONE:visible` redraw had drawn its TUs and skipped every unit as done — `apply_batch` lifted the engine's
`done` set by VERDICT only (`latest.get(k[:3]) not in set(a.redraw)`), so the `VERDICT:cause` key lifted the planner's filter and not the
engine's ("rows 0" in D49/D56/D57). Fixed at the cause (the same key logic on both sides); the redraw again: `t4_D58` 50 units: 14 canonical /
36 K&R marked · 32 files (`22915a697`, R22 `218 passed, 0 failed of 218`) · `t4_D59` 1 kept · **`t4_HD7` 271 headers · 289 units: 182 canonical /
91 K&R marked / 107 kept · 159 files · 41,375 compiles in 1,381 s (`1e876b0ec`, R22 218/218)** · `t4_HD8` 0. Of the 593, 133 were the alias
NAMES `aF…` of the 16 still-aliased functions (T7's). Census (`census_t4d.log`): **`1796 lying declarations / 76 callees (+5262 K&R sites, +418
cross-binary apart) · controls 4/4`**. **The disk (Drew asked):** 254 MB free of 73 GB — `.run/` was 50 GB, **22 GB of it gcc pass dumps**
(`.sched2 .lreg .flow .greg .combine .cse …` from `cc1_dumps_tu.sh`) under `.run/P36/agents/`'s packs; the dump files deleted (every `.c`/`.md`/
`.txt` kept — step (d) read bodies from `scratch/`), the 45k stale judge objects in `.run/P36/delever/obj` too, `sudo fstrim /` → 10 GiB back to
the host; **22 GB free (70 %)**; still prunable, same class: `.run/P32/` 6.6 GB, the rest of `.run/P36/` 6.5 GB. **Item (g)'s tool:** `share_body
--retry-excepted` (a ledgered class re-enters the plan; before registration its old row is dropped — a share leaves no row, a rejection
re-ledgers with the fresh diagnostic); `--plan --retry-excepted`: **extend 50 classes · new 1 class** (0 / 0 without the flag).
## 🛑 SESSION CHECKPOINT — S108 (2026-09-12, FINAL — written for a FRESH session; the session's last commit follows this): gate 1 APPROVED, **T0 ☑ T1 ☑ T2 ☑ T3 ☑ — T4 IN PROGRESS (☐): steps (a)–(f) DONE, two owed items left** — 🛑 **T4 NEXT: (g) the 51 TU-CONFLICT rows retried through `share_body` (needs a `--retry-excepted` flag), (h) the 593 "no visible definition" rows read on one example; then the T4 ☑ line, the P6 rules check, T5 (Max for the head types); xHigh** | R22 `check-all: 218 passed, 0 failed of 218` at `06615fe89` (every one of the session's ~40 gated commits carries its own) | HEAD after this commit is the checkpoint's commit; tree clean; nothing pushed after `79b2f6f15` (Drew pushes, R6) | last batch `t4_HD8` on 1e876b0ec: 57 files (headers; 57 drawable) · 0 declaration units: 0 canonical / 0 promoted / 0 K&R marked / 0 aliases typed / 0 __builtin_abs → abs / 0 kept · compiles 0 i
**Replay this block into the chat at the next session start (R64); it is the ONLY in-phase context the next session inherits. Everything below
+11 -1
View File
@@ -2546,7 +2546,17 @@ def apply_batch(a):
rows = load_ledger()
done, latest = ledger_index(rows)
if a.redraw:
done = {k for k in done if latest.get(k[:3]) not in set(a.redraw)}
# the same VERDICT[:cause-substring] keys as settled_units (the planner's side): the engine's `done` filter must lift the same
# rows, or a redrawn TU is drawn and then skipped as done — "rows 0" (t4_D49/D56 on the `DECL-NONE:visible` key)
vc = {}
for r in rows:
if r.get("rung") == "D" and r.get("unit"):
vc[(r["tu"], r["unit"])] = (r.get("verdict"), r.get("cause") or "")
keys = [(k.split(":", 1)[0], k.split(":", 1)[1] if ":" in k else None) for k in a.redraw]
def lifted(k):
v, c = vc.get((k[1], k[2]), (None, ""))
return any(v == kv and (ks is None or ks in c) for kv, ks in keys)
done = {k for k in done if not lifted(k)}
log_p = RUN / f"apply_{a.label}.log"
log_f = open(log_p, "a")
+23 -2
View File
@@ -170,8 +170,8 @@ def candidates(cen):
"""(extend, new): the classes this tool shares. Same-vram only; twin-covered and excepted classes are satisfied already."""
extend, new = [], []
for c in cen["classes"]:
if c["verdict"] == "A" or "E" in c["flags"] or "F" in c["flags"] or "TWIN-COVERED" in c["flags"] or c["excepted"]:
continue
if c["verdict"] == "A" or "E" in c["flags"] or "F" in c["flags"] or "TWIN-COVERED" in c["flags"] or (c["excepted"] and not RETRY_EXCEPTED):
continue # `--retry-excepted` (P37 T4): a ledgered class re-enters the plan; this run's verdict replaces its row
priv = [i for i in c["insts"] if i["form"] == "def"]
if c["verdict"] == "B":
extend.append(c)
@@ -392,6 +392,18 @@ def restore(tus, tu_snap):
(REPO / tu).write_text(tu_snap[tu])
RETRY_EXCEPTED = False
def ledger_drop(h):
"""Drop every ledger row of class `h` (a retried exception: the row this run writes — or does not — is the verdict now)."""
lines = LEDGER.read_text().split("\n")
kept = [ln for ln in lines if not ln.startswith(h)]
if len(kept) != len(lines):
LEDGER.write_text("\n".join(kept))
return len(lines) - len(kept)
def ledger_row(h, reason, nins, instances, note):
with open(LEDGER, "a") as f:
f.write(f"{h}\t{reason}\t{nins}\t{instances}\t{note}\n")
@@ -492,6 +504,12 @@ def run_batch(orc, cen, classes, label):
results[a] = (ok3, det3 + f" (after bisect: {len(good)} classes kept, {len(by_class) - len(good)} rejected)")
if not ok3:
sys.exit(f"share_body: {a} still red after the bisect ({det3}) — stopping (R43)")
if RETRY_EXCEPTED:
for c in classes:
if c.get("excepted"):
n_ = ledger_drop(c["h"])
if n_:
log(f" [{label}] retry: {n_} previous ledger row(s) of {c['h'][:10]} dropped — this run's verdict replaces them")
# register: new groups with the members that passed; extensions likewise; ledger the rejected
reg_entries = []
for gid, h, src, fn, vram, bins in b.register:
@@ -714,7 +732,9 @@ def rejected_in(b, h, cen):
# ----------------------------------------------------------------------------------------------------------------------------
def main():
global RETRY_EXCEPTED
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
ap.add_argument("--retry-excepted", action="store_true", help="let the classes ledgered in config/dedup_exceptions.tsv back into the plan; a class that shares loses its row, a rejection re-ledgers it with the fresh diagnostic (P37 T4)")
ap.add_argument("--plan", action="store_true")
ap.add_argument("--apply", action="store_true")
ap.add_argument("--bucket", choices=["extend", "new", "text"], default="new")
@@ -732,6 +752,7 @@ def main():
"then share its private copies (the class's ledger row is dropped when anything shares)")
ap.add_argument("-j", "--jobs", type=int, default=os.cpu_count() or 4)
a = ap.parse_args()
RETRY_EXCEPTED = bool(getattr(a, "retry_excepted", False))
RUN.mkdir(parents=True, exist_ok=True)
t0 = time.time()
cen = census(a.jobs)