Repository navigation
Correct stale docstrings, comments and stage headers - #1439
Merged
Merged
Conversation
Section B of the 3.1 release sweep: prose inside nameparser/ that no longer says what the tree does. No reading moves; the only executable text changed is two messages. - Messages: the after_particle refusal cites rules/P10 (the rule it names), not O7; the case-mask refusal offers the additive dataclasses.replace(..., (*lexicon.capitalization_exceptions, ...)) its two siblings offer, since the old one-pair tuple dropped every shipped mask when pasted. A new test runs the offered code. - Rendered docs: Parser.suggest's initials_as_family sentence (only a family-first base stands down), the zh pack's surname recipe (|, not add()), NameEvidence's comma clause, CONJUNCTION_OR_INITIAL's "not reported", Lexicon.words' example, Lexicon.add's parenthesis, and #: lines for every Outcome, Side and Signal member and the match, suggestion and LexiconReading fields, which the API page did not render. - Pipeline comments whose example no longer reads as stated, each replaced by one the tree gives. - Stage headers: Reads, Consumes, Produces, the classify tag list and Implements lines corrected against a runtime trace of each stage's reads over every case row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
derek73
added a commit
that referenced
this pull request
Nov 16, 2026
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]>
Review round on #1439: - starts_a_credential_run IS reached without a comma: run_start asks it of the piece in front of a kept one, peel_walk having left the merged Ph./D. piece out (#827). - check 4 (one suffix kind per word) runs in _lexicon._check_pool, not _make_edit. - a member settled by a word beside it is rules/S1's, and generation_words and honorific_words are the suffix words that do NOT settle one (extract, segment and post_rules headers). - group's PARTICLE_OR_GIVEN report is made only where the chained particle has nothing but leading titles in front of it. - the _VOCAB_FIELDS comment: given_names is 3.0's, and | concatenates the edit logs. - nits: a grammar slip in a test docstring, Lexicon.words' example no longer lists every spelling, a long line in Parser.suggest's docstring, and the new #: lines use the files' ``literal`` and :class: roles. Co-Authored-By: Claude Opus 5.5 <[email protected]>
derek73
added a commit
that referenced
this pull request
Nov 16, 2026
…ck to the layering rule (#1438) * Correct the AGENTS files, READMEs and pickle notes, and hold every pack 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]> * Describe the Reads: set convention without quoting classify's header 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]> * Read relative imports in the layering guard; tighten the stage_reads 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]> --------- 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 B of the 3.1 release sweep (root AGENTS.md, release checklist step 0): prose inside
nameparser/that no longer says what the tree does. Every finding was re-run onorigin/master(f510237) before it was edited, and every replacement example was run too (script and output below).No reading moves. The only executable text changed is two message strings. Stripping docstrings and comparing each changed module's AST with master gives identical trees for 17 of the 18 modules;
_lexicon.pydiffers only in those two strings.git diff --stat origin/master -- tools/differential nameparser/configis empty, sosnapshot.jsonlis byte-identical, and the frame guards pass.Findings and what was done
Rendered docstrings and messages
Parser.suggest:initials_as_family"not turned on under a base … folding every middle into the family"tests/v2/test_suggest.py~2400 pins the middle-fold case).docs/suggest.rstdoes not carry the wrong sentence: its "A base that reads names family first is suggested no change" is right.locales/zh.pyrecipeLexicon.default().add(surnames={...})raises TypeErrorLexicon.default() | Lexicon(surnames={...}), and run:玍明明reads family玍with it,玍明明whole without it.NameEvidence: "A name with a comma … casts none"Kim Minjun, PhD, the docs' own example)._lexicon.pyafter_particlerefusal cites rules/O7AmbiguityKind.CONJUNCTION_OR_INITIAL: "read as an initial and not reported"JOSE Eandjose e phdcarry anorderreport (rules/O4, #1254).Lexicon.wordsexample listsmd,mohd,mohmd,mohdandmohamong others, rather than a list that goes stale._MaskValueErrorofferscapitalization_exceptions=(('phd','PHD'),), which drops every shipped mask when pasteddataclasses.replace(lexicon, capitalization_exceptions=(*lexicon.capitalization_exceptions, (key, mask)))its two siblings offer. Updated the two tests that pinned the old text, which also type-check the pasted spelling. Newtest_the_mask_error_offers_code_that_adds_the_mask_and_keeps_the_restevals the offered code and checks that it adds the mask and keeps the rest.Outcome,Side,Signalmembers,CrossRoleMatch.left_role/right_role,MatchResult.left_alternative/right_alternative,LexiconReadingfields not rendered#:line per member and field, worded fromdocs/matching.rstanddocs/suggest.rst.LexiconReading's per-field prose moved out of its class docstring into the#:lines. The same family had more unrendered fields, now documented too: everyRoleMatch,CrossRoleMatchandMatchResultfield,SettingEvidence's four counts,by_signalandnote, andSuggestion.evidence/names.modules.htmlnow shows every one, and a full-EHTML build gives no warning._lexicon.pycomment over_VOCAB_FIELDS: "add()/remove() operate on exactly these"_render.initials: "First letter of each contributing token"_parser.pymodule docstring layering line_match,_suggestand_reading_indexas call-time imports.Lexicon.adddocstring: unbalanced ")" and a dangling clause afterspelling_ofPipeline comments whose example no longer reads as stated
_post_rules.pyR1 roles note:'Smith, MD nee Jones PhD'one entry'Smith, MD (nee Jones) PhD'(suffixMD PhD, maidenJones)._assign.pygiven-walk comment:'Andrews, M.D.''Smith, Dr. Jr.'still makes the point (v1 1.4.0: firstJr.)._assemble.py:'Hasan' in 'bin Ahmad Jr. Hasan, Ali''bin Ahmad III Hasan, Ali'(familybin Ahmad Hasan, suffixIII)._pieces.segment_suffix_reading:'Smith, A.B.' -> given 'A.B.''Smith, XYZ' -> given 'XYZ'(a shape word with one name word before the comma, solicensedstays empty)._pieces.py:'Pedro Junior fils' keeps family 'fils''Pedro Jnr fils', as decisions/S11 has it._pieces.py:'doe, jane v phd do' reads suffix 'v phd do''phd do'(middlev)._pieces.starts_a_credential_run:'John Smith Ph. D. Jones' still reads family 'Jones'run_startstarts the run behind the merged piece itself (#827), so it reads suffixPh. D. Jones._post_rules.pyM4 gap note:Dean of Chemistry née JonesDr. Mary and Jane(family) againstMary and Jane née Jones(givenMary and Jane)._assign.py:'Smith, John PhD I.'keeps suffix'PhD, I.''PhD I.'._vocab.py: "__post_init__'s gate_bypassed check"_lexicon._check_poolruns on a caller's reading too._pipeline/__init__.py: runners "arrive in 2.x minors"Stage headers
These were corrected against a runtime trace of each stage's
Lexicon/Policyreads over every case row (the auditor'strace.py, re-run on this tree), plus a call-stack trace naming the helper each read went through._tokenize: Consumes and Produces now say that it rewrites extract'sUNBALANCED_DELIMITERreports from a character offset to a token index. Implements gains N1 (the comma inside a clause)._extractReads: addshonorific_tails(throughperiod_joined_credential) andgeneration_words/honorific_words(throughsettles_a_member, as the suffix words that do not settle a member, rules/S1)._segmentReads: names the suffix-vocabulary sets it reads (generation_words,honorific_words,title_case_name_words,honorific_tails). Implements gains C10._classifyReads:surnamesandhonorific_tailsare read, throughin_any_wordlistandperiod_joined_credential. Addssaint_particles(throughglued_saint_cut). Tags emitted: addsvocab:dotted-title. The list is now split by what assemble actually drops (_assemble._KIND_TAGS), so it no longer claims thatvocab:title,vocab:particle-ambiguous,vocab:bound-givenorvocab:given-abbreviationare dropped; they are published._group: Produces adds thePARTICLE_OR_GIVENreport the particle chain makes where the chained particle has only leading titles in front of it (St van Johnson,Freiherr von der Berg;Vincent van GoghandDr. Van Johnsonreport nothing at group), checked by steppingSTAGES. The "group's own" line now names all four piece predicates. Implements gains P13 and C10._assign: Consumes addsextracted. Reads names the four suffix sets read throughis_suffix_lenient(_reads_as_a_trailing_suffix). Implements gains H9, H10, C9, P9, S8 and S12._post_rulesReads: addshonorific_tails,generation_wordsandhonorific_wordsto the S1 list. Implements gains P11, R10, R11 and W5's surname pair._match.pydocstring: adds_lexicon._fold,_formsandFULL_STOPSto its import list.Left alone, for the owner of
docs/design/to weigh (no rule file was edited here):implemented:footer. The footers name more modules than implement a rule, though: some modules only cite a rule where they ask its predicate. Footers naming a module whose header does not list the rule:_classify: C10, H2, H5, H8, H9, H10, P7, P8, P12, R8, R9, S1–S4, S9, S11, S12, T4. Classify has no Implements line at all._group: C2, H5, M3, S4, S10, S12._assign: A1, C1, C2, P2, P3, P11, S5, S6, S9._post_rules: P2, P3, P5, P12, R2, R3._script_segment's header says it readsconjunctionsDIRECTLY; the trace saw no such read over the case rows._assign's header listsgiven_name_titles(the alternative's P5 licence); the trace saw no read there either.Verification
uv run pytest: 49,788 passed, 45 skipped, 3 xfailed.uv run pytest -n0 -m serial: 38 passed, 49836 deselected in 63.85s (0:01:03).uv run mypy: no issues in 166 files.uv run ruff check: clean.sphinx-build -E -b html: no warnings.sphinx-build -E -b doctest: 1317 tests, 0 failures.git diff --stat origin/master -- tools/differential nameparser/config: empty.Every example reading a changed comment or docstring states:
Review round 1 (6ddccc1): five rewritten sentences corrected for mechanism (
starts_a_credential_runis reached without a comma, throughrun_start, #827; check 4 runs in_check_pool; a member settled beside it is rules/S1's, andgeneration_words/honorific_wordsare the words that do not settle one; group's report is narrowed to a particle with only leading titles in front;_VOCAB_FIELDSnamesgiven_namesas 3.0's and|concatenating the edit logs), plus nits. Re-checked: AST identical but the two messages, snapshot, citation, lexicon and pipeline tests, mypy, ruff, html build.🤖 Generated with Claude Code