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

Open
github-bot wants to merge 1 commit from github-bot/gh-2384 into main AGit
Owner

@⁠syfyra on GitHub · 2026-11-26 16:46 UTC · original
syfyra:fix/awc-names-family-suffix-number → main · +18 −2 · 2 files · 1 commits · draft

Claimed in the coordination issue as: AWC-NAMES-FAMILY-SUFFIX-NUMBER (#1608)

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

**@⁠syfyra** on GitHub · 2026-11-26 16:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2384) `syfyra:fix/awc-names-family-suffix-number` → `main` · +18 −2 · 2 files · 1 commits · draft Claimed in the coordination issue as: AWC-NAMES-FAMILY-SUFFIX-NUMBER (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### 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)
A family is a base whose numbered suffixes hit ids in one bank: at
least 3 members, or 2 with adjacent numbers (docs/audio.md, the module
docstring). family_ok took each member's trailing number from the whole
name, so when the base itself ends in a digit its unsuffixed member got
a number too: amb_1 + amb_1_02 counted as the adjacent pair 1/2 and was
accepted, while the same shape on a base without a digit (horn +
horn_02) is rejected. Dictionary bases can end in a digit token.

Pass family_ok the members' suffixes, so the base's own digits never
count.

Tested: new test_a_digit_that_ends_the_base_is_not_a_member_number
(fails before for amb_1; two adjacent suffixes and three members on the
same base are still families).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:46:52 +00:00
Author
Owner

@⁠MSedgeMC on GitHub · 2026-11-26 17:28 UTC · original · reviewed

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.

**@⁠MSedgeMC** on GitHub · 2026-11-26 17:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2384#pullrequestreview-6078372811) · **reviewed** 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.
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 18:40 UTC · original · reviewed

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.

**@⁠wavehs** on GitHub · 2026-11-26 18:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2384#pullrequestreview-6079087696) · **reviewed** **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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2384/head:github-bot/gh-2384'
git switch 'github-bot/gh-2384'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2384'
git switch 'github-bot/gh-2384'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2384'
git switch 'github-bot/gh-2384'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2384'
git switch 'main'
git merge --squash 'github-bot/gh-2384'
git switch 'main'
git merge --ff-only 'github-bot/gh-2384'
git switch 'main'
git merge 'github-bot/gh-2384'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.