Repository navigation
Add check-new-line-breaks: advisory, diff-scoped semantic-line-break check - #300
Conversation
…check New Python composite action + workflow_call reusable workflow, following check-phi's existing diff-scoped-by-base-ref pattern closely. Flags newly added Markdown lines packing more than one sentence/clause onto a single line -- the "semantic line breaks" convention -- so it can complement lint-markdown when a repo has MD013 (line-length) disabled because the corpus already carries pre-existing long-line drift. Deliberately diverges from check-phi in one place: when the diff can't be computed (shallow clone, no base-ref), this skips the check entirely rather than falling back to a whole-tree scan, since scanning the whole tree here would reflag exactly the pre-existing drift diff-scoping exists to avoid. Ported from d-morrison/ai-config's scripts/check-new-line-breaks.py (ai-config#682/#684), rewritten to match this repo's own conventions (three-dot merge-base diff like check-phi, env-var config, pytest suite). Wires into _selftest.yml (new-line-breaks against this repo's own tree via base-ref, new-line-breaks-tests for the pytest suite), updates every site that restates the @v1/@v2 capability-tag scoping (README.md, CLAUDE.md, website/versioning.qmd x2, website/workflows.qmd x2), and adds the examples/ stub + reference page. Closes #299 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrR2uj9a5QBkAb7RuCA3bC
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
check-new-line-breaks/tests/test_check_new_line_breaks.py uses a placeholder git config email (t@t.com) for its throwaway test-repo fixtures, which check-phi's email detector correctly flagged -- excluded via paths-ignore, matching the existing check-phi/tests/** and test-coverage/tests/** entries for the same synthetic-content-in-tests reason. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrR2uj9a5QBkAb7RuCA3bC
Code reviewReviewed the diff, cross-checked the ported script against its stated upstream source (
Everything else checked out: the diff-parsing logic ( VerdictNeeds more work — one functional bug (the |
|
Claude finished review — View run I've completed the review of PR #300 ( Inline comments (3):
Top-level summary comment: posted, including a fourth finding that couldn't be anchored inline (unchanged lines outside the diff): A fifth candidate (DRY duplication of glob-matching logic vs. VerdictNeeds more work — one functional bug and one doc-sync gap should be fixed before merge; the other two findings are minor/non-blocking. |
…docs Real bug: find_violations()'s else branch (no base_ref) built a whole-file scope and ran the check against it, silently contradicting action.yml's own documented "skipped, no whole-tree fallback" behavior and the PR's central design claim. Every push to main via the shipped example stub (which passes no base-ref) would have reflagged every pre-existing long line in the caller's corpus -- the exact flood this capability exists to avoid. Fixed by treating "no base_ref" the same as "diff unavailable": both skip cleanly now. Removed the now-dead _tracked_files() whole-tree helper, and rewrote the module/function docstrings, which had also self-contradicted (one bullet said "whole tree runs on push", the next said "no whole-tree fallback"). Renamed find_violations()'s second return value from diff_unavailable to skipped, since it's no longer diff-specific. Also: - Corrected prose_line_numbers()'s docstring, which falsely claimed an "@-import directives" exclusion carried over from the ai-config source that was never actually ported (no such logic exists in this file -- ai-config's own @shared/foo.md include-directive convention has no equivalent among this repo's consumers). - Added the missing check-new-line-breaks.yml entry to README.md's "### Pinning third-party actions" subsection, a second independent restatement of the @v1/@v2 capability-exception list that the main Versioning section update in the previous commit missed -- the exact gha#181 repeat-offender pattern CLAUDE.md calls out by name. - Split a three-sentences-on-one-line changelog entry into semantic line breaks (ironic given this PR's own purpose). Test suite updated to match: the removed whole-tree-mode test is replaced with a test asserting empty base_ref also skips; re-verified end-to-end with a live dogfood run against a scratch repo. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrR2uj9a5QBkAb7RuCA3bC
|
Addressed all four findings from the review:
Pushed in 7f695a2. Generated by Claude Code |
2026-07-25 01:15 UTC |
|
Claude finished review — View run This confirms my independent verification of the fix commit matches the author's own accounting. All findings check out as genuinely resolved with no regressions. Code reviewThis is a confirming review following up on my prior review round (posted 2026-07-25T00:54:53Z), which flagged four issues: Needs more work. Commit
I independently re-read the full diff and the fix commit rather than relying solely on the author's own summary comment, and confirm no new issues were introduced by the fix (module/function docstrings were also de-duplicated/reconciled where they had self-contradicted, and both the test suite and No new findings from this round. VerdictReady for merge — all four findings from the prior review round are confirmed fixed in commit 7f695a2, with no regressions introduced. |
Summary
Closes #299.
check-new-line-breaks/Python composite action +.github/workflows/check-new-line-breaks.ymlreusable workflow, followingcheck-phi's existing diff-scoped-by-base-refpattern closely (same three-dot merge-base diff, env-var config,paths-ignoreglob handling).lint-markdownwhen a repo has MD013 (line-length) disabled because its corpus already carries pre-existing long-line drift.check-phiin one place: when the diff can't be computed (shallow clone, nobase-ref), this skips the check entirely rather than falling back to a whole-tree scan, since scanning the whole tree here would reflag exactly the pre-existing drift diff-scoping exists to avoid.fail: false) -- a long line can legitimately be un-splittable (a URL, a citation, a single genuinely long clause).Ported from
d-morrison/ai-config'sscripts/check-new-line-breaks.py(ai-config#682/#684), rewritten to match this repo's own conventions rather than copied verbatim.Doc/wiring sync
Per
CLAUDE.md's own note that a brand-new@v2-only capability needs updates at every site restating the@v1/@v2scoping, not just the obvious one -- grepped the whole repo forlint-changed-lines(the most recently added@v2-only sibling) as an anchor and updated all of them:README.md(capability table, permissions bullet, Versioning section)website/workflows.qmd(capability table + its own Versioning-summary paragraph)website/versioning.qmd(both of its two restatements)CLAUDE.md(capability list, Layout section, Tests section)examples/check-new-line-breaks.yml+website/reference/check-new-line-breaks.qmd, both pinned to@v2Also wired
_selftest.yml: anew-line-breaksjob exercising the real composite against this repo's own tree (base-refdiff mode, mirroringphi's local-composite-not-yet-released precedent), andnew-line-breaks-testsfor the pytest suite.Test plan
python3 -m pytest check-new-line-breaks/tests/ -q-- 19/19 pass, including the diff-scoping guarantees: a newly-added violation is flagged, pre-existing drift in an untouched line is not reflagged, and a failed diff (badbase-ref) skips rather than falling back to a whole-tree scanyaml.safe_loadCLAUDE.mdline this PR was already editing, fixed in the same commit; nothing elsemain(confirmed via a real stash/rebase onto freshorigin/main, not just an earlier snapshot)Generated by Claude Code