Skip to content

feat(enrichment): deep-nesting / arrow-anti-pattern heuristic analyzer - #3498

Closed
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-deep-nesting-2030
Closed

feat(enrichment): deep-nesting / arrow-anti-pattern heuristic analyzer#3498
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-deep-nesting-2030

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

Fixes #2030

  • Add DeepNestingFinding and a local deepNesting analyzer that flags newly-added open-brace depth exceeding a threshold (default 4) inside contiguous added-line runs
  • Track peak depth per line (string literals stripped via codeOnly); reset on context/removed lines; cap at 25 findings; skip test paths
  • Register the analyzer in the REES registry with render/docs/metadata; sync src/review/enrichment-analyzer-names.ts with the enrichment registry (hardcodedUrl, debugLeftover, deepNesting)
  • Add review-enrichment/test/deep-nesting.test.ts covering over-threshold vs shallow blocks, custom maxDepth, context-line reset, cap, and brief rendering

Test plan

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

Made with Cursor

Flags newly-added brace depth beyond a threshold in contiguous added
lines. Syncs the REES analyzer name registry with hardcodedUrl,
debugLeftover, and deepNesting.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bohdansolovie
bohdansolovie requested a review from JSONbored as a code owner July 5, 2026 12:43
@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

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-05 12:49:39 UTC

10 files · 1 AI reviewer · 1 blocker · readiness 80/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/deep-nesting.ts:69 counts every `{` via `advanceBraceDepth(codeOnly(body), run.depth)`, so an added nested object/config literal deeper than four levels will produce a deepNesting finding even though no control flow was introduced
  • change this to track control-flow constructs before opening braces or rename the analyzer/docs to the broader structural-brace behavior and add tests for object literals. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
The PR wires a new local deepNesting analyzer through the enrichment registry, metadata, UI mirror, render path, and name list, with focused unit coverage for hunk resets, caps, test-path skips, and rendering. The main implementation is deterministic and bounded, but it does not implement the advertised control-flow heuristic: it counts every brace after stripping strings, so deeply nested object literals or other non-control structures in added code are reported as “control-flow depth” findings.

Blockers

  • review-enrichment/src/analyzers/deep-nesting.ts:69 counts every `{` via `advanceBraceDepth(codeOnly(body), run.depth)`, so an added nested object/config literal deeper than four levels will produce a deepNesting finding even though no control flow was introduced; change this to track control-flow constructs before opening braces or rename the analyzer/docs to the broader structural-brace behavior and add tests for object literals.
Nits — 5 non-blocking
  • nit: review-enrichment/src/analyzers/deep-nesting.ts:45 accepts any `maxDepth`, so a negative or zero threshold would make shallow code report immediately; clamp or validate the option if this can ever be operator-configured.
  • nit: review-enrichment/test/deep-nesting.test.ts does not cover the non-control-flow/object-literal case, which is the highest-risk false-positive path for this heuristic.
  • Add a test in `review-enrichment/test/deep-nesting.test.ts` showing a five-level object literal does not report when the analyzer is meant to be control-flow-only.
  • If structural brace depth is intentional, update `review-enrichment/src/analyzers/registry.ts` docs and the title/summary to stop calling it control-flow depth.
  • Consider exporting the registry limit constants from `deep-nesting.ts` and reusing them in the descriptor so the runtime cap and metadata cannot drift.

Why this is blocked

  • review-enrichment/src/analyzers/deep-nesting.ts:69 counts every `{` via `advanceBraceDepth(codeOnly(body), run.depth)`, so an added nested object/config literal deeper than four levels will produce a deepNesting finding even though no control flow was introduced; change this to track control-flow constructs before opening braces or rename the analyzer/docs to the broader structural-brace behavior and add tests for object literals.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #2030
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: 310 registered-repo PR(s), 185 merged, 9 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 310 PR(s), 9 issue(s).
Gate result ❌ Blocking Repo-configured hard 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: not available
  • Official Gittensor activity: 310 PR(s), 9 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

@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.06%. Comparing base (850c767) to head (1e3274f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3498   +/-   ##
=======================================
  Coverage   93.06%   93.06%           
=======================================
  Files         300      300           
  Lines       31336    31336           
  Branches    11435    11435           
=======================================
  Hits        29164    29164           
  Misses       1517     1517           
  Partials      655      655           
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 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/deep-nesting.ts:69 counts every `{` via `advanceBraceDepth(codeOnly(body), run.depth)`, so an added nested object/config literal deeper than four levels will produce a deepNesting finding even though no control flow was introduced; change this to track control-flow constructs before opening braces or rename the analyzer/docs to the broader structural-brace behavior and add tests for object literals.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 5, 2026
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): deep-nesting / arrow-anti-pattern heuristic analyzer

1 participant