Skip to content

feat(enrichment): add package-health analyzer - #3434

Closed
joaovictor91123 wants to merge 1 commit into
JSONbored:mainfrom
joaovictor91123:feat/package-health-analyzer
Closed

feat(enrichment): add package-health analyzer#3434
joaovictor91123 wants to merge 1 commit into
JSONbored:mainfrom
joaovictor91123:feat/package-health-analyzer

Conversation

@joaovictor91123

Copy link
Copy Markdown
Contributor

Summary

  • Adds the packageHealth REES analyzer for newly-added or upgraded npm/PyPI dependencies with maintenance-health signals.
  • Wires the analyzer through REES types, registry metadata, rendered briefs, generated UI analyzer metadata, and the shared analyzer-name list.
  • Adds focused tests for deprecation/yank/stale-release/archive/single-maintainer signals, fetch failures, caps, aborts, metadata freshness, and public-safe rendering.

Fixes #1511

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires >=99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

Additional validation:

  • npm --prefix review-enrichment run build
  • node review-enrichment/test/package-health.test.ts
  • node review-enrichment/test/analyzer-registry.test.ts
  • node review-enrichment/scripts/generate-analyzer-metadata.mjs --check
  • npm run db:migrations:check

If any required check was skipped, explain why:

  • npm run test:coverage was not run locally; this change is covered by the focused REES analyzer suite and CI will run coverage in its Linux environment.
  • npm run test:mcp-pack was not run; this PR does not change MCP packaging.
  • npm run ui:openapi:check was not run separately; npm run ui:build regenerated OpenAPI successfully and the intended UI change is generated REES analyzer metadata.
  • npm run ui:lint was not run locally; this PR does not touch UI source beyond generated analyzer metadata.
  • npm run rees:test was also run locally: 1017/1019 tests passed; the two failures were existing Sentry CLI upload tests whose mocked process returned a Windows-style null status. The new package-health tests passed in that run.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

No visible UI change. The UI diff is generated analyzer metadata consumed by the existing REES analyzer reference surface.

Notes

  • The analyzer reports package metadata only and does not include manifest lines, registry response bodies, install scripts, or repository content in the rendered brief.

@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:priority Maintainer-selected Gittensor priority — scores a 1.5x 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 07:01:11 UTC

11 files · 1 AI reviewer · 1 blocker · readiness 62/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • AI reviewers agree on a likely critical defect: review-enrichment/src/analyzers/package-health.ts:185 uses `packument.users` as a fallback maintainer count, but npm packument `users` is not maintainer metadata, so a package with no `maintainers` array and one starred/user entry will be reported as `sole-maintainer`
  • drop that fallback or replace it with a real maintainer source, e.g. `const maintainerCount = typeof ecosystems?.maintainers_count === "number" ? ecosystems.maintainers_count : Array.isArray(packument?.maintainers) ? packument.maintainers.length : undefined
  • `. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
The PR coherently adds a bounded package-health analyzer and wires it through registry metadata, rendering, generated analyzer metadata, UI metadata, types, docs, and focused tests. The fetch limits, abort handling, public-safe rendering, and registry failure behavior are covered. I found one reachable correctness issue in the npm maintainer signal: it can report a single maintainer from npm `users`, which is not maintainer metadata.

Blockers

  • review-enrichment/src/analyzers/package-health.ts:185 uses `packument.users` as a fallback maintainer count, but npm packument `users` is not maintainer metadata, so a package with no `maintainers` array and one starred/user entry will be reported as `sole-maintainer`; drop that fallback or replace it with a real maintainer source, e.g. `const maintainerCount = typeof ecosystems?.maintainers_count === "number" ? ecosystems.maintainers_count : Array.isArray(packument?.maintainers) ? packument.maintainers.length : undefined;`.
Nits — 6 non-blocking
  • nit: review-enrichment/src/analyzers/package-health.ts:135 and review-enrichment/src/analyzers/package-health.ts:149 duplicate the 160-character detail truncation limit; a named `MAX_SIGNAL_DETAIL_CHARS` would make the sanitizer boundary easier to audit.
  • nit: review-enrichment/src/analyzers/package-health.ts:299 fetches ecosyste.ms before the primary registry for every dependency, so a slow auxiliary source delays even deprecated/yanked registry findings; consider fetching the two sources concurrently unless the serial ordering is intentional.
  • Change `classifyNpmPackageHealth` to ignore `packument.users` for maintainer count and update the test currently asserting that fallback in review-enrichment/test/package-health.test.ts.
  • Add a test that npm packuments with `users: { alice: true }` and no `maintainers` do not emit `sole-maintainer`.
  • Consider naming the shared signal-detail truncation limit in review-enrichment/src/analyzers/package-health.ts so future render/sanitizer changes have one obvious boundary.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.

Why this is blocked

  • review-enrichment/src/analyzers/package-health.ts:185 uses `packument.users` as a fallback maintainer count, but npm packument `users` is not maintainer metadata, so a package with no `maintainers` array and one starred/user entry will be reported as `sole-maintainer`; drop that fallback or replace it with a real maintainer source, e.g. `const maintainerCount = typeof ecosystems?.maintainers_count === "number" ? ecosystems.maintainers_count : Array.isArray(packument?.maintainers) ? packument.maintainers.length : undefined;`.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #1511
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: 108 registered-repo PR(s), 61 merged, 8 issue(s).
Contributor context ✅ Confirmed Gittensor contributor joaovictor91123; Gittensor profile; 108 PR(s), 8 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: joaovictor91123
  • 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: 108 PR(s), 8 issue(s).
  • Related work: Titles/paths share 5 meaningful terms. (issue #1477, issue #1514)
  • Related work: Titles/paths share 5 meaningful terms. (issue #1514, issue #2025)
  • Related work: Titles/paths share 6 meaningful terms. (issue #2015, issue #2017)
  • 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.46%. Comparing base (5279b37) to head (ca3b356).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3434   +/-   ##
=======================================
  Coverage   93.46%   93.46%           
=======================================
  Files         291      291           
  Lines       30792    30792           
  Branches    11223    11223           
=======================================
  Hits        28781    28781           
  Misses       1355     1355           
  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.

@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/package-health.ts:185 uses `packument.users` as a fallback maintainer count, but npm packument `users` is not maintainer metadata, so a package with no `maintainers` array and one starred/user entry will be reported as `sole-maintainer`; drop that fallback or replace it with a real maintainer source, e.g. `const maintainerCount = typeof ecosystems?.maintainers_count === "number" ? ecosystems.maintainers_count : Array.isArray(packument?.maintainers) ? packument.maintainers.length : undefined;`.). 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(enrichment): Package maintenance-health / deprecated-dep scorer

1 participant