Repository navigation
Correct the AGENTS files, READMEs and pickle notes, and hold every pack to the layering rule - #1438
Merged
Merged
Conversation
…ck to the layering rule The 3.1 stale-prose sweep's section D. tests/v2/test_layering.py now checks every module in nameparser/locales/ by a default rule (the four base modules plus the pack's own private data module; a data module imports nothing), with a completeness check over locales/ like the pipeline's; until now 17 packs and _es_ar_given_names.py were checked by nothing. tools/stage_reads.py traces the Lexicon and Policy reads of each stage over the case table, which the release checklist's Reads: grep cannot see through aliases and helpers. compare.py's baseline moves to 3.0.1. The prose corrections are listed in the PR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
PR #1439 corrects classify's Reads: line, so the checklist describes the convention rather than quoting which fields that line excepts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tests The import walker recorded node.module alone, so a relative import was dropped or recorded as nothing: a pack writing `from .. import _parser` passed, and _suggest.py, which imports only relatively, was checked by nothing. It now resolves node.level against the module's package, with rows for each form, a planted pack violation and a reachability probe on _suggest.py; the contract finds no current violation with them resolved. The locales completeness check lists the folder through pkgutil rather than the glob the rule uses, and holds each module to its kind's rule. stage_reads' tests pin a read only the row's policy causes and that the traced fold assembles what Parser.parse gives. The release-log pickle bullet is trimmed to its index form, and an attribution naming a person in AGENTS.md is reworded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Section D of the 3.1 release checklist's stale-prose sweep (root AGENTS.md, step 0), measured on master f510237 and re-run on this branch. No parse behaviour changes: where prose and the tree disagreed, the prose now says what the tree does. The one change to code is the layering test, plus a new tool and its test.
The layering guard (fixed)
Root AGENTS.md said pack modules import
_locale/_lexicon/_policy/_typesonly, and thattests/v2/test_layering.pyenforces it. ButALLOWEDkeyed only four packs (ja,ru,tr_az,zh) and_es_given_names.py, so 17 packs and_es_ar_given_names.pywere checked by nothing. Now:_locale_rules()gives every file innameparser/locales/except__init__.pya default rule. A pack may import the four base modules plus its own private data modules. A data module belongs to the pack with the longest stem its name begins with, so_es_ar_given_namesbelongs toes_ar, notes. A data module imports nothing internal. No pack is keyed by hand.test_every_locales_module_is_checkedis thelocales/twin of the pipeline completeness check. It has a floor so that an empty glob cannot pass.To show the guard bites, I added
from nameparser._pipeline._vocab import is_initialtolocales/hr.py(a pack master's test never checked) in a scratch worktree. With the new test:With master's test, the same mutation gives
1 passed.Review round 1 (second commit)
node.modulealone, so it missed relative imports:from .. import _parserin a pack passed, and_suggest.py, which imports only relatively, was checked by nothing. It now resolvesnode.levelagainst the module's package. New tests cover each relative form, a planted pack violation and a probe that_suggest.pyyields its imports. With relative imports resolved there are 0 current violations, and_suggest.py's real imports all fit its existing row. The same mutation in a scratch worktree, appendingfrom .. import _parsertolocales/pt.py, now fails the contract.locales/completeness check now lists modules throughpkgutilrather than the rule's own glob, and holds each to its kind's rule.stage_readstests now pin a read that only the row's policy causes (post_rules→P.name_orderundertwo_family_names), and check that the traced fold assembles exactly whatParser.parsegives on six rows.Reads:convention without quoting classify's header, which Correct stale docstrings, comments and stage headers #1439 corrects.The
Reads:check (kept as a tool)The auditor's trace was sound. It wraps the parse's
Lexicon, its_setsand itsPolicyin proxies that record each attribute read, and charges each read to the stage that is running. Because it watches reads happen at runtime, it sees the reads that the checklist's grep cannot: reads through the 20sets = lexicon._setsaliases in_pipeline/, and reads through_vocab/_pieceshelpers. For example, assign reads the suffix sets throughis_suffix_lenient, and classify readshonorific_tailsandsaint_particles.I kept it as
tools/stage_reads.py(--stage NAMEfor one stage), with these changes from the draft:_comma.decide's recursion labelled onceIts limits are stated in its docstring: it cannot see a read that no case row reaches, and it charges a read made inside a
Lexiconmethod to that method.tests/v2/test_stage_reads_tool.pyloads it by path, astest_docs_scan_tool.pydoes, and pins:assign→L.suffix_words, which_assign.pynever spells)The checklist bullet now says what the grep misses and names the command. I took out its quote of classify's
Reads:line, which another sweep PR corrects.Findings (section D)
Lexicon(default + titles: +2)title: +2U.S. Grantgiven 'U.S.'_pipeline/module says so in its first line"_assemble/_commasay "Not a stage";_vocab/_pieces/_statename themselves helpers or state. Also fixed a stray parenthesis in the same sentence.hu.toml's familiar readings"zsuzsaagain ('hu' in tags()is False, so hu.toml is a shipped witness again); the sentence now says so.Reads:grep blind spotsDEFAULT_BASELINEset on master toocompare.pyDEFAULT_BASELINE = "3.0.0""3.0.1". No test pins the value; the README says "the last release" without a number.test_differential.py's "against 3.0.0" is a dated measurement and stays.TITLES ∩ particles_ambiguouslackingտերdict"bon/díkeep the generic particle kindparticlereading is left in any file)D.R. Judge Smithkeeps givenD.R.SOURCEShas 16. The fetched corpora'smeta.jsonrecords sum to 8,839,814, so the text now says "about 9 million", dated. The cache measures 12G, which still holds.local_uit,local_vnassembly,local_parliamentsParser().lexicon._sets). It now prints 5 of 17 markers and 13 of 28 tails. The prose said 8 of 15 tails; it now gives the new figures with the 2026-08-26 ones as history. "ships 17 entries" is now dated, andLexicon.maiden_markers(internal) is no longer named.LOCALE_FILES/NATIVE_LABELSlists shortcldr_agreement.pyMd.a title by shapelocales.NEis" (choice only)initials_as_family"surname2"filled by two_family_names only" (two places)locales.ZH, a Han surname pair fills it too (rules/W5); the snapshot and record are the default'sMARIA DE SAreadsSAas a credential--setflags_MIN_RUN_NAMES, as root AGENTS.md has it. The 0%-on-2026-11-15 figure is marked as measured with the first two (I did not re-run it). Also addedorcid-famcaps-eaand the per-population East Slavic /initials_as_familyoutput.spellinglocal_agreementbox list omits patentsview-inventorsFIELDED)Lexicon,Parser, pack orPolicydoes not load under 3.0.x) and a link to migrate's Pickles section, which holds the rest measured belowPickle measurements
The 3.0.1 wheel was run from a scratch dir with
PYTHONSAFEPATH=1 uv run --isolated --no-project --with 'nameparser==3.0.1'. The script asserts thatnameparser.__file__is outside the checkout; it was~/.cache/uv/archive-v0/.../site-packages/nameparser. The tree side asserts the reverse.3.0.1 pickles loaded by the tree:
(
Lexicon.default().add("محمـد", kind="given"))Tree pickles loaded by 3.0.1:
A 3.0.1
Parser()loaded in the tree, compared with a fresh one:Md. Rahim Uddin: title 'Md.' vs given 'Md.'นายสมชาย ใจดี: given 'นายสมชาย' vs title 'นาย', given 'สมชาย'Bill Smith/William Smith, accepting every outcome: inconsistent,conflictvs consistent,familiar-formlocales.NEreadsRam Bahadur B Kas middle 'Bahadur B', family 'K', against a fresh pack's family 'B K'.Examples in the changed AGENTS/README lines, run on this branch
Verification
uv run pytest: 49811 passed, 45 skipped, 3 xfailed (after round 1)uv run pytest -n0 -m serial: 38 passeduv run mypy,uv run ruff check: cleansphinx-build -b doctestand-b html: no outputtools/docs_scan.py migrate.rst: 0 findingsLeft for others (not my files)
nameparser/locales/__init__.py's docstring still says packs import "_locale/_lexicon/_policy/_types only", without the data module._reading_index.tags()'s docstring says "no shipped file has that shape at present". hu.toml now has that shape (one familiar reading only).🤖 Generated with Claude Code