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

Open
opened 2026-11-26 21:21:04 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2384
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/awc-names-family-suffix-number


📝 Commits (1)

  • 762b141 awc_names: number family members by their suffix (AWC-NAMES-FAMILY-SUFFIX-NUMBER)

📊 Changes

2 files changed (+18 additions, -2 deletions)

View changed files

📝 tests/test_awc_names.py (+13 -0)
📝 tools/awc_names.py (+5 -2)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2384 **Author:** [@syfyra](https://github.com/syfyra) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/awc-names-family-suffix-number` --- ### 📝 Commits (1) - [`762b141`](https://github.com/ubiquitarianism/leonida/commit/762b141795c1d12e0d87f4c5c2c28c2b7783397d) awc_names: number family members by their suffix (AWC-NAMES-FAMILY-SUFFIX-NUMBER) ### 📊 Changes **2 files changed** (+18 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_awc_names.py` (+13 -0) 📝 `tools/awc_names.py` (+5 -2) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2388
No description provided.