Skip to content

Phases 1 and 2 of #133: the rail lists sources, and the origin is on screen - #137

Merged
holden merged 3 commits into
mainfrom
claude/dictionary-word-page-grouping-2c67e4
Sep 21, 2026
Merged

holden merged 3 commits into
mainfrom
claude/dictionary-word-page-grouping-2c67e4

Conversation

@holden

@holden holden commented Sep 21, 2026

Copy link
Copy Markdown
Member

Phases 1 and 2 of #133, on top of the merged #132. Phases 3 (one related-words block) and 4 (Wikipedia out of the dictionaries) follow separately.

Phase 1 — the rail lists sources, not entries (0589b7d)

  • R1 Cards sort by {tier, year, source.slug, pos_rank}, so a source's entries are adjacent and the accordion's nested rows work for every source. Wiktionary's name entry no longer lands after Wikipedia as a second full-width Wiktionary row. Ids unchanged.
  • R2 WordPage.build/2 chunks cards into source_groups; the rail renders one row per source, the name linking to the first card and each part of speech its own anchor. Wikipedia's right column says article.
  • R6 A choice whose lemma differs only by case from one already listed is dropped (LoVe beside Love). The same fold applies to the parts-of-speech line.
word rail rows entry anchors rail height
love 9 → 5 9 739 → 611 px
set 11 → 3 11 —
nepotism 4 4 —

Phase 2 — the origin on screen (bb5b2e9)

  • The "Sound, forms and origin" disclosure goes; forms and origins sit under the stats tiles.
  • clause_cut/2 replaces first_sentence/1: cut at the last , from, ; or sentence end that fits, word boundary as fallback. Head plus remainder reproduce the original exactly.
  • Two thresholds, same shape as @entry_whole / @entry_preview: an origin under 150 characters shows whole; a longer one is cut to 64, which is two visual lines in a 360 px rail once the label and … N more are counted. The issue's "~150 characters" and "two lines" could not both hold; the measured one won.
  • Two origins open, the rest behind N more origins. Forms are one line with an inline +N. The pronunciation list moves into the headword; its +N variants is now the disclosure itself, not a link to one below.
word clamped origins rail height
love 2 lines 611 → 775 px (+5.9 lines)
set 2 lines, 3 more origins 763 → 707 px
nepotism 2 lines (274 characters, not short as #133 assumed) 615 px

Merge with main

The review round on #132 moved #pronunciation-variants onto the inner list so the headword's fragment link could open two nested disclosures. Phase 2 removed the nesting, so that fix has nothing to fix: the resolution keeps the headword-level <details id="pronunciation-variants"> and drops the id from the list inside it, leaving one element with that id.

Two readings of #133 were wrong and are corrected in the issue's terms: set has three sources, not five rail rows; and nepotism's origin is long enough to clamp.

🤖 Generated with Claude Code

holden and others added 3 commits September 21, 2026 15:42
The rail said "Defined here by 5 sources" over nine rows, because it
walked the cards and a source that filed a noun and a verb has two.
`set` was eleven rows under the same heading.

R1. The card sort key becomes `{tier, year, source.slug, pos_rank}`.
Part of speech sorted above source before, which is why Wiktionary's
`name` entry landed after Wikipedia — *name* sorts after *noun* and
*verb* across every source — and rendered as a second full-width
Wiktionary row with an unrelated source between the two. Ids are
untouched: `#card-wiktionary-name` is still `#card-wiktionary-name`.

R2. `source_groups/1` chunks the cards by source, in build/2, and the
rail renders one `<li>` per group: the name linked to the source's
first card, each part of speech its own link to its own entry. Tier and
year come from the source itself, so a source cannot reappear in a
later chunk and `chunk_by/2` is enough. Wikipedia's content hangs off
the concept rather than a lexeme, so its card has no part of speech at
all — the right column says `article`, which is what it is.

R6. A choice whose lemma differs from one already listed only by case
is dropped, so `LoVe` stops standing beside `Love`. Which row of a
case-group survives is decided rather than incidental: enriched first,
then the spelling closest to the address that was typed.

`headword.parts` is the same fold applied to the parts-of-speech line,
which otherwise read `noun · noun · verb · name · name` once the lemmas
stopped being links. `headword.lexemes` stays whole — the discovery
target counts it and the provenance drawer walks it.

love: 5 rail rows, 9 entry anchors, no name twice in the accordion,
rail 739px → 611px. set: 3 rows (not the 5 the issue predicted — the
word has three sources, five parts of speech), 11 anchors. nepotism
unchanged. 1,407 tests green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The etymology is the most interesting fact the rail holds and it was
behind a summary reading "Sound, forms and origin". #131's own research
says ~60% of readers never expand a collapsed section, so for most of
them the origin did not exist.

The `<details>` goes. Forms and origins render under the stats tiles
with the grey labels they already had.

What kept them there was length. `first_sentence/1` cut at a full stop,
and Wiktionary writes a whole descent as one sentence — *love*'s is
1,293 characters of *from … from … from* without one — so the cut
returned the paragraph it was asked to shorten. `clause_cut/2` cuts at
the last `, from`, `;` or sentence end that fits, and falls back to a
word boundary for an origin with no joins in it at all. Nothing is
rewritten: head and remainder joined back together reproduce the
original exactly.

Two numbers, the same shape as `@entry_whole` / `@entry_preview` above
them. R5 asks for a ~150-character budget *and* for no line over two
visual lines; the rail is 360px and renders 7.64px a character, so 150
is three lines and the two cannot both hold. 150 becomes the threshold
under which an origin is shown whole, 64 the budget a longer one is cut
to — which is 2 lines once the `origin (noun, verb)` label and the
`… 1,229 more` are counted. Measured, not chosen.

Two origins open, the rest behind one `N more origins` line: `set`
files five. Forms are one line with an inline `+N` instead of a second
line restating the count. Pronunciations leave the rail entirely — the
headword's `+N variants` is now the disclosure itself rather than a
link to one four hundred pixels below it.

love: origin 2 lines, rail 611px → 775px (+5.9 lines, R5 allows ~8).
set: both open origins 2 lines, `3 more origins`, rail 763px → 707px,
and the Wiktionary row wraps its five parts of speech rather than
cutting the name to "Wiktionary (Engli…". nepotism: one origin, 2
lines — R5 expected it whole, but its origin is 274 characters, not the
short one the issue assumed. 1,407 tests green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The review round on #132 moved `#pronunciation-variants` onto the list
inside a nested disclosure so the headword's fragment link could open
both. Phase 2 of #133 moved that list into the headword and made the
`+N variants` summary the disclosure itself, so there is no nesting
left to open. The merge keeps the headword-level `<details>` with the
id and drops the duplicate from the inner list.

mix precommit: 1,407 tests, 0 failures.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 34 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 57 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Essentials

Run ID: f069614a-1e17-48b5-befe-7d89ebb65abe

📥 Commits

Reviewing files that changed from the base of the PR and between 1e73811 and ba59d1f.

📒 Files selected for processing (3)
  • lib/devils_dictionary/lexicon/word_page.ex
  • lib/devils_dictionary_web/components/word.ex
  • lib/devils_dictionary_web/live/word_live.ex

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant