Skip to content

PT-4313: Mirror the core review of the gutter coverage test - #18

Open
irahopkinson wants to merge 1 commit into
mainfrom
pt-4313-coverage-test-review-followup
Open

irahopkinson wants to merge 1 commit into
mainfrom
pt-4313-coverage-test-review-followup

Conversation

@irahopkinson

@irahopkinson irahopkinson commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #10 (PT-4313). The review of paranext-core's twin PR, paranext/paranext-core#2827, found things in the derived gutter coverage test that also apply here, plus two stale focus-box comments in the stylesheet. This carries the same changes so the twins stay in step. Test and comments only; no rendering change.

Test (usj-nodes.css.gutter-coverage.test.ts)

  • The parser-sanity floors are back (> 40 and > 20 entries). Both sides of the derived comparison come from the same parser, so a parser that started reading less would shrink them in step; > 0 only catches reading nothing.
  • The nesting guard walks only rules that name a marker class, and fails a tracked property set anywhere but directly in a top-level marker rule (inside an at-rule, or an at-rule nested in the rule). An unrelated @media print { .note { margin: 0 } } no longer trips it.
  • [dir=…] is read in any quoting or case, with or without a case flag, plus :dir(); a direction inside :not() is read as the other direction.
  • directionAsymmetries reports a value set in only one direction, for margins and for text-indent.
  • No hanging indent may reach past its marker's margin. That is what lets the focus-box comments say the marker's own column wins the min() for every marker in this file, so the claim is pinned rather than left to go stale.
  • Each usfm.sty oracle is compared as one object; the gutter maps are compared with toEqual.
  • The header carries a "Known limits" paragraph naming what the derivation does not model (class-token classification rather than DOM resolution, blanket .para rules, the cascade approximated as direction-qualified-beats-agnostic, padding untracked, calc() unreadable, direction from [dir=…]/:dir() only, agnostic margin-right counted as inline-start).

Stylesheet (usj-nodes.css)

  • The two focus-box comments say what --verse-text-start does today: a fallback start that the marker's own column beats for every marker in this file, rather than "aligning the box with the poetry text start".

Verification

  • usj-nodes.css.gutter-coverage.test.ts 4/4 and usj-nodes.css.test.ts 9/9.
  • Mutation probes against usj-nodes.css behave as intended: RTL-only margin, at-rule wrapping a marker rule, at-rule nested inside a marker rule, direction-qualified gutter rule, calc() value, hanging indent without margin, real margin in a compensation rule, agnostic margin-right, !important, :not([dir='rtl']) and a hanging indent past its margin all fail; an unrelated nested rule, a hanging indent within its margin and the unchanged sheet pass.
  • ESLint and Prettier clean on the changed files.

AI-assisted — Claude Fable 5.1, local Claude Code session (no session URL)

🤖 Generated with Claude Code


This change is Reviewable

Carries the review round on paranext-core PR #2827 onto the twin test
and the stylesheet comments so the copies stay in step.

usj-nodes.css.gutter-coverage.test.ts:
- Restore the parser-sanity floors on the derived map sizes.
- Scope the nesting guard to rules that name a marker class, and fail a
  tracked property set anywhere but directly in a top-level marker rule
  (inside an at-rule, or an at-rule nested in the rule).
- Read [dir=...] in any quoting or case, with or without a case flag,
  and a direction inside :not() as the other direction.
- Report a direction asymmetry for a value set in only one direction,
  for margins and for text-indent.
- Assert no hanging indent reaches past its marker's margin, which is
  what lets the focus-box comments say the marker's column always wins.
- Spot-check each usfm.sty oracle as one object; compare the gutter
  maps with toEqual.
- State the derivation's known limits in the header.

usj-nodes.css: the two focus-box comments say what --verse-text-start
does today, a fallback start that the marker's own column beats for
every marker in this file.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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