Skip to content

[belongs in Morrison-Lab/gha] check-new-line-breaks has the same **...**. bold-close blind spot just fixed in ai-config #1098 #397

Description

@dem-ucdh

This belongs in Morrison-Lab/gha (and its source-of-truth d-morrison/gha), not here --- filed in ai-config because this session's GitHub scope is limited to Morrison-Lab/ai-config and I lack push access to gha. Please transfer to Morrison-Lab/gha.

The bug

check-new-line-breaks/check-new-line-breaks.py's sentence-boundary regex is byte-for-byte the pre-fix form that ai-config's scripts/semantic-line-breaks.py carried until ai-config Morrison-Lab/ai-config#1098 (65ab25c):

# Morrison-Lab/gha and d-morrison/gha, check-new-line-breaks.py:61, at @v2 (209bfb76) and at main (2026-08-03)
_SENT_BREAK_RE = re.compile(r"([.!?][`\"')\]]*)\s+(?=[A-Z\"'`*\[])")

The closing-character class after [.!?] is [`"')\]] --- it omits * and _. So a sentence whose ending punctuation is immediately followed by a Markdown emphasis-close (**Some claim.** Explanation...) is never recognized as a sentence boundary: the ** sits between the period and the whitespace, and the class does not consume it.

Impact

This is the enforcement check every consumer repo runs via the reusable check-new-line-breaks.yml@v2. Because it is the detector half (it flags newly-added lines packing more than one sentence), the blind spot makes it silently under-report the corpus's single most common two-sentence-on-one-line construction --- a bolded lead-in sentence followed by its explanation (**Claim.** Explanation.), the house style across CLAUDE.md, shared/, and skills/. Newly-added lines of that shape pass the check clean.

This is the same defect, in the same regex, that ai-config Morrison-Lab/ai-config#1098 (closing Morrison-Lab/ai-config#1051/#1043) just fixed in ai-config's local reformatter. The two scripts are siblings; the fix should be mirrored upstream so the CI check actually catches what the reformatter now splits.

Distinct from gha Morrison-Lab/ai-config#389

Morrison-Lab/gha#389 covers the lookahead side (a sentence starting with a lowercase identifier). This is the closing-class side (a sentence ending in emphasis). Different halves of the same regex; both are real, and neither fixes the other.

Suggested fix

Mirror ai-config Morrison-Lab/ai-config#1098: add * and _ to the closing-character class.

_SENT_BREAK_RE = re.compile(r"([.!?][`\"')\]*_]*)\s+(?=[A-Z\"'`*\[])")

Verified in ai-config Morrison-Lab/ai-config#1098 against all four emphasis forms plus a lowercase-next negative guard (the uppercase-or-markup lookahead still blocks a false split when a lowercase word follows the close, so mid-sentence emphasis is left intact). ai-config's scripts/test_slb.py Bug 7/7b/7c/7d cases port directly. Fix should land in d-morrison/gha (the source-of-truth referenced by the @v2 inner uses:) and sync to Morrison-Lab/gha.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions