mirror of
https://github.com/Comfy-Org/github-workflows.git
synced 2026-11-05 00:17:37 +00:00
[PR #59] [MERGED] feat(cursor-review): reuse check-pr-size classifier + discount comments in the size gate #68
Labels
No labels
cursor-review-catalog-drift
groom
groom
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/github-workflows#68
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/github-workflows/pull/59
Author: @mattmillerai
Created: 7/22/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @mattmillerai
Base:
main← Head:matt/cursor-review-reuse-pr-size-codegen📝 Commits (9)
4077d73feat(cursor-review): reuse check-pr-size classifier to skip codegen in the size gate and the reviewed diff3bfe469feat(check-pr-size): discount blank/comment lines from the size count (opt-in)ec880dbfix(cursor-review): resolve panel findings on classifier reuse (BE-1916)b0de184Merge remote-tracking branch 'origin/main' into matt/cursor-review-reuse-pr-size-codegen6da34acMerge origin/main, resolve cursor-review.yml checkout-pin conflict809971dMerge origin/main into matt/cursor-review-reuse-pr-size-codegen3763645Merge remote-tracking branch 'origin/main' into matt/cursor-review-reuse-pr-size-codegen607f093Merge remote-tracking branch 'origin/main' into matt/cursor-review-reuse-pr-size-codegen6bd8b6dMerge remote-tracking branch 'origin/main' into matt/cursor-review-reuse-pr-size-codegen📊 Changes
7 files changed (+1392 additions, -179 deletions)
View changed files
📝
.github/cursor-review/README.md(+5 -2)📝
.github/workflows/cursor-review.yml(+266 -101)📝
README.md(+1 -1)📝
scripts/check-pr-size/main.go(+199 -36)📝
scripts/check-pr-size/main_test.go(+187 -5)📝
scripts/check-pr-size/size.go(+370 -29)📝
scripts/check-pr-size/size_test.go(+364 -5)📄 Description
Two related changes so cursor-review's size gate counts only the lines a human/AI reviewer actually needs to read: (1) reuse the PR-size classifier so generated code stops counting and stops being reviewed, and (2) discount blank/comment lines from the count so AI comment volume doesn't trip the cap.
ELI5
When a PR is huge, cursor-review skips it (too big for one useful pass), and whatever it does review, it feeds the models the whole diff. Two things inflate "huge": generated code (nobody hand-writes or reviews it) and, increasingly, AI-written comments (verbose, low-risk). Both were counting against the size limit and — for codegen — getting shoved at the review models.
This PR teaches the size gate to ignore both: codegen via the same detector the PR-size cap already uses, and comments via a per-language heuristic. Codegen is dropped from the reviewed diff too; comments are kept in the diff (a reviewer should still catch a wrong or misleading comment) — only the count ignores them.
Part 1 — reuse the classifier for codegen (commit 1)
cursor-review kept its own hand-typed
diff_excludespathspec list, weaker than and drifting from the PR-size cap's classifier (it matched filenames only, missing base-reflinguist-generatedand the Go// Code generated … DO NOT EDIT.marker, while blunt directory excludes hid hand-written files).check-pr-sizegains an opt-in--generated-outflag (emits the classified generated paths; size verdict unchanged,pr-size.ymluntouched).diff-sizebuilds/runs the tool once:over_capdriveswithin_cap, and the generated-paths list drives a single reviewed-diff artifact with codegen excluded.extra_generated_globs/extra_lockfilesinputs mirrorpr-size.yml;diff_excludesstays as a diff-only back-compat escape hatch.Part 2 — discount blank/comment lines from the count (commit 2)
check-pr-sizegains--ignore-comments(envPR_SIZE_IGNORE_COMMENTS): blank and comment-only changed lines are subtracted from the counted total.FileChange.Discountedcarries the per-file count;Counted() = Changed() − Discounted, default 0 → behavior unchanged when off.//,#,--,<!-- -->) + single-line block comments + blanks. Multi-line block-comment bodies and string literals aren't lexed (documented); a comment token merely contained in code still counts. Generated files are never inspected; the reviewed diff is untouched.ignore_commentsinput (default true).Behavior / back-compat
pr-size.ymlis not modified (the comment-discount capability is available for it to adopt later).diff_excludesdefault (lockfiles + vendored dirs) now lives in the classifier built-ins + theextra_generated_globsdefault → equivalent-or-better exclusion, no diff-content change for default callers.diff_excludes: move generated entries intoextra_generated_globsso they leave the size gate too. Bump the pinned SHA at the same time. Detector-caught codegen (Go markers, base-reflinguist-generated) needs no change.Validation
go test ./...inscripts/check-pr-size— new suites (ParseDiscounts,IsInsignificantLine,CommentSyntaxFor,EvaluateDiscount,AnnotateDiscountsGit,WriteGeneratedPaths) + existing pass ✅gofmt -lclean,go vetclean ✅python3 -m unittest discover .github/cursor-review/tests(40 tests, unchanged) ✅actionlint .github/workflows/cursor-review.yml(incl. shellcheck) ✅Coordination — two in-flight PRs touch this file
cursor-review-xllabel that bypasses the cap for a genuinely huge PR. This PR shrinks what counts toward the cap in the first place. They compose; whoever lands second rebasesdiff-size.Draft until we pick the merge order.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.