Skip to content

feat(review): size-cap eligibility guard for auto-review via review.auto_review.max_added_lines / max_files - #3693

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/review-auto-review-size-cap-2065
Jul 6, 2026
Merged

feat(review): size-cap eligibility guard for auto-review via review.auto_review.max_added_lines / max_files#3693
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/review-auto-review-size-cap-2065

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

  • Add review.auto_review.max_added_lines and max_files to the focus manifest so maintainers can skip AI auto-review on oversized PRs (0 = cap disabled).
  • Compute added-line totals via totalAddedLineCount / addedLineCount from review diffs and thread counts through resolveAutoReviewSkipForPullRequest, emitting review skipped (too large) audit events.
  • Add unit, wiring, precedence-matrix, and queue integration tests including exact-threshold boundaries (eligible at cap, skip when over).

Fixes #2065

Test plan

  • npx tsc -p tsconfig.json --noEmit
  • review-diff totalAddedLineCount helper tests
  • focus-manifest parse/evaluate/round-trip tests for size caps
  • auto-review-wiring tests for resolver + resolveAutoReviewSkipForPullRequest
  • auto-review-config-matrix precedence case for too-large skip
  • queue.test.ts integration test for max_added_lines skip + audit detail

Made with Cursor

…d_lines / max_files

Add review.auto_review size caps that skip AI review when added-line totals
or changed-file counts exceed configured thresholds, wire diff stats through
the queue processor, and cover parse, eligibility, wiring, and integration paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bohdansolovie
bohdansolovie requested a review from JSONbored as a code owner July 6, 2026 04:33
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.35%. Comparing base (525be40) to head (c5a9972).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3693   +/-   ##
=======================================
  Coverage   93.35%   93.35%           
=======================================
  Files         315      315           
  Lines       32164    32187   +23     
  Branches    11795    11806   +11     
=======================================
+ Hits        30026    30049   +23     
  Misses       1507     1507           
  Partials      631      631           
Files with missing lines Coverage Δ
src/queue/processors.ts 94.06% <100.00%> (+0.01%) ⬆️
src/review/review-diff.ts 91.66% <100.00%> (+0.75%) ⬆️
src/signals/focus-manifest.ts 99.08% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-06 04:39:29 UTC

9 files · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This PR adds two new focus-manifest knobs (`max_added_lines`, `max_files`) that let maintainers skip AI auto-review on oversized PRs, threading an added-line/file-count total through `evaluateAutoReviewSkipReason` and `resolveAutoReviewSkipForPullRequest`, with a new `totalAddedLineCount` helper aggregating per-file `addedLineCount`. The wiring is complete end-to-end: manifest parse/normalize/round-trip, the resolver, and the queue processor call site in `maybePublishPrPublicSurface` all pass real `addedLineCount`/`changedFileCount` derived from `getReviewFiles()`, and the boundary condition (skip only when strictly `>` the cap, eligible exactly at the cap) is correctly implemented and tested. The `queue.test.ts` integration test exercises the real `processJob` pipeline with a mocked GitHub fetch returning an actual patch, so the added-lines count is genuinely computed from a real diff rather than fabricated — this is the kind of real-path test this repo wants.

Nits — 5 non-blocking
  • The externally-flagged `generic_secret_assignment` hit at test/unit/queue.test.ts:3367 is almost certainly the literal mock token string `fake-installation-token` used in the fetch stub, not a real secret — worth a quick glance to confirm but not blocking.
  • `totalAddedLineCount`'s dual `patch`/`payload.patch` shape suggests two different file-record shapes feed this helper (raw GitHub API vs. some wrapped payload) — a one-line comment on why both shapes exist would help the next reader avoid re-deriving it.
  • The new size-cap check sits after `skipDocsOnly` and before `baseBranches` in `evaluateAutoReviewSkipReason` — the precedence-matrix test only covers this one ordering slot; worth confirming this is the intended maintainer-facing precedence for the docs/config example if one gets added later.
  • Consider documenting the new `max_added_lines`/`max_files` keys in `config/examples/gittensory.full.yml` alongside the other `auto_review` fields for discoverability, since that file is the canonical example maintainers copy from.
  • If `getReviewFiles()` can be paginated/truncated for very large PRs, note that the size-cap total is computed from whatever page was fetched — not a blocker here since the fetch logic isn't in this diff, but worth a follow-up sanity check given the whole point of this feature is large PRs.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2065
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 331 registered-repo PR(s), 195 merged, 8 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 331 PR(s), 8 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: bohdansolovie
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: Python, C++, JavaScript
  • Official Gittensor activity: 331 PR(s), 8 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb 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.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 7a6ebab into JSONbored:main Jul 6, 2026
8 checks passed
jony376 added a commit to jony376/gittensory that referenced this pull request Jul 6, 2026
…3693)

Keep docs-only path fallback in resolveAutoReviewSkipForPullRequest while
incorporating max_added_lines/max_files wiring. Fix base-branch precedence
test by disabling skipDocsOnly for that case.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(review): size-cap eligibility guard for auto-review via review.auto_review.max_added_lines / max_files

2 participants