Skip to content

feat(enrichment): add unsafe-any TS counter analyzer (#2017) - #3563

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
james3773:feat/enrichment-unsafe-any-analyzer-2017
Jul 5, 2026
Merged

feat(enrichment): add unsafe-any TS counter analyzer (#2017)#3563
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
james3773:feat/enrichment-unsafe-any-analyzer-2017

Conversation

@james3773

Copy link
Copy Markdown
Contributor

Summary

  • Add a local REES unsafeAny analyzer that flags newly introduced : any, as any, and <any> patterns in TypeScript diffs
  • Register the descriptor, brief rendering, analyzer metadata, and manifest name parity
  • Unit tests cover annotation/cast/assertion classification, comment/string skips, non-TS paths, and the findings cap

Closes #2017

Test plan

  • npm run typecheck
  • npm --prefix review-enrichment run build && npm run metadata && npm --prefix review-enrichment test (1065 tests)
  • npm run rees:test

Made with Cursor

Register a local REES analyzer that flags newly-added : any, as any,
and <any> patterns in TypeScript diffs with line-cited findings.

Closes JSONbored#2017

Co-authored-by: Cursor <cursoragent@cursor.com>
@james3773
james3773 requested a review from JSONbored as a code owner July 5, 2026 17:13
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 5, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@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:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x 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 17:19:27 UTC

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

⏸️ Suggested Action - Manual Review

Review summary
This PR adds a new local analyzer (unsafeAny) that flags newly-added `: any` annotations, `as any` casts, and `<any>` assertions in TS diffs, and wires it through every required integration point: registry descriptor, generated analyzer-metadata.json, the UI's mirrored rees-analyzers.ts list, types.ts (BriefFindings + finding type), render.ts, .env.example profile lists, and enrichment-analyzer-names.ts, with matching test updates in analyzer-registry.test.ts. The core scan logic (patchLines generator, hunk-header line tracking, per-line classification via detectUnsafeAny, findings cap propagation between scanUnsafeAny and scanPatchForUnsafeAny) is correct and reuses existing utilities (codeOnly, isTestPath) rather than reimplementing them. Unit tests exercise classification, comment/string-literal skipping, test-path/non-TS skipping, and the cap, and CI (build/typecheck/tests) is green on this commit. The PR closes the linked issue #2017 and the diff matches the description with no scope creep.

Nits — 6 non-blocking
  • review-enrichment/src/analyzers/unsafe-any.ts:12 — the `<any>` regex will also match generic type arguments like `Array<any>`/`Promise<any>`, not just old-style assertions, so some findings labeled "assertion" are actually generic instantiations; consider renaming the kind or the docs to acknowledge this overlap.
  • The `25`/`2000` limit constants are duplicated verbatim across review-enrichment/src/analyzers/unsafe-any.ts, registry.ts, analyzer-metadata.json, and rees-analyzers.ts with no shared source of truth beyond the generation script — fine if metadata/ui files are auto-generated (per the test plan's `npm run metadata`), but worth confirming.
  • On a line containing both `: any` and `as any` (e.g. `function f(): any { return x as any; }`), detectUnsafeAny only reports the first matching kind (cast wins due to check order) and misses the annotation — acceptable for a heuristic counter but worth a one-line comment noting only one kind is reported per line.
  • review-enrichment/test/unsafe-any.test.ts imports from `../dist/analyzers/unsafe-any.js` (compiled output) rather than source, coupling the test run to a prior build step — consistent with the stated test plan but worth confirming this matches the repo's standard analyzer test convention.
  • Consider a short test case for MAX_LINE_CHARS truncation (a line over 2000 chars) to lock in that guard, since it's currently untested.
  • 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 #2017
Related work ⚠️ 2 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: 1054 registered-repo PR(s), 728 merged, 41 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jony376; Gittensor profile; 1054 PR(s), 41 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: jony376
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: TypeScript, Python, JavaScript, Rust, MDX, Clojure, Cuda, Dart
  • Official Gittensor activity: 1054 PR(s), 41 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #2023, issue #2026)
  • Related work: Titles/paths share 7 meaningful terms. (issue #2033, issue #2026)
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.11%. Comparing base (eba476d) to head (fbc6e49).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3563   +/-   ##
=======================================
  Coverage   93.11%   93.11%           
=======================================
  Files         303      303           
  Lines       31517    31517           
  Branches    11505    11505           
=======================================
  Hits        29346    29346           
  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 7408da9 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

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(enrichment): unsafe-any (TS) counter analyzer

1 participant