Skip to content

Merge the tail's particle runs before S2's read (#625) - #634

Merged
derek73 merged 3 commits into
masterfrom
feat/issue-625-merge-tail-particles
Oct 11, 2026
Merged

derek73 merged 3 commits into
masterfrom
feat/issue-625-merge-tail-particles

Conversation

@derek73

@derek73 derek73 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Since #614, S2's trailing run is read before P2's particle chain runs, so the read sees particles the chain hasn't merged yet. #620 made up for that in the reader:

  • _chain_units marked a particle standing straight behind another as BOUND, and the peel stopped at it.
  • credential_run gathered an absorbed run of those particles into one report.

Now group merges each run of two or more adjacent particles past the chain's leading position into one piece. It does this at the trailing site, after P3's connective joins and before the read (_pieces.merge_particle_runs). The read counts, stops at and absorbs the run as the one piece the chain makes, so the BOUND mark, its peel stop and the gathering are gone.

Two details the measurements forced:

  • The merged piece keeps prefix and drops title. A P3 join can carry the title tag in from a word that is both a title and a particle (St und Berg). On a merged run that tag made the whole run read as a leading title.
  • The chain's PARTICLE_OR_GIVEN report needed a new trigger. It keyed on the chain taking something past the particle (j > k + 1). A merged run has already done that, so the chain claims nothing more (Freiherr von der).
    • The report now also fires on runs the merge made (premerged).
    • Keying instead on "the piece holds several tokens" also catches P3-joined phrases (Dr. St Do und), and moved 11,358 reports on the grid below.

The title run's end and the chain's lead are read once, before the merge, and handed to the read, which used to ask for both again.

The rule text is unchanged: rules.md#S2 already counts a particle run as the one name word the chain makes, duals straight behind a particle included. The code grows by about 45 lines, docstrings included; what shrinks is the number of mechanisms. The read loses a mark and two branches and re-creates nothing of the chain; group gains the merge.

Measured (against 505d6de, py3.11, import asserted on each side; recipes in decisions.md#S2)

  • Particle-run grid (395,148 texts, 1,185,444 parses over three orders, all seven fields and every report): 774 role moves and no report-only moves.
    • Every move contains St und. Master read Freiherr Do St und Berg MA as title 'Freiherr Do St und Berg', family 'MA'.
    • It now reads title 'Freiherr', family 'Do St und Berg', suffix 'MA', so the name part reads the same with and without the trailing 'MA'.
    • This is not a released reading. 1.4.0 reads first 'Do St und Berg', last 'MA', and 2.3.0 reads family 'Do St und Berg MA'. Over the 258 moved texts under the default order, master matches 2.3.0's full reading on 152 and the tree on none.
  • S2 stress grid: no role moves, and one text's report changes under all four of its configurations.
  • No change on Where does Freiherr St John Smith MA start: should a title that is also a particle open the name? #624's title-particle head grid, the corpus names and case texts, or Where does Freiherr St John Smith MA start: should a title that is also a particle open the name? #624's comma-tail grid.
  • Five differential gates: all exit 0, with reports identical line for line to master's.
  • The issue's 2026-10-08 figure (80 moves, Dr. mc mc) no longer applies: Where does Freiherr St John Smith MA start: should a title that is also a particle open the name? #624 already reads Dr. Mc Mc with suffix 'Mc Mc'.
  • The review found more reach. It is all garbage input and gets no rows (Derek's call). No move went the other way. The classes are recorded in decisions.md#S2:
    • The St und class is any P3 join whose left word is both a title and a particle. Example: Freiherr Do Freiherr and Berg MA.
    • A mid-name title and a dotted word after a particle run. Example: Freiherr van der Dr. G.J. MA now reads family 'van der Dr. G.J.', suffix 'MA'. That matches how Freiherr van Dr. G.J. MA already reads.
    • H3's title give-back before a run of dual particles. Example: Dr. vd Jr. mc mc now keeps title 'Dr.' where master handed it back as the given name.
  • Frames: +3 on the reference row, which contains de la, and +1 on any name of three or more words read at the trailing site. Baselines are now 307 on 3.11 and 288 on 3.12–3.15 (decisions.md#parse-cost).

Tests

  • test_a_merged_particle_run_is_a_particle_and_no_title (new): checks the merged piece's tags, and that the name's leading particle stays out of the merge (P4).
  • _chain_units and read helpers in test_pieces.py: now merge first, as group does. The marks test reads van mc as one piece.
  • test_the_read_takes_the_title_run_as_written_before_the_merge (new, from the review): Dr. mc Jr mc mc.
  • New rows two_particle_runs_merge_each and a_second_run_of_duals_is_the_family (parity, from the review): two particle runs in one name. An off-by-one in the merge's bookkeeping had passed the whole suite; these rows catch it. The merge's unit test gains the same two-run half.
  • Negative controls (recorded in decisions.md), each guard removed in turn:
Guard removed Tests that fail
The merge itself 30 in tests/v2 (32 over the whole suite)
The premerged report trigger 2 case rows
Starting the merge past the lead (starts at the second piece instead) 13
Dropping title from the merged piece only the new unit test
Reading the title run again after the merge, in the read or in group the new read test (its parse assertion holds group's half)

Review

  • 647e6c7: fixes the review's findings. It adds the two-run tests and the pre-merge title-run test, removes the false parity claim, corrects the grid size, records the extra move classes, and updates a stale case note.

  • Review of the fix commit: corrects the merge-off control count, adds a parse assertion so the read test holds group's half too, and fixes a docstring word, the P3-join class's connectives and a row note.

Docs

Closes #625

🤖 Generated with Claude Code

Group merges each run of two or more adjacent particles past the
chain's leading position into one piece (`_pieces.merge_particle_runs`)
at the trailing site, after P3's joins and before the read. The read
then counts, stops at and absorbs the run as the one piece the chain
makes, so `_chain_units` loses its BOUND mark, the peel its stop for it,
and `credential_run` its gathering of absorbed particles.

The merged piece keeps `prefix` and drops `title`, which a P3 join can
carry in ('St und Berg'). The chain's PARTICLE_OR_GIVEN report keys on
its run claiming past the particle or on the run being one the merge
made. The title run and the lead are read once and handed to the read.

Measured against 505d6de: 774 role moves on a 137,810-name particle
grid, all `St und` shapes master read as titles, now the family the
1.4.0 and 2.3.0 wheels read; one S2-grid text loses the 'do' report
#620 added; every other grid, the corpora and the five gates unchanged.
Frames +3 on the reference row (decisions.md#parse-cost).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 self-assigned this Oct 11, 2026
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.02%. Comparing base (505d6de) to head (9bf225d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #634   +/-   ##
=======================================
  Coverage   99.01%   99.02%           
=======================================
  Files          46       46           
  Lines        4487     4495    +8     
=======================================
+ Hits         4443     4451    +8     
  Misses         44       44           

☔ 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 added this to the 2.4 milestone Oct 11, 2026
derek73 and others added 2 commits October 10, 2026 22:17
The review found two particle runs in one name reached by no test (an
off-by-one in the merge's bookkeeping passed the suite), and the read's
title run, taken before the merge, held only by the frame bands. Two
parity rows and a unit-test half now hold the first, a unit test the
second; the merge's docstring names a shape whose read the choice moves.

decisions.md's #625 entry claimed the moved `St und` shapes read as the
released wheels do; they do not (master matches 2.3.0 on 152 of the 258
moved texts, the tree on none), so the claim and the test docstring
repeating it are corrected. The grid was 395,148 texts, not the 137,810
copied from #624's entry. The review's further move classes (any P3
join on a title-particle, a mid-name title behind a run, H3's give-back
before a dual run) are recorded, all garbage, no rows (Derek). A stale
"merges nothing" case note is updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge-off control moved with the tests that commit added (30 in
tests/v2, 32 over the suite). The read test held only the read's own
re-ask of the title run; a parse assertion now holds group's too. H3
gives back 'Dr.', not 'mc'. `y` moves nothing in the P3-join class. The
2.3.0 comparison is over the seven fields, and a row note names the
off-by-one it holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 merged commit 4d5631c into master Oct 11, 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.

Merge the trailing run's particle runs in group, so S2's read needs no BOUND stop or report gathering

1 participant