fix(re-capture): name_block_bases reads the disc from $SYLPHEED_DISC, loudly
All checks were successful
CI / Native — linux (pull_request) Successful in 2h3m46s
CI / WASM — Web (pull_request) Successful in 28m6s
CI / Formatting (pull_request) Successful in 1m19s

Its data-table section globbed `/work/sylph_extract/**/*.pak`, a path that has
existed nowhere since `/work` became a clone. The glob matched nothing, so the
section reported "0 disc names" and an empty table with no error — while the
committed `docs/re/data/name-block-bases.txt`, generated back when the path
existed, records 13 450. The disc is required for that section, so a missing or
non-disc `$SYLPHEED_DISC` is now an error (exit 1), not an empty result.

Verified: without the disc, exit 1 with the message; with
`SYLPHEED_DISC=…/sylph_extract` (the original /work/sylph_extract), the section
reproduces the committed figures exactly — 13 450 distinct disc names,
50 / 261 data-table rows, `sub_82341A20 r30 0x82088F94 217 names 89% disc`.

⚠️ The artefact itself is deliberately NOT regenerated. Rebuilt from the current
database it changes findings — solved bases move, three 15/15 rows vanish, −280
lines — and the cause is the database, not this script: the string extractor's
Shift-JIS path requires kana, so kanji-only Japanese (e.g. the allocator's
`32B  未開放 %4d : 最大…使用量 %4d / %4d` debug lines) is not in `strings`, and
the bases those names pinned no longer resolve (sub_8285F2C8 r5 @ 0x820AE7AC:
15/15 before, 7 now). Regenerating would bake that regression into a cited
research artefact (`docs/re/structures/player-tuning-tables.md`).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
sim
2026-09-16 21:08:55 +02:00
parent c082d72bdc
commit 4b022ca03b

View File

@@ -194,7 +194,19 @@ def main():
from unit_substructures import pak_entries
import unitgroup as _U
disc = set()
for pk in sorted(glob.glob('/work/sylph_extract/**/*.pak', recursive=True)):
# 🔴 This globbed `/work/sylph_extract/**/*.pak`, a path that exists nowhere
# since `/work` became a clone. The glob matched nothing, so this section
# reported `0` disc names and an empty table WITHOUT an error — while the
# committed artefact, generated back when the path existed, shows 13 450.
# The disc is required for this section, so a missing disc is an error.
disc_root = os.environ.get('SYLPHEED_DISC')
if not disc_root or not os.path.isdir(os.path.join(disc_root, 'dat')):
sys.exit('this report needs the disc: set $SYLPHEED_DISC to an extracted '
'disc root (the directory holding dat/)')
paks = sorted(glob.glob(os.path.join(disc_root, '**', '*.pak'), recursive=True))
if not paks:
sys.exit(f'no .pak files under $SYLPHEED_DISC={disc_root}')
for pk in paks:
for _h, b in pak_entries(pk):
if b[:4] != b'IDXD':
continue