awc_names: number family members by their suffix (AWC-NAMES-FAMILY-SUFFIX-NUMBER) #2384

Merged
syfyra merged 1 commit from upstream-pr/2384 into main 2026-12-01 15:21:48 +00:00
syfyra commented 2026-11-26 16:46:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-26T16:46:19Z.


Claimed in the coordination issue as: AWC-NAMES-FAMILY-SUFFIX-NUMBER (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198059484)

What and why

tools/awc_names.py names AWC bank ids by dictionary attack. A family is a base whose numbered suffixes ('', _00 .. _40, _1 .. _9) hit ids in one bank. The module docstring and docs/audio.md require "at least 3 members, or 2 with adjacent numbers", because chance hits rarely land on adjacent numbers.

family_ok read each member's number from the whole name (FAMILY_NUMBER on salt + base + suffix). When the base itself ends in a digit, its unsuffixed member got a number too:

members in one bank family_ok on main expected
horn + horn_02 rejected (one numbered member) rejected
amb_1 + amb_1_02 accepted (reads 1 and 2 as adjacent) rejected: same shape

Dictionary bases can end in a digit token (wordy accepts digit tokens), so such a pair could be reported as a named family on chance hits. The salted control run that sizes the family rule does not catch it, because the control uses the same reading.

_attack_split now hands family_ok the members' suffixes (name[len(salt) + len(base):]), so a digit that belongs to the base never counts as a member number. Bases without a trailing digit are unaffected, and family_ok's own behaviour on full names (its existing test) is unchanged.

Different topic from #780 (write mode on replace, same files); the two merge cleanly.

Tested

Windows 11, Python 3.14.7, synthetic dictionary and ids only:

  • python -I tests/test_awc_names.py: 37 tests OK. New test_a_digit_that_ends_the_base_is_not_a_member_number:
    • amb_1 + amb_1_02 and horn + horn_02 in one bank are both rejected; on main the first is accepted and the test fails.
    • amb_1_01 + amb_1_02 (adjacent suffixes) and amb_1 + amb_1_02 + amb_1_05 (three members) are still accepted.
  • python -m compileall; scripts/check_no_game_data.py on both files.

Not changed here: docs/audio.md line 329 says that when two accepted families claim one id, "the first family in sorted base order keeps it", while the code has kept the larger family since 58a981e25. That is a separate doc fix.

GPUs tested: n/a (CPU-only tool)

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5513926417 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384). Originally posted by [syfyra](https://github.com/syfyra) on 2026-11-26T16:46:19Z. --- Claimed in the coordination issue as: AWC-NAMES-FAMILY-SUFFIX-NUMBER (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7198059484) ### What and why `tools/awc_names.py` names AWC bank ids by dictionary attack. A **family** is a base whose numbered suffixes (`''`, `_00` .. `_40`, `_1` .. `_9`) hit ids in one bank. The module docstring and `docs/audio.md` require "at least 3 members, or 2 with adjacent numbers", because chance hits rarely land on adjacent numbers. `family_ok` read each member's number from the **whole** name (`FAMILY_NUMBER` on `salt + base + suffix`). When the base itself ends in a digit, its unsuffixed member got a number too: | members in one bank | `family_ok` on `main` | expected | |---|---|---| | `horn` + `horn_02` | rejected (one numbered member) | rejected | | `amb_1` + `amb_1_02` | **accepted** (reads 1 and 2 as adjacent) | rejected: same shape | Dictionary bases can end in a digit token (`wordy` accepts digit tokens), so such a pair could be reported as a named family on chance hits. The salted control run that sizes the family rule does not catch it, because the control uses the same reading. `_attack_split` now hands `family_ok` the members' suffixes (`name[len(salt) + len(base):]`), so a digit that belongs to the base never counts as a member number. Bases without a trailing digit are unaffected, and `family_ok`'s own behaviour on full names (its existing test) is unchanged. Different topic from #780 (write mode on replace, same files); the two merge cleanly. ### Tested Windows 11, Python 3.14.7, synthetic dictionary and ids only: - `python -I tests/test_awc_names.py`: 37 tests OK. New `test_a_digit_that_ends_the_base_is_not_a_member_number`: - `amb_1` + `amb_1_02` and `horn` + `horn_02` in one bank are both rejected; on `main` the first is accepted and the test fails. - `amb_1_01` + `amb_1_02` (adjacent suffixes) and `amb_1` + `amb_1_02` + `amb_1_05` (three members) are still accepted. - `python -m compileall`; `scripts/check_no_game_data.py` on both files. Not changed here: `docs/audio.md` line 329 says that when two accepted families claim one id, "the first family in sorted base order keeps it", while the code has kept the larger family since 58a981e25. That is a separate doc fix. GPUs tested: n/a (CPU-only tool) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MSedgeMC commented 2026-11-26 17:28:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-26T17:28:36Z.

Review: COMMENTED


Verified on the PR branch: python3 -m unittest tests.test_awc_names -v -> 37 tests OK (1 skip), including the new case that a digit ending a base ('amb_1') is not counted as a member suffix. The change scopes family_ok to n[len(salt)+len(base):] so only real suffixes are numbered; direct test evidence supports it. However this branch carries 522 commits not on current main, so I am not approving until it is rebased onto main — merging as-is would drag in a large unrelated history. Please rebase and re-run the suite.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6078372811 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384#pullrequestreview-6078372811). Originally posted by [MSedgeMC](https://github.com/MSedgeMC) on 2026-11-26T17:28:36Z. **Review:** COMMENTED --- Verified on the PR branch: python3 -m unittest tests.test_awc_names -v -> 37 tests OK (1 skip), including the new case that a digit ending a base ('amb_1') is not counted as a member suffix. The change scopes family_ok to n[len(salt)+len(base):] so only real suffixes are numbered; direct test evidence supports it. However this branch carries 522 commits not on current main, so I am not approving until it is rebased onto main — merging as-is would drag in a large unrelated history. Please rebase and re-run the suite.
wavehs commented 2026-11-26 18:40:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:40:01Z.

Review: COMMENTED


macOS arm64 check of #2384 (AWC-NAMES-FAMILY-SUFFIX-NUMBER). A tools-only name-classifier change.

Tested head 762b14179 with its diff applied to a copy of main bdbc7e923 (branch 10 commits behind; clean).

Environment: Apple M3 Pro, arm64, macOS 27.2.1, CPython 3.15.2.

Result

  • python -I tests/test_awc_names.py: 37 tests, OK (skipped=1).
  • Negative control (new test kept, tools/awc_names.py put back to main's): 1 failure, test_a_digit_that_ends_the_base_is_not_a_member_number [amb_1] - main builds an amb_1 + amb_1_02 family, the change does not.
  • python -I scripts/run_semantic_tests.py tests/semantic: 500 files / 6,367 tests / 0 failed, same as main.

Review

  • Slicing each member name at len(salt) + len(base) is safe because _attack_split builds the members of (bank, base) as salt + base + suffix itself; the suffix is what family_ok is meant to number, and it now matches the behaviour for bases that do not end in a digit (horn + horn_02).
  • The unsuffixed member of a digit-ending base now yields "", which family_ok already treats as "no number", so amb_1 + amb_1_02 is not a family; amb_1_01 + amb_1_02 and the three-member amb_1 + amb_1_02 + amb_1_05 cases still are, and the test checks both directions.
  • A name that matches two bases (amb and amb_1) lands in two family buckets with different suffixes ("_1_02" vs "_02"), so the more specific base still gets the right numbering; the test's horn case covers the shared-prefix direction.

I found no bug in the change.

python -I scripts/check_no_game_data.py on both changed files: clean.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6079087696 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384#pullrequestreview-6079087696). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T18:40:01Z. **Review:** COMMENTED --- **macOS arm64 check of #2384** (AWC-NAMES-FAMILY-SUFFIX-NUMBER). A tools-only name-classifier change. Tested head `762b14179` with its diff applied to a copy of `main` `bdbc7e923` (branch 10 commits behind; clean). Environment: Apple M3 Pro, arm64, macOS 27.2.1, CPython 3.15.2. **Result** - `python -I tests/test_awc_names.py`: 37 tests, OK (skipped=1). - Negative control (new test kept, `tools/awc_names.py` put back to `main`'s): 1 failure, `test_a_digit_that_ends_the_base_is_not_a_member_number [amb_1]` - `main` builds an `amb_1` + `amb_1_02` family, the change does not. - `python -I scripts/run_semantic_tests.py tests/semantic`: 500 files / 6,367 tests / 0 failed, same as `main`. **Review** - Slicing each member name at `len(salt) + len(base)` is safe because `_attack_split` builds the members of `(bank, base)` as `salt + base + suffix` itself; the suffix is what `family_ok` is meant to number, and it now matches the behaviour for bases that do not end in a digit (`horn` + `horn_02`). - The unsuffixed member of a digit-ending base now yields `""`, which `family_ok` already treats as "no number", so `amb_1` + `amb_1_02` is not a family; `amb_1_01` + `amb_1_02` and the three-member `amb_1` + `amb_1_02` + `amb_1_05` cases still are, and the test checks both directions. - A name that matches two bases (`amb` and `amb_1`) lands in two family buckets with different suffixes (`"_1_02"` vs `"_02"`), so the more specific base still gets the right numbering; the test's `horn` case covers the shared-prefix direction. I found no bug in the change. `python -I scripts/check_no_game_data.py` on both changed files: clean. No game files. AI-assisted.
imShangLi commented 2026-12-01 04:16:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-01T04:16:39Z.


VERIFY-2384 — Linux, Python 3.15, CPU only, no game files

Claimed as VERIFY-2384 (+13/-0 test, +5/-2 tool). Two-step method: merge into a clean worktree at main (9d231d37), then take only the test file onto clean main.

tree python -I tests/test_awc_names.py
main test_awc_names.py baseline green
main + this pull request PASS
main + only this pull request's test file FAIL (assertion)

The failure on the last row is an AssertionError, not an import or attribute error, so the test is exercising the changed code rather than merely failing to load it. Reverse control holds: the change is what turns it green.

Verified. Nothing found against it; merges cleanly with main at 9d231d37.

AI-assisted: yes — MiMo-V2.6-Flash (OpenCode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7300563161 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384#issuecomment-7300563161). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-01T04:16:39Z. --- ### VERIFY-2384 — Linux, Python 3.15, CPU only, no game files Claimed as `VERIFY-2384` (+13/-0 test, +5/-2 tool). Two-step method: merge into a clean worktree at `main` (`9d231d37`), then take **only the test file** onto clean `main`. | tree | `python -I tests/test_awc_names.py` | |---|---| | `main` | test_awc_names.py baseline green | | `main` + this pull request | **PASS** | | `main` + only this pull request's test file | **FAIL (assertion)** | The failure on the last row is an `AssertionError`, not an import or attribute error, so the test is exercising the changed code rather than merely failing to load it. Reverse control holds: the change is what turns it green. **Verified.** Nothing found against it; merges cleanly with `main` at `9d231d37`. AI-assisted: yes — MiMo-V2.6-Flash (OpenCode).
aslan2142 commented 2026-12-01 12:03:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:03:32Z.

Review: COMMENTED


Draft review against current main: slicing n[len(salt) + len(base):] so trailing base digits are not mistaken for family member numbers in tools/awc_names.py:297-302 looks clean and clean-room verified. Still Draft with no CI run yet — please mark Ready for Review so CI runs green.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130902197 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384#pullrequestreview-6130902197). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:03:32Z. **Review:** COMMENTED --- Draft review against current `main`: slicing `n[len(salt) + len(base):]` so trailing base digits are not mistaken for family member numbers in `tools/awc_names.py:297-302` looks clean and clean-room verified. Still Draft with no CI run yet — please mark Ready for Review so CI runs green. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:34:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:34:50Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7311344807 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384#issuecomment-7311344807). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:34:50Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 13:06:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T13:06:54Z.

Review: APPROVED


Now ready for review and MERGEABLE (1 commit). Clean-room verified: scoping family member numbering to the post-base suffix in tools/awc_names.py:297-302 with tests in tests/test_awc_names.py is clean and verified (@wavehs, @imShangLi, @MSedgeMC).

Approving — ready to merge once CI runs green on current main.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6131838211 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2384#pullrequestreview-6131838211). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T13:06:54Z. **Review:** APPROVED --- Now ready for review and `MERGEABLE` (1 commit). Clean-room verified: scoping family member numbering to the post-base suffix in `tools/awc_names.py:297-302` with tests in `tests/test_awc_names.py` is clean and verified (`@wavehs`, `@imShangLi`, `@MSedgeMC`). Approving — ready to merge once CI runs green on current `main`. *(AI-assisted review.)*
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2384
No description provided.