Skip to content

Count the particle chain's units in S2's read instead of merging a copy (#620) - #622

Merged
derek73 merged 4 commits into
masterfrom
feat/issue-620-count-units
Oct 9, 2026
Merged

derek73 merged 4 commits into
masterfrom
feat/issue-620-count-units

Conversation

@derek73

@derek73 derek73 commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Refs #620. It doesn't close it: the two related paths #620 names (reading a family comma's given part the same way, and deciding the name's start once for a title-particle head) move readings and are left for a follow-up, as scoped.

What changed

#614 read S2's trailing run once, ahead of the particle chain, through a merged copy of the pieces. That copy was a second statement of P2's chain with its own stop list, and its reviews found three defects that came from it: an index applied across two layouts, a title hidden inside a credential run, and a numeral folded into a unit. Each was patched inside the copy.

Now nothing is merged:

What moves

Measured against master as merged (4278693), py3.11, nameparser.__file__ asserted, with the harnesses and recipe in decisions.md#S2:

Population Moved
Fingerprint (every corpus and case name × 6 policies) 0
Connective grid (485,300 parses) 0
S2 stress grid (324,552 parses) 12: three garbage names × 4 policies, none in the head-plus-one-word slice

The three names:

All five differential gates exit 0. Frames are unchanged (308 on 3.11, 289 on 3.12–3.15). The 3.12–3.15 pin was stale at 290 since #614's /simplify and is corrected here.

Found along the way

Review history

  • Prototype: marked every word the chain reaches as JOINED, by the chain's rule alone.
  • Review: that dropped positional counting's rule that a member in front counts as a word. Freiherr von Berg MA X.Y.Z. lost its suffix, and St St VI and Freiherr St MA read the numeral or acronym as the whole family. The merged copy's exclusion list had been keeping that rule. Fixed by _weighed; AGENTS.md records the lesson (an exclusion list being replaced is a set of rules).
  • /simplify: the quadratic above, the walk's wider stop, the gathering reads the BOUND marks, run_start's two branches made one, and _weighed pinned to the read by an invariant (no JOINED piece is ever in the run the read takes; 320 grid names fail without it).

Docs

decisions.md#S2 (#620 entry) and the parse-cost bullet; rules.md#S2 and P2's implemented:; mechanisms.md UNIT-PARTITION and READ-WITHOUT-THEN-BIND; AGENTS.md.

Test plan

  • uv run pytest (11,864 passed)
  • uv run mypy, uv run ruff check
  • Five differential gates exit 0
  • Fingerprint, connective and S2 grids measured against both masters; /simplify left them byte-identical
  • Every new branch killed by a recorded mutation, including the review's six test gaps

🤖 Generated with Claude Code

derek73 and others added 4 commits October 8, 2026 00:36
… prototype)

The trailing read marks each piece by the unit P2's chain will put it
in (_chain_units: opens, joined, bound) and the peel counts words to
spare, #602's run start and tail_reading's resume in those units. The
chain and the read share chain_run_end. The merged counting view, its
exclusion list, its view index and its credential-run gate are gone.
Docs to follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- run_start counts in the chain's units too: a particle opening a run
  counts once, its bound particle and joined words not at all ('John
  der la Jr. Prof. Smith' keeps #602's run; 'van la Smith Secretary
  Jr. Dr. Smith' starts none, as before #614).
- credential_run gathers adjacent particles on the read's path into
  the one piece the chain makes of them, so an absorbed run reports
  as before #614 ('Mc Mc'); M2's view still reports word by word.
- The numeral fork keeps reading the piece in front as written
  (rules.md#P2's 'John van der J. V'); 'John van B and Smith X' is
  back to 0c54662's reading.
- tail_reading's resume test needs no units clause: fuzzed over
  372,330 names, none differs; the reason is in the comment.
- Eight rows #614 labelled `parity` did not match 1.4.0; relabelled by
  bisect. Three new rows, two unit-mark tests, a report-token test;
  every new branch killed by a recorded mutation.
- Docs: rules.md#S2 (run start) and P2's implemented line,
  decisions.md#S2 (#620 entry) and parse-cost, mechanisms.md
  UNIT-PARTITION and READ-WITHOUT-THEN-BIND, AGENTS.md (parity means
  1.4.0). Pins: 307/344 on 3.11, 288/325 on 3.12-3.15.

Measured against 4278693: fingerprint 0, connective grid 20 (all back
to the pre-#614 reading), S2 grid 640 (508 back, 128 Freiherr-chain
acronyms by the two-name-words invariant, 4 one garbage name).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The review found the first count wrong where both masters were right:
marking every word the chain reaches JOINED let a member the chain
would join count as no word in front of the next ('Freiherr von Berg
MA X.Y.Z.' kept 'MA X.Y.Z.' in the family), and let a unit made only
of words the read then takes move the name's start into the titles
('St St VI', 'Freiherr St MA' read the numeral or acronym as the whole
family, unreported).

- _weighed: a word the trailing read weighs (suffix word, ambiguous
  class, by-shape member, initial, roman numeral by shape, period-
  marked title) keeps a unit of its own, as a position counted it;
  only plain words behind a particle run are JOINED, and a unit with
  nothing past its opener moves no name start.
- Against master as merged: fingerprint 0, connective grid 0, S2 grid
  12 (three garbage names). Frames equal master's; the 3.12-3.15 pin
  is corrected to 289/326, stale since #614's /simplify.
- Rows for the review's regressions and for its six test gaps (a title
  spliced off before the unit count, a P3-joined particle phrase), two
  report-token asserts, killers for each _weighed arm; every new
  branch dies under a recorded mutation.
- Docs rewritten for the redesign: decisions.md#S2's #620 entry and
  parse-cost, rules.md#S2, mechanisms.md (numeral fork reads as
  written; the copy's defects were patched, not live), the anchor
  comment, AGENTS.md (an exclusion list being replaced carries rules).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
/simplify pass, behavior-preserving: the suite, the five gates and
the fingerprint, connective and S2 grids (byte-identical) unchanged;
frames unchanged (308 on 3.11, 289 on 3.12).

- tail_reading looks up where the second unit opens once and hands it
  to every peel pass. Each pass had rescanned from the front, a
  C-level quadratic behind a long joined surname (5.77x for 4x the
  input against master's 4.08x, now 4.03x) that no frame guard saw;
  test_the_second_unit_is_found_once_per_read counts the lookups.
- The peel stops at any piece the chain joins into a run, not only a
  bound particle: a joined word the reading does not weigh was going
  to break the walk anyway, after the suffix test's frames.
- credential_run gathers an absorbed particle run off the BOUND marks
  instead of re-testing particles and adjacency; run_start's two
  counting branches are one condition.
- _weighed is pinned to the reading: no piece marked JOINED is ever in
  the run the read takes (negative control: 320 grid names).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73 derek73 added this to the 2.4 milestone Oct 8, 2026
@derek73 derek73 self-assigned this Oct 8, 2026
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.01%. Comparing base (4278693) to head (b94f1ba).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #622      +/-   ##
==========================================
+ Coverage   98.99%   99.01%   +0.02%     
==========================================
  Files          46       46              
  Lines        4468     4481      +13     
==========================================
+ Hits         4423     4437      +14     
+ Misses         45       44       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@derek73
derek73 merged commit 26cdb89 into master Oct 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant