Skip to content

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

Closed
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-error-swallow-2014
Closed

feat(enrichment): empty-catch / error-swallow analyzer#3478
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:feat/enrichment-error-swallow-2014

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Summary

Fixes #2014

  • Add ErrorSwallowFinding and a local errorSwallow analyzer for newly-added catch/except blocks that swallow errors
  • Detect empty-catch, unused-binding, and return-null patterns on added JS/TS/Python source lines (tests skipped)
  • Skip catches that log, rethrow, or reference the binding; support multi-line catch bodies in added hunks
  • Register the analyzer with render/docs/metadata and add review-enrichment/test/error-swallow.test.ts

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

Fixes JSONbored#2014 — flags swallowed errors in added JS/TS/Python catch/except blocks.

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

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

🛑 Suggested Action - Reject/Close

  • AI reviewers agree on a likely critical defect: src/review/enrichment-analyzer-names.ts:26 is missing `"errorSwallow"` in `REES_ANALYZER_NAMES`, while `.env.example`, `review-enrichment/src/analyzers/registry.ts`, metadata, and the UI all expose it
  • add it next to `"duplication"`/`"churnHotspot"` so operator `REES_ANALYZERS` and `.gittensory.yml` validation accept the analyzer: ```ts "duplication", "errorSwallow", "churnHotspot", ``` — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This adds a local error-swallow analyzer, registers it in the enrichment descriptor/render path, and adds focused tests for the scanner and brief output. The analyzer implementation is narrow and the tests exercise the main JS/Python cases, but the PR leaves the canonical analyzer-name registry out of sync with the new descriptor and generated/docs surfaces, so configured use of the new analyzer will be rejected by the existing validation path.

Blockers

  • src/review/enrichment-analyzer-names.ts:26 is missing `"errorSwallow"` in `REES_ANALYZER_NAMES`, while `.env.example`, `review-enrichment/src/analyzers/registry.ts`, metadata, and the UI all expose it; add it next to `"duplication"`/`"churnHotspot"` so operator `REES_ANALYZERS` and `.gittensory.yml` validation accept the analyzer: ```ts "duplication", "errorSwallow", "churnHotspot", ```
Nits — 5 non-blocking
  • nit: review-enrichment/src/analyzers/error-swallow.ts:33 treats any `throw` token or logger-like token anywhere in the catch body as safe, including comments or unrelated strings, so consider documenting that precision tradeoff or tightening the pattern if this analyzer is meant to be more than heuristic.
  • nit: review-enrichment/src/analyzers/error-swallow.ts:13 only supports simple catch bindings via `\w+`; if you intentionally skip destructured or typed catch patterns, add a small negative test so that limitation is explicit.
  • nit: review-enrichment/test/error-swallow.test.ts:44 covers a multi-line `return null` catch, but there is no test for a multi-line unused-binding catch, which is the branch most likely to regress in the pending-catch state machine.
  • Update `src/review/enrichment-analyzer-names.ts` and add/adjust the validation test that proves `errorSwallow` is accepted by the canonical analyzer-name set.
  • Add one registry/config validation fixture that enables `errorSwallow` through the same path used by `REES_ANALYZERS` or `.gittensory.yml`, not only the local analyzer registry test.

Why this is blocked

  • src/review/enrichment-analyzer-names.ts:26 is missing `"errorSwallow"` in `REES_ANALYZER_NAMES`, while `.env.example`, `review-enrichment/src/analyzers/registry.ts`, metadata, and the UI all expose it; add it next to `"duplication"`/`"churnHotspot"` so operator `REES_ANALYZERS` and `.gittensory.yml` validation accept the analyzer: ```ts "duplication", "errorSwallow", "churnHotspot", ```
Signal Result Evidence
Code review ❌ 1 blocker 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: not available
  • 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 (AI reviewers agree on a likely critical defect: src/review/enrichment-analyzer-names.ts:26 is missing `"errorSwallow"` in `REES_ANALYZER_NAMES`, while `.env.example`, `review-enrichment/src/analyzers/registry.ts`, metadata, and the UI all expose it; add it next to `"duplication"`/`"churnHotspot"` so operator `REES_ANALYZERS` and `.gittensory.yml` validation accept the analyzer: ```ts "duplication", "errorSwallow", "churnHotspot", ```). 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): empty-catch / error-swallow analyzer

1 participant