Files
BFM-decomp/docs/progress.fleet.md
T
Drew T 6e0b1605c6 fix(phase-30 S40): cast_call_sites read a RETURN as a prototype and deleted it — 0/39 sweep becomes 18/39
THE BUG. tools/cast_call_sites.py classifies a declaration line with

    ^([ \t]*)(extern\s+)?([A-Za-z_][\w \t\*]*?)\b([A-Za-z_]\w*)\s*\(([^;{]*)\)\s*;

Feed it a return statement and `return` is a perfectly good identifier where a type is expected:

    return func_8012CB64((s32)out, -0xC0, 0x40, -0x60, 0);
     ^^^^^^ captured as the return TYPE, func_8012CB64 as the DECLARED NAME

so the "rewrite this decl to canonical" path REPLACED the statement with
`extern s32 func_8012CB64(s32,s32,s32,s32,s32);`, DELETING the return. In C89 a declaration after a
statement is a parse error, so the damage surfaced as a bare syntax error in the DRAFT -- reading as
the draft's fault, not the tool's. 9 of 9 staged members of family 0x801848dc lost their return.

  fix: a keyword guard (a declaration's type-specifier can never begin with a statement keyword)
  family_sweep --hseq --band all over 5 families:   0/39  ->  18/39 banked   (only the guard changed)

⚠️ AND THE TRAP INSIDE THE FIX: the obvious R33 move is "route it through cdecl". CHECKED, and it is
WRONG -- cdecl.parse() is a DECLARATOR-GRAMMAR parser that assumes it was handed a declaration; it
reports `return func_X(...);` as declaring func_X and `if (f(a));` as declaring `if`.
Statement-vs-declaration is a question cdecl does not answer. Routing there would have been a silent
non-fix that looked principled. §134's law still holds for line-SHAPE masking; this is a different
question.

BLAST RADIUS (measured, not assumed -- R14): cast_call_sites is in gate_stage's DEFAULT pipeline
(canon_resident_calls -> cast_call_sites -> sig_unify -> harvest_verify) and has been since Phase 20.
Of 44,833 stored drafts, 318 (0.7%) carry a `return f(...);` line this mis-reads, across 67 callees
(func_8014F468 x41, func_8014F6F4 x37, func_8014F74C x32, ratan2 x25). Every one, every time it
passed the gate pipeline, lost its return and failed as PLUMBING. Part of the historical plumbing
tail is this bug.

ALSO IN THIS COMMIT

- S5 CALIBRATION WAVE (8 agents, ultracode, 1.31M tokens). Pool VERIFIED FIRST (R14 -- Fable's whale
  claim was 3/4 wrong): measured 1,677 clusters / 5,795 fns / 319,755 ins at a 3.68x multiplier vs
  its claimed 1,689 / 5,956 / 326,261 at 2.7x -- its numbers hold, and the multiplier is BETTER.
  Result: 8/8 match_one MATCH (close=0), and 5/8 banked whole-binary -- the §52b/§61 gap is
  integration, not codegen. Banked: func_801822E0 func_8017EC98 func_801851A8 func_80189A34
  func_80188E10 (693 ins x1 before propagation). Not banked: func_8018B238 (FAILED),
  func_8017EF54 + func_801802EC (NEAR) -- drafts kept in .run/wave-s40/ for recovery.
- 18 member-banks from the re-run sweep (the cross-address free-h_exact pool: h_exact-identical at
  DIFFERENT addresses, which dedup_propagate correctly refuses since it assumes position-locking --
  family_sweep is the right lane).
- cookbook §143 (this bug + the cdecl trap + the blast radius); index regenerated.

VERIFIED: make clean && make extract-all && make check-all -> 140 passed, 0 failed of 140.
Fleet 12419169 -> 12420375 instr; distinct +1,526 / +5 uniq; fn-count +23. audit-digest OK.
0 NON_MATCHING (G4).

NEW IDIOM FROM THE WAVE, not yet folded into §31 (agent was told to write only its draft): a byte
counter must be spelled `cnt + 0xff`, NOT `cnt - 1`. Both are mod-256 identical and both compile to
one addiu, but gcc-2.7.2 picks the immediate encoding from the SOURCE SPELLING (0xFFFF vs 0x00FF).
Also flagged: .run/ghidra_c/func_8017EF54.c is a stale decompile of the WRONG function.
2026-08-05 11:05:35 -06:00

9.1 KiB
Raw Blame History

BFM FLEET matching progress (generated by tools/progress.py --fleet — authoritative)

140 binaries: main + resident + 138 location overlays. DETERMINISTIC,

source-derived (committed src/*.c + config/dedup.us.yaml). Live byte gate: make check-all;

cross-binary collapsible-byte leverage: docs/duplicates.cross.md.

THREE progress metrics (all matter — see the labels):

FLEET fn-count byte-ident: 341388 / 353717 = 96.51% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay) FLEET instr-weighted : 12420375 / 13160961 = 94.4% (shipped .text across main + resident + 138 overlays; the decomp.dev-DISPLAY number) FLEET distinct-code(uniq): 5030147 / 5654184 = 89.0% (77978/87459 unique fns; the DISTINCT-RE number) MAIN game-code weighted : 436 / 79510 = 0.5% (INCLUDED in the fleet numbers above since 2026-07-22 — roadmap §1 metrics contract; LINKED-excluding Ghidra sig dated 2026-08-05; caveat is R34: no independent second oracle for a PS-X EXE, NOT drift) (fleet EXCLUDING main, for continuity with pre-2026-07-22 readings: 12419939 / 13081451 = 94.9%)

FLEET REAL substantive : 339533 (of which dedup-shared 241439 via 1919 groups / 241513 instances) FLEET LINKED PsyQ objs : 959 FLEET NON_MATCHING : 7 (0 in any default build — G4) FLEET INCLUDE_ASM stubs : 12322 FLEET matchable : 353717

binary REAL shared LINKED byte-ident matchable byte-ident %
main 54 2 959 1055 2096 50.3%
resident 129 0 0 131 145 90.3%
ov_SC01_000 2387 1755 0 2387 2403 99.3%
ov_SC01_001 2394 1756 0 2396 2466 97.2%
ov_SC01_004 2391 1747 0 2392 2414 99.1%
ov_SC01_005 2423 1770 0 2423 2503 96.8%
ov_SC01_006 2423 1770 0 2423 2503 96.8%
ov_SC01_008 2391 1747 0 2393 2426 98.6%
ov_SC01_009 2417 1748 0 2418 2507 96.4%
ov_SC01_074 2393 1748 0 2395 2425 98.8%
ov_SC01_077 2552 1713 0 2554 2586 98.8%
ov_SC01_080 2421 1751 0 2421 2512 96.4%
ov_SC01_084 2446 1756 0 2451 2579 95.0%
ov_SC02_000 2517 1795 0 2517 2683 93.8%
ov_SC02_003 2517 1795 0 2517 2683 93.8%
ov_SC02_004 2386 1751 0 2386 2401 99.4%
ov_SC02_005 2536 1747 0 2546 2927 87.0%
ov_SC02_011 2622 1754 0 2633 2893 91.0%
ov_SC02_015 2397 1753 0 2397 2414 99.3%
ov_SC02_016 2479 1754 0 2482 2545 97.5%
ov_SC02_017 2548 1754 0 2556 2732 93.6%
ov_SC02_021 2402 1753 0 2402 2437 98.6%
ov_SC02_026 2498 1751 0 2504 2572 97.4%
ov_SC02_027 2556 1751 0 2565 2692 95.3%
ov_SC02_028 2561 1751 0 2571 2701 95.2%
ov_SC02_031 2491 1752 0 2496 2562 97.4%
ov_SC02_035 2483 1751 0 2486 2520 98.7%
ov_SC02_039 2392 1751 0 2392 2416 99.0%
ov_SC02_041 2470 1751 0 2473 2561 96.6%
ov_SC03_001 2664 1752 0 2681 2869 93.4%
ov_SC03_002 2539 1756 0 2554 2631 97.1%
ov_SC03_003 2395 1751 0 2396 2423 98.9%
ov_SC03_006 2551 1758 0 2560 2767 92.5%
ov_SC03_007 2459 1751 0 2463 2623 93.9%
ov_SC03_010 2412 1751 0 2412 2471 97.6%
ov_SC03_011 2413 1751 0 2419 2527 95.7%
ov_SC03_012 2385 1751 0 2386 2406 99.2%
ov_SC03_013 2418 1751 0 2418 2493 97.0%
ov_SC03_014 2571 1782 0 2571 2685 95.8%
ov_SC03_015 2570 1782 0 2570 2685 95.7%
ov_SC03_023 2397 1751 0 2398 2435 98.5%
ov_SC03_024 2514 1756 0 2521 2641 95.5%
ov_SC03_028 2457 1752 0 2461 2664 92.4%
ov_SC03_029 2497 1754 0 2507 2644 94.8%
ov_SC03_030 2415 1756 0 2417 2495 96.9%
ov_SC03_031 2444 1751 0 2447 2514 97.3%
ov_SC03_089 2510 1756 0 2517 2581 97.5%
ov_SC03_090 2522 1756 0 2530 2625 96.4%
ov_SC03_091 2536 1751 0 2544 2640 96.4%
ov_SC03_092 2502 1756 0 2514 2587 97.2%
ov_SC03_093 2513 1751 0 2517 2563 98.2%
ov_SC03_094 2500 1751 0 2506 2577 97.2%
ov_SC03_095 2429 1751 0 2432 2474 98.3%
ov_SC03_096 2426 1751 0 2429 2465 98.5%
ov_SC03_097 2523 1751 0 2530 2603 97.2%
ov_SC03_098 2505 1751 0 2508 2541 98.7%
ov_SC03_099 2483 1751 0 2486 2504 99.3%
ov_SC03_100 2518 1751 0 2522 2539 99.3%
ov_SC03_101 2480 1756 0 2484 2528 98.3%
ov_SC03_102 2467 1751 0 2470 2492 99.1%
ov_SC03_103 2491 1753 0 2494 2510 99.4%
ov_SC03_104 2537 1756 0 2544 2616 97.2%
ov_SC03_105 2445 1752 0 2452 2597 94.4%
ov_SC03_108 2397 1751 0 2397 2443 98.1%
ov_SC03_109 2404 1751 0 2406 2424 99.3%
ov_SC03_110 2438 1751 0 2438 2468 98.8%
ov_SC03_111 2469 1751 0 2472 2510 98.5%
ov_SC03_112 2434 1753 0 2436 2526 96.4%
ov_SC03_113 2432 1753 0 2435 2468 98.7%
ov_SC03_114 2387 1751 0 2389 2415 98.9%
ov_SC03_115 2428 1751 0 2430 2472 98.3%
ov_SC03_116 2397 1751 0 2400 2438 98.4%
ov_SC03_117 2465 1751 0 2471 2557 96.6%
ov_SC03_118 2540 1776 0 2541 2685 94.6%
ov_SC03_119 2537 1776 0 2538 2685 94.5%
ov_SC03_121 2400 1751 0 2403 2459 97.7%
ov_SC03_124 2572 1747 0 2592 2741 94.6%
ov_SC03_125 2524 1751 0 2536 2588 98.0%
ov_SC03_126 2396 1753 0 2396 2423 98.9%
ov_SC04_000 2470 1755 0 2479 2546 97.4%
ov_SC04_002 2498 1751 0 2502 2636 94.9%
ov_SC04_003 2435 1751 0 2439 2502 97.5%
ov_SC04_004 2467 1751 0 2469 2558 96.5%
ov_SC04_005 2493 1751 0 2499 2612 95.7%
ov_SC04_006 2427 1751 0 2429 2454 99.0%
ov_SC04_007 2487 1751 0 2491 2569 97.0%
ov_SC04_008 2397 1751 0 2397 2415 99.3%
ov_SC04_009 2423 1751 0 2426 2441 99.4%
ov_SC04_010 2399 1751 0 2400 2419 99.2%
ov_SC04_011 2512 1756 0 2518 2803 89.8%
ov_SC04_012 2394 1751 0 2395 2420 99.0%
ov_SC04_015 2529 1752 0 2540 2611 97.3%
ov_SC04_016 2398 1751 0 2400 2440 98.4%
ov_SC04_018 2668 1788 0 2668 2857 93.4%
ov_SC04_019 2668 1788 0 2668 2857 93.4%
ov_SC04_020 2510 1751 0 2522 2567 98.2%
ov_SC04_021 2396 1753 0 2396 2423 98.9%
ov_SC05_000 2403 1755 0 2406 2422 99.3%
ov_SC05_001 2475 1751 0 2480 2574 96.3%
ov_SC05_002 2427 1751 0 2430 2442 99.5%
ov_SC05_003 2409 1751 0 2410 2481 97.1%
ov_SC05_004 2420 1751 0 2422 2464 98.3%
ov_SC05_005 2434 1756 0 2435 2491 97.8%
ov_SC05_006 2419 1751 0 2419 2430 99.5%
ov_SC05_007 2428 1751 0 2433 2482 98.0%
ov_SC05_008 2439 1751 0 2441 2543 96.0%
ov_SC05_009 2405 1751 0 2409 2438 98.8%
ov_SC05_010 2445 1752 0 2449 2588 94.6%
ov_SC05_011 2393 1751 0 2394 2409 99.4%
ov_SC05_017 2644 1748 0 2655 2842 93.4%
ov_SC05_018 2542 1751 0 2555 2673 95.6%
ov_SC05_019 2396 1753 0 2396 2423 98.9%
ov_SC06_000 2525 1760 0 2528 2691 93.9%
ov_SC06_006 2420 1751 0 2421 2511 96.4%
ov_SC06_008 2480 1753 0 2486 2542 97.8%
ov_SC06_010 2454 1751 0 2459 2517 97.7%
ov_SC06_011 2412 1751 0 2416 2468 97.9%
ov_SC06_013 2402 1751 0 2403 2425 99.1%
ov_SC06_014 2413 1751 0 2415 2453 98.5%
ov_SC06_015 2407 1751 0 2407 2421 99.4%
ov_SC06_016 2449 1752 0 2451 2549 96.2%
ov_SC06_018 2491 1753 0 2498 2665 93.7%
ov_SC06_020 2440 1753 0 2441 2518 96.9%
ov_SC06_022 2472 1751 0 2480 2642 93.9%
ov_SC06_024 2491 1751 0 2497 2667 93.6%
ov_SC06_025 2448 1751 0 2453 2572 95.4%
ov_SC06_027 2388 1751 0 2389 2408 99.2%
ov_SC06_029 2472 1752 0 2484 2662 93.3%
ov_SC06_030 2410 1752 0 2410 2456 98.1%
ov_SC06_032 2482 1752 0 2489 2658 93.6%
ov_SC06_033 2477 1752 0 2484 2631 94.4%
ov_SC07_000 2429 1755 0 2431 2521 96.4%
ov_SC07_001 2401 1751 0 2403 2454 97.9%
ov_SC07_002 2456 1752 0 2460 2579 95.4%
ov_SC07_006 2317 1575 0 2397 2455 97.6%
ov_SC07_007 2334 1607 0 2418 2612 92.6%
ov_SC07_008 2382 1751 0 2382 2386 99.8%
ov_SC07_009 2394 1751 0 2396 2430 98.6%
ov_SC07_010 2317 1628 0 2400 2523 95.1%
ov_SC07_011 2336 1606 0 2416 2448 98.7%