Skip to content

check-new-line-breaks: flags pre-existing content as new when a PR moves it to a new file #684

Description

@d-morrison

check-new-line-breaks (the composite action used by Morrison-Lab/gha/.github/workflows/check-new-line-breaks.yml and directly via Morrison-Lab/gha/check-new-line-breaks) is documented as diff-scoped: it "only flags lines a PR itself adds, so it can't reflag [pre-existing formatting] drift" (see the comment above the new-line-breaks job in Morrison-Lab/ai-config/.github/workflows/validate.yml).

That guarantee breaks on a file split: when a PR moves an existing block of lines from file A (still present, just trimmed) into a brand-new file B, git diff <base>...HEAD shows every line of B as freshly "added" -- there's no deletion of A to pair against for rename detection, since A still exists (modified, not deleted). The tool then flags every pre-existing, previously-compliant (or previously grandfathered) line in B as a new violation, even though none of that content is new.

Reproduction: Morrison-Lab/ai-config#2250 splits memories/github.md's ## gh (GitHub CLI) section into a new memories/gh-cli.md. The pull_request-triggered run of new-line-breaks (e.g. https://github.com/Morrison-Lab/ai-config/actions/runs/33007501706/job/98304952533) flagged 23 lines in gh-cli.md as needing semantic breaks. Every one of the 23 flagged lines exists verbatim in origin/main's current memories/github.md (e.g. line 145 there == the flagged "The @claude review bot's author name differs by API" line) -- they were never new, just relocated.

Suggested fix: run the diff with rename/copy detection (git diff -M -C or equivalent), or alternatively check whether each "added" line already exists verbatim anywhere in the base tree (e.g. via git log -S or a base-tree grep) before flagging it, so a pure content move doesn't get treated as new content.

Workaround applied for now: reformatted the 23 flagged (pre-existing) lines in gh-cli.md to satisfy the check, purely as a local unblock -- this is churn on content that was never actually new.

Posted by Claude Code (AI agent) --- not written by a human.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions