Skip to content

feat(enrichment): empty-catch / error-swallow analyzer - #3479

Closed
bohdansolovie wants to merge 2 commits into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-error-swallow-2014-v2
Closed

feat(enrichment): empty-catch / error-swallow analyzer#3479
bohdansolovie wants to merge 2 commits into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-error-swallow-2014-v2

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

Fixes #2014

Test plan

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

Made with Cursor

bohdansolovie and others added 2 commits July 5, 2026 11:11
Fixes JSONbored#2014 — flags swallowed errors in added JS/TS/Python catch/except blocks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add hardcodedUrl, errorSwallow, and debugLeftover so env/manifest validation matches the REES registry.

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

10 files · 1 AI reviewer · 2 blockers · readiness 80/100 · CI pending · blocked

🛑 Suggested Action - Reject/Close

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
  • AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/error-swallow.ts:9: the JS catch regexes require `catch (...)`, so `catch {}` / `catch { return null
  • }` blocks introduced by ES2019 are never reported even though they are reachable swallowed-error cases
  • change the catch patterns to accept optional binding, e.g. `const CATCH_OPEN_RE = /catch(?:\s*\(\s*(\w+)?\s*\))?\s*\{/
  • ` and make the same optional-parens change for `SINGLE_CATCH_RE`, then add tests for `catch {}` and `catch { return null
  • }`. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This PR adds a local error-swallow analyzer, wires it into the REES registry/metadata/render path, and adds focused unit coverage for the intended JS/TS/Python patterns. The implementation is mostly coherent and issue-scoped, but the detector misses JavaScript optional catch binding syntax, so a common reachable empty-catch form is silently skipped despite the analyzer's contract. The generated metadata/UI sync is consistent with the registry entries shown in the diff.

Blockers

  • review-enrichment/src/analyzers/error-swallow.ts:9: the JS catch regexes require `catch (...)`, so `catch {}` / `catch { return null; }` blocks introduced by ES2019 are never reported even though they are reachable swallowed-error cases; change the catch patterns to accept optional binding, e.g. `const CATCH_OPEN_RE = /catch(?:\s*\(\s*(\w+)?\s*\))?\s*\{/;` and make the same optional-parens change for `SINGLE_CATCH_RE`, then add tests for `catch {}` and `catch { return null; }`.
Nits — 4 non-blocking
  • nit: review-enrichment/src/analyzers/error-swallow.ts:28 treats any binding token occurrence as a real use, including comments or string literals, so `catch (err) { /* err */ cleanup(); }` is a false negative; either strip comments/strings before the binding check or document that conservative limitation in the analyzer notes.
  • nit: review-enrichment/src/render.ts:481 renders `errorSwallow` after `debugLeftover` even though the registry and generated metadata place it between `duplication` and `churnHotspot`; keep render order aligned with `ANALYZER_DESCRIPTORS` unless you have a reason for a different prompt order.
  • review-enrichment/test/error-swallow.test.ts: add real-path tests for optional catch binding syntax so the analyzer covers `catch {}` and `catch { return null; }`.
  • review-enrichment/src/analyzers/error-swallow.ts: consider extracting the catch syntax regexes into named helpers once optional binding is supported, so the single-line and multi-line paths cannot drift.

Why this is blocked

  • review-enrichment/src/analyzers/error-swallow.ts:9: the JS catch regexes require `catch (...)`, so `catch {}` / `catch { return null; }` blocks introduced by ES2019 are never reported even though they are reachable swallowed-error cases; change the catch patterns to accept optional binding, e.g. `const CATCH_OPEN_RE = /catch(?:\s*\(\s*(\w+)?\s*\))?\s*\{/;` and make the same optional-parens change for `SINGLE_CATCH_RE`, then add tests for `catch {}` and `catch { return null; }`.
  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ✅ Linked #2014
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: 287 registered-repo PR(s), 177 merged, 9 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bohdansolovie; Gittensor profile; 287 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: Python, C++, JavaScript
  • Official Gittensor activity: 287 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

@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 (Linked issue overlaps another open PR; AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/error-swallow.ts:9: the JS catch regexes require `catch (...)`, so `catch {}` / `catch { return null; }` blocks introduced by ES2019 are never reported even though they are reachable swallowed-error cases; change the catch patterns to accept optional binding, e.g. `const CATCH_OPEN_RE = /catch(?:\s*\(\s*(\w+)?\s*\))?\s*\{/;` and make the same optional-parens change for `SINGLE_CATCH_RE`, then add tests for `catch {}` and `catch { return null; }`.; duplicate of another open PR). 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
@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.03%. Comparing base (b5d2956) to head (d1217a9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3479   +/-   ##
=======================================
  Coverage   93.03%   93.03%           
=======================================
  Files         299      299           
  Lines       31204    31204           
  Branches    11386    11386           
=======================================
  Hits        29031    29031           
  Misses       1517     1517           
  Partials      656      656           
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.

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): empty-catch / error-swallow analyzer

1 participant