Skip to content

Diff-scoped checks block formatter-only changes, so this repo cannot adopt its own formatter hooks #17178

Open
0 of 3 issues completed

Description

@kyle-sexton

Problem

This repository cannot adopt its own formatter hooks. Every consumer repository now runs the aggregate lefthook-remote.yml except this one. The formatter jobs rewrite whole files, but the diff-scoped checks treat every rewritten line as content the author added.

A formatter-only cleanup can therefore never land, and neither can format-on-touch. Measured on main at 4f663b8, with every tracked file staged and each formatter job run alone:

Formatter Files rewritten (fixtures excluded) Added lines Added lines with git diff -w
bash-format (shfmt; the synced .editorconfig sets switch_case_indent = true) 1,282 49,949 3,725 (209 files)
python-format (ruff format; ruff.toml is lint-only today) 359 49,997 49,588

Committing either cleanup fails:

  • code-tidying-remote-comment-lint: 1,470 findings on the shell cleanup and 639 on the Python cleanup. All of them are pre-existing comments that the formatter reindented or moved.
  • guardrails-remote-pre-commit-content: plugins/source-control/scripts/worktree-create.test.sh:1142 (C:/repos/acme, a test's sample path) is reported as a machine-specific path, because shfmt reindented that line.
  • CI runs the same diff-scoped gates on the PR: pr-require-checks.yml:1655-1661 (comment lint, scripts/check-comment-lint.sh) and :1887 (machine-specific paths).

Format-on-touch has the same failure, and a worse one: an ordinary commit that touches an unformatted file gets the whole file reformatted, then blocked on its old comments.

Owner decision

On 2026-11-18 the owner chose to hold this repository on its guardrails and code-tidying remotes, and to fix the gates before the cleanup lands.

Done when

  • The diff-scoped checks judge only content a commit really adds. They should not count lines a formatter only reindented or reflowed: in lib/git-hooks/check-lib.sh checks_changed_lines, scripts/check-comment-lint.sh, the machine-paths step and the guardrails content scan. One approach is to compare each line's non-whitespace content, or its tokens, against the old file.
  • A formatter-only commit passes these checks, both locally and in CI.
  • The shfmt and ruff format cleanups then land as two PRs. Their squash commits go in .git-blame-ignore-revs, and lefthook.yml switches to lefthook-remote.yml.

Release cost to weigh: the two cleanups touch 90 plugins (shell: 90, Python: 33, all inside the 90). Shared copies change, so sync-shared-copies.sh --check-bump and check-vendor-version-bump.sh require a non-none fragment for each of them, which means 90 patch releases with no behavior change.

Branches are ready to rebuild: .work/dryrun-worktree.sh and .work/ccp-cleanup.sh in control-hub produce both cleanups, with one patch fragment per touched plugin. Fixtures are excluded from both. All 960 shared copies still match their canonical sources after formatting.

Sub-issues

Sub-issues

0 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added
    needs-triage
    on Nov 18, 2026
  2. github-actions commented on Nov 18, 2026

    @github-actions
    Contributor

    Size: Large
    Complexity: Medium
    Uncertainty: Knowable
    Flags: none
    Blocked by: none
    Blast radius: the diff-scoped gate scripts (check-lib.sh, check-comment-lint.sh, guardrails content scan, machine-paths step), then 90 plugins' files and fragments across the two cleanup PRs; read by every contributor and CI.
    Reversible: partly; gate changes and cleanup commits can be reverted, but patch releases already published stay.
    Open questions: none
    Understood: formatter-only commits fail the diff-scoped checks because reindented or reflowed lines count as added, so the repo cannot adopt lefthook-remote.yml or land the shfmt and ruff format cleanups.

    The recorded decision (comment by kyle-sexton, #17178 (comment), with the amendment at #issuecomment-7054897470) settles the release-cost question. Each cleanup PR carries one bump: patch fragment per touched plugin, with no exemption in the bump checks, and the blame-ignore file follows in a separate commit. It starts "Decision recorded. Owner, 2026-11-20, typed in the owning session (verbatim): ..." and picks option A for Q126.

    The other refinement questions are implementation choices for the issue lane: how to compare tokens for ruff, how to split the work, and whether the external machine-paths action needs its own change and pin bump. Related work: #16911, and merged #16156 touched the same diff-range parsing. No duplicate or merged fix found.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triage
    on Nov 18, 2026
  4. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane yet: sub-issue #17778 is open; sub-issue #17779 is open; sub-issue #18273 is open.

  5. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.

    Intended outcome: Make the diff-scoped checks ignore whitespace-only and reflow-only line changes so a formatter-only commit passes locally and in CI, then land the shfmt and ruff format cleanups as two PRs with blame-ignore entries and the lefthook-remote.yml switch.

    Related work

    Open questions

    1. The CI machine-paths step is the external action melodic-software/ci-workflows check-machine-paths pinned at v0.75.0, so fixing it needs a change and release in that repo plus a pin bump here. Should this issue cover that, or should it be tracked separately and block the cleanups?
      RECOMMENDED: Track the ci-workflows change as a separate prerequisite issue, and have this issue bump the pin once it is released. Basis: .base/.github/workflows/pr-require-checks.yml:1887-1890
    2. Should this issue be limited to the gate fix (check-lib.sh checks_added_ranges at line 422 and checks_changed_lines at line 545, check-comment-lint.sh, guardrails content-scan.sh), with the two cleanup PRs split into follow-up issues that depend on it?
      RECOMMENDED: Yes: the gate fix is this issue's scope, and the two cleanups become separate dependent issues. Basis: .base/lib/git-hooks/check-lib.sh:422-442 and the triage comment saying the cleanups depend on the gate fix
    3. The cleanups need a non-none release fragment for each of 90 plugins, meaning 90 behavior-free patch releases. Does the owner accept that cost or want it reduced, for example by exempting formatter-only changes from the bump check?
      RECOMMENDED: Accept the 90 patch fragments, since the issue already says shared copies change and the bump checks require them. Basis: judgment
    4. How should a line count as unchanged: equal after removing all whitespace, or equal token sequence? Whitespace removal does not cover ruff format, which rewrote nearly all lines (49,588 of 49,997 added lines remain with git diff -w).
      RECOMMENDED: Compare whitespace-stripped content for shfmt, and for Python also treat a reflowed statement as unchanged by comparing the token stream of the hunk against the old one. Basis: issue body table; judgment

    Sources read

    • lib/git-hooks/check-lib.sh:422-442: checks_added_ranges builds added-line ranges from git diff -U0 hunks, with no whitespace or reflow handling
    • lib/git-hooks/check-lib.sh:545-577: checks_changed_lines combines those ranges, merge parents, untracked files and binary filtering into $CHECKS_TMP/ranges
    • plugins/guardrails/git-hooks/content-scan.sh:410: findings are filtered through checks_filter_findings against the changed ranges
    • plugins/guardrails/git-hooks/pre-commit-content.sh:44: calls checks_changed_lines
    • pr-require-checks.yml:1654-1661: CI comment lint runs scripts/check-comment-lint.sh
    • pr-require-checks.yml:1887-1890: CI machine-paths check is the external action check-machine-paths at v0.75.0 from melodic-software/ci-workflows

    To answer, post a comment that starts with this line:

    **Decision recorded.** <answer>
    

    Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.

  6. kyle-sexton commented on Nov 21, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded. Owner, 2026-11-20, typed in the owning session (verbatim): "I want to make sure that the recommendations are grounded in facts, data, metrics, and research from the latest consensus-based research from official, authoritative, and trusted sources, and just go with the recommendations there." The recommendation was checked against the code at origin/main and current official sources before this record; the decision below is the grounded one.

    Q126 (CONFIRMED A)

    A. The shfmt and ruff format cleanups each land as one PR carrying one patch fragment per touched plugin (90 in all), as sync-shared-copies.sh --check-bump and check-vendor-version-bump.sh require today; the release PR that follows bumps those plugins once. Both squash commits go in .git-blame-ignore-revs. No formatter-only exemption is added to the bump checks (B), and the repo-wide cleanup is not replaced by format-on-touch (C).

    Basis

    Dissent considered

    Users download 90 plugin updates with no behavior change, and each plugin gets a "no behavior change" CHANGELOG entry. B would avoid that, but it adds a whitespace/token-equal exemption path to two fail-closed gates for a one-time event, which runs against "fewest moving parts". GitHub docs note an ignored revision "will still appear in blame" for a line it was the last to modify, so blame noise does not drop to zero.

  7. kyle-sexton commented on Nov 21, 2026

    @kyle-sexton
    MemberAuthor

    Amendment to the decision above, from the research re-check (owner direction of 2026-11-20 recorded there).

    Amendment

    Q126 stays A. The shfmt and ruff format cleanups each land as one PR, with one changelog fragment per touched plugin. There is no formatter-only exemption in the bump checks (B) and no format-on-touch in place of the cleanup (C). What changes:

    1. Each fragment says bump: patch. The fragment gate's documented contract accepts a no-release fragment as well. RP1: "The check-changelog-fragments.sh header says --check-required needs an added or modified fragment for each fragment-mode plugin whose shipped files a change set changes, and ADR 0048 says that requirement counts a fragment with bump none" (check-changelog-fragments.sh, ADR 0048). A bump: none fragment would leave the changed bytes under the old version. RP2: "ADR 0048 says a plugin whose pending fragments are all bump: none gets no new version, and release pull request chore(release): release 2 plugins #17688 moved version in plugin.json while deleting the fragments it consumed" (release commit). SV1: "SemVer 2.0.0 item 3 says the contents of a released version MUST NOT be modified and any modifications MUST be released as a new version" (SemVer 2.0.0). Qualifier on SV2: SemVer names no increment for a change that alters no behavior. PATCH is the smallest increment item 3 allows.
    2. The gate is named correctly. The gate that asks for a fragment per touched plugin is scripts/check-changelog-fragments.sh --check-required (RP1). The two scripts the decision named require a releasing bump only in their own scope. RP3: "The sync-shared-copies.sh header says --check-bump fails when a canonical changed and a carrying fragment-mode plugin added no fragment whose bump is not none, and the check-vendor-version-bump.sh header says a fragment-mode plugin must add a fragment whose bump is not none". Its scope qualifier: canonical shared sources for the sync gate, and vendor/ trees for the vendor gate. The research's reading of the gate's code, RP4, is MEDIUM and was not run: whether --check-required counts any added fragment, whatever its bump. So bump: patch is stated in the fragments rather than left to the gate.
    3. Corrected version citations. The decision cited the old plugins-reference#version page; these replace it.
      • CC1: "The Claude Code plugin manifest reference says setting version pins the plugin to that version until you change it, and that command-source plugins, plugins from a claude.ai-hosted marketplace, and plugins loaded in place from a local-path marketplace are not pinned by the field" (manifest reference, version).
      • CC2: "The Claude Code plugin loading page says the computed version names the plugin cache directory and that a manifest pinning version keeps every user on the cached copy until its author changes the string, however many commits they push" (loading, versions and updates). Qualifier: in-place loads from a local-path marketplace ignore the version string.
    4. The blame-ignore file lands in a follow-up commit. A squash merge creates its SHA only at merge, and the repository has no .git-blame-ignore-revs at origin/main. RP5: "git ls-tree origin/main for .git-blame-ignore-revs returns no entry, so the repository has no root .git-blame-ignore-revs file at origin/main ac4f209" (tree at ac4f209). The follow-up commit adds the root file listing both squash commits by their full SHAs. BL1: "The Black guide for introducing Black says to reformat everything in preferably one massive commit, list the full 40-character commit identifiers in .git-blame-ignore-revs at the project root, and set blame.ignoreRevsFile for git to apply it on every blame" (Black guide).
    5. What the blame file does and does not hide.
      • GH1 keeps its limit: "GitHub docs say revisions listed in a .git-blame-ignore-revs file in the repository root are hidden from the blame view, and that a listed commit that was the last to modify a line still appears in blame" (GitHub docs).
      • For local git, the git-blame page says a line an ignored revision "changed or added" is blamed on the "previous commit that changed that line or nearby lines".

    Caveat. The research's verifier failed rows 7 (confidence grading) and 12 (claims following jointly from their sources), on qualifiers dropped in restatements and one misquoted line of the git page. The git line is corrected above. Every source's quote and date checked out except RP5's date, which is off by the conversion from UTC to local time.

    Done when

    • The shfmt cleanup PR and the ruff format cleanup PR each add one fragment under .changes/<plugin>/ for every plugin whose shipped files they change, and every one of those fragments sets bump: patch.
    • scripts/check-changelog-fragments.sh --check-required passes on each cleanup PR's change set.
    • A root .git-blame-ignore-revs file exists and lists the full 40-character SHAs of both cleanup squash commits, one per line.
    • Neither scripts/sync-shared-copies.sh nor scripts/check-vendor-version-bump.sh gains an exemption for formatter-only or whitespace-only changes.
  8. melodic-automation-lanes commented on Nov 21, 2026

    @melodic-automation-lanes
    Contributor

    Split at intake (owner Q93). This issue is Size Large, so its done-when is split into 2 sub-issues, each holding its task-list lines as written.

    Automated split by the lanes App. Admission waits on this issue while a sub-issue is open; work-unblock closes it as completed once every sub-issue is closed as completed by a merge or a listed human and its done-when is covered.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    ready

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions