Skip to content

feat(code-metrics): count size against the repository's own limit and rank long files by commits - #16444

Merged
kyle-sexton merged 7 commits into
mainfrom
feat/code-metrics-size-repo-limit-and-acting
Nov 15, 2026
Merged

kyle-sexton merged 7 commits into
mainfrom
feat/code-metrics-size-repo-limit-and-acting

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: an owner decision from a design interview (2026-11-15), recorded outside this repository.

Summary

/code-metrics:audit size reported lines per file against one reference and said nothing about
which reference a repository should use or what to do with a long file. The owner's decision: one
configurable reference (default 1000), the repository's own linter limit preferred when one is
set, no second "must refactor" stage, and a long file acted on only when it also changes often, by
filing an issue, never by a refactor inside an unrelated change.

Fix

  • audit-size.sh --file-lines <n>: replaces the reference for one run and writes no layer. The
    report names the option as the layer that supplied the number.
  • audit-size.sh --commits-since <date>: for each file at or above the reference, the commits
    since that date that touched it, authors containing [bot] left out, most-changed first. A
    table in the markdown report, a file_commits object in the JSON. It ranks and sets no cutoff:
    the research behind the decision found no published one.
  • actions/size.md: "Which reference" (a code-metrics layer, else a limit the repository's own
    linter or analyzer configuration sets, else the bundled default) and "Acting on a long file"
    (commit count, a tracker item, /toolchain:ratchet to stop growth).
  • The plugin ships no list of linters or rule names: the action reads whatever configuration the
    repository has.
  • scc 4.1.0 prints the same per-file fields as 3.7.0 and still omits a file of an unknown
    language; the collector row and the install hint say so.

Design choices, with what was weighed:

  • The repository's limit is passed in by the caller, not parsed by the script. A parser per
    linter would put language-specific logic in the plugin.
  • A layer that sets size.file_lines wins over a linter limit: it is the repository's statement
    about this measure.
  • The commit count is a script option, not prose telling the reader to run git log, so the
    number is the same on every run.

Verification

  • plugins/code-metrics/skills/audit/scripts/audit-size.test.sh: 34 cases, 0 failed (13 new).
  • scripts/check-affected.sh --tests at this head: 18 passed, 13 skipped.
  • claude plugin eval on the new case audit-size-uses-the-repo-limit-and-files-an-issue, 3 runs
    per arm: 3 of 3 with the plugin, 0 of 3 without it. Against the plugin as it is on main, with
    the first shape of the case (before the commit-count grader): 0 of 3, so the case can fail.
  • scc 3.7.0 and 4.1.0 both run over two fixture files and one file of an unknown extension.

Related

  • Review's file-length rule is unchanged: it raises only a file that crosses the reference in the
    change (plugins/review/agents/code-reviewer.md).

🤖 Generated with Claude Code

kyle-sexton and others added 4 commits November 15, 2026 16:19
… rank long files by commits

The size action gains two run options: --file-lines <n> replaces the
reference for one run, and --commits-since <date> adds the commits that
touched each file at or above the reference. The action text says which
reference to use (a code-metrics layer, else a limit the repository's
own linter configuration sets, else the bundled default) and when to act
on a long file: only when it also changes often, by filing an issue.

The scc collector row is verified against scc 4.1.0 as well as 3.7.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The two new options belong to the size action alone and are documented in its action file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 15, 2026 21:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T21:32:37.468921Z 8231e45 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8231e45d2a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A file renamed inside the window lost the commits under its earlier name, so an often-changed file could rank as stable.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 43764023886

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/apply-patch
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 43764023886

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 82bc415064918bd00d2daf92cc82ca3dcea54d31: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #16444, incremental (2b5ac25..82bc415)

No security issues found. I read every hunk of the 3 files in scope in .claude-lane/incremental.diff. None of them match a trusted-path glob, and the push changes no plugin manifest, trust control, merge hold, workflow or standing guardrail.

What changed:

  • plugins/code-metrics/skills/audit/SKILL.md: the ## Next bullet now points at /work-items:track add instead of a section of actions/size.md. This is a routing hint only and removes no guardrail.
  • plugins/code-metrics/evals/audit-size-uses-the-repo-limit-and-files-an-issue/case.yaml: the grader regex ran-with-the-repo-limit now matches only --file-lines <n> as two arguments. That makes the eval grader stricter and touches nothing that runs with credentials.
  • docs/skill-cheat-sheet.md: the cheat sheet row for /code-metrics:audit was regenerated to list the new successor skill. Documentation only.

Settled threads: the threads on SKILL.md (Next bullet format) and case.yaml (the grader accepting --file-lines=400) were resolved by the owner's fixes in this push. I'm not raising them again. The size_commits.py thread stays settled (lines changed since resolution: no).

Prior findings: this lane's only earlier post is the summary for 2b5ac25, which reported 0 findings. This review was blocking only (blocking only: yes), so only CRITICAL or IMPORTANT findings would have been reported, and there were none.

Embedded text: the PR context contains no instructions aimed at the review lane.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 2 inline finding(s) on 2b5ac258ca7a6a48a4314c4ed5a3719699fe25d2; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 82bc415064918bd00d2daf92cc82ca3dcea54d31: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review, incremental: PR #16444 (2b5ac258 → 82bc4150)

I read every hunk of the 3 files in the incremental scope. This round only checked for blocking problems, because this lane already reviewed an earlier head.

Both earlier findings are fixed, and I found nothing new:

  • plugins/code-metrics/skills/audit/SKILL.md:69: the ## Next bullet now reads "A long file that also changes often needs a tracker item: /work-items:track add." That matches the <outcome>: /plugin:skill [args]. successor format in .claude/rules/skill-bodies-state-current-rules.md. It also matches what actions/size.md says: act only when the file also changes often (line 80) and file it with /work-items:track add (lines 86-88).
  • plugins/code-metrics/evals/audit-size-uses-the-repo-limit-and-files-an-issue/case.yaml:17: the ran-with-the-repo-limit grader now matches only --file-lines\s+400\b. That is the only form audit-size.sh parses, so a --file-lines=400 call, which the dispatcher rejects, no longer passes this grader.
  • docs/skill-cheat-sheet.md: the regenerated row for /code-metrics:audit now lists /work-items:track first among its successors, matching the new bullet. I did not run the generator; that the file was regenerated is the author's claim.

Other notes:

  • Settled threads: both threads from my earlier findings were resolved by owner replies stating the fixes, and the current code matches those replies. The rename-following thread on size_commits.py stays settled; the file is not in this round's scope.
  • Manifest checks: no plugin.json or marketplace.json changed in this round.
  • I ran nothing, so no test or eval result here is independently verified.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 2 commits November 15, 2026 16:46
…option form the script takes

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit dbd700f Nov 15, 2026
56 checks passed
@kyle-sexton
kyle-sexton deleted the feat/code-metrics-size-repo-limit-and-acting branch November 15, 2026 22:06
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant