Skip to content

feat(enrichment): long-file / big-function heuristic analyzer#3515

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-size-smell-2019
Jul 5, 2026
Merged

feat(enrichment): long-file / big-function heuristic analyzer#3515
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-size-smell-2019

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

Fixes #2019

  • Add SizeSmellFinding and a local sizeSmell analyzer that flags (1) an estimated resulting file length over 400 lines from hunk headers and (2) newly-added function/arrow function bodies whose added brace span exceeds 60 lines
  • Pure compute over unified diffs; skips test paths; caps at 25 findings; documents that file length is patch-estimated (visible hunks only)
  • Register the analyzer in the REES registry with render/docs/metadata; sync src/review/enrichment-analyzer-names.ts
  • Add review-enrichment/test/size-smell.test.ts covering long-file threshold, big-function detection, clean sub-threshold case, cap, and brief rendering

Test plan

  • cd review-enrichment && npm run build && npm run metadata && node --test test/size-smell.test.ts test/analyzer-registry.test.ts
  • CI validate-code

Made with Cursor

Estimate resulting file length from hunk headers and flag added function
bodies whose brace span exceeds a threshold. Pure local compute over diffs.

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

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 15:20:44 UTC

10 files · 1 AI reviewer · no blockers · readiness 62/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This adds a local size-smell enrichment analyzer, wires it into the registry/render/name metadata, and syncs the generated UI/metadata surfaces. The core long-file estimate and added-function brace scan are coherent for unified diffs, skip test paths, and enforce the configured cap across the normal production entrypoint. I do not see a reachable correctness break in the visible diff.

Nits — 6 non-blocking
  • nit: review-enrichment/src/analyzers/size-smell.ts:14 only recognizes function declarations and parenthesized arrow functions, so common forms like `const f = async x => {` and object/class methods will be silently skipped despite the analyzer name reading broadly as big-function detection.
  • nit: review-enrichment/src/analyzers/size-smell.ts:40 counts braces after `codeOnly()` but still treats template/object/type braces as structural, so the heuristic can over-count or under-count unusual added code; the docs should call this out as heuristic-only or add tests for the known limits.
  • nit: review-enrichment/test/size-smell.test.ts:53 says it “respects the cap” but that test only verifies test-file skipping; the cap coverage lives in the next test, so the test name is misleading.
  • Add a focused test in review-enrichment/test/size-smell.test.ts for an unparenthesized async arrow function and either support it in FUNCTION_BODY_OPEN_RE or document that it is intentionally out of scope.
  • Rename the mixed skip/cap test at review-enrichment/test/size-smell.test.ts:53 to cover only test-path skipping, since the file-level cap is already tested separately.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2019
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 312 registered-repo PR(s), 185 merged, 9 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 312 PR(s), 9 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: 312 PR(s), 9 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #2023, issue #2019)
  • Related work: Titles/paths share 7 meaningful terms. (issue #2029, issue #2019)
  • Related work: Titles/paths share 7 meaningful terms. (issue #2033, issue #2019)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
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

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.09%. Comparing base (9a125e9) to head (866ad9c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3515   +/-   ##
=======================================
  Coverage   93.09%   93.09%           
=======================================
  Files         301      301           
  Lines       31450    31450           
  Branches    11483    11483           
=======================================
  Hits        29279    29279           
  Misses       1517     1517           
  Partials      654      654           
Files with missing lines Coverage Δ
src/review/enrichment-analyzer-names.ts 100.00% <ø> (ø)
🚀 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 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 371a96c into JSONbored:main Jul 5, 2026
9 checks passed
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(enrichment): long-file / big-function heuristic analyzer

1 participant