Skip to content

feat(enrichment): churn-hotspot analyzer#1882

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
nickmopen:feat/enrichment-churn-hotspot
Jun 30, 2026
Merged

feat(enrichment): churn-hotspot analyzer#1882
JSONbored merged 1 commit into
JSONbored:mainfrom
nickmopen:feat/enrichment-churn-hotspot

Conversation

@nickmopen

Copy link
Copy Markdown
Contributor

Summary

Adds a REES analyzer (#1513) that flags the files a PR changes which are statistical fragility hotspots — a high recent commit frequency and a high fraction of fix/revert commits — so the reviewer scrutinizes areas where defects historically cluster. Additive + fail-safe; fills its own churnHotspot findings key.

Detects (counts from the public commit log only — never file contents)

  • For each changed file (skipping newly-added, lockfiles, generated output, and binaries), reads one page of the file's commit history over a 90-day window via the GitHub commits API.
  • Counts the commits and classifies each subject line as a fix/revert (fix/bugfix/hotfix/revert/regression).
  • Reports a file with ≥ 8 commits and ≥ 30% fixes, with the commit count (+ when the page cap is hit), fix count, and window.

Distinct from the history analyzer (#1478), which scores the author's track record; this scores the change area's defect density.

Implementation (established review-enrichment/ pattern)

  1. ChurnHotspotFinding type + churnHotspot? key in src/types.ts
  2. src/analyzers/churn-hotspot.ts — pure helpers (isFixCommit, summarizeChurn, isHotspot) + scanChurnHotspot(req, fetch, opts), using the shared boundedFetchJson
  3. Registered as a descriptor in src/analyzers/registry.ts (category: history, cost: github-heavy, requires: files + github-token)
  4. Public-safe block in src/render.ts
  5. node:test units in a separate test/churn-hotspot.test.ts; analyzer-metadata.json + the descriptor-derived lists regenerated via npm run metadata

Validation

From review-enrichment/ (Node 24):

npm test   # build + metadata check + node --test: 299 pass / 0 fail

Covers fix-subject classification (incl. lookalikes like prefix/fixture/suffix that must NOT match, and body-vs-subject), count/fraction/threshold logic, hotspot vs low-churn/low-fix, the page-cap (capped) flag, skipping lockfiles/binaries/added files without fetching, token/slug guards, non-ok/throwing-fetch fail-safe, abort, and the rendered block.

Closes #1513

@nickmopen nickmopen requested a review from JSONbored as a code owner June 30, 2026 16:52
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 30, 2026
@gittensory-orb

gittensory-orb Bot commented Jun 30, 2026

Copy link
Copy Markdown

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-06-30 19:18:03 UTC

9 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · unknown

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds a coherent REES churn-hotspot analyzer, registers it, exposes generated metadata/UI docs, and renders a public-safe finding block. The core path is fail-safe and bounded, and the pure helper tests cover the thresholding and subject-line classification well enough for the visible behavior. The notable limitation is that the GitHub commits lookup is intentionally shallow and branch-defaulted, but that matches the stated one-page/public-log design rather than breaking the implementation.

Nits — 6 non-blocking
  • nit: review-enrichment/src/analyzers/churn-hotspot.ts:105 uses `Date.now()` directly, which makes the exact `since` query hard to assert in tests; injecting the clock through options would make this analyzer easier to regression-test.
  • nit: review-enrichment/src/analyzers/churn-hotspot.ts:27 does not classify `bug:` conventional-commit subjects as fixes, so the analyzer may undercount projects that use `bug:` rather than `fix:` or `bugfix`.
  • nit: review-enrichment/test/churn-hotspot.test.ts:38 only verifies the happy-path fetch result and not the generated GitHub URL parameters, so regressions in `path`, `since`, or `per_page` wiring could slip through.
  • review-enrichment/src/analyzers/churn-hotspot.ts:105: add an optional `nowMs` or clock in `ScanOptions` and assert the resulting `since` query in `review-enrichment/test/churn-hotspot.test.ts`.
  • review-enrichment/src/analyzers/churn-hotspot.ts:27: consider whether `bug:` should be included in `FIX_RE`, or document why this analyzer intentionally requires `fix`/`bugfix` wording.
  • 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 #1513
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 (size label size:L; 1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR; address the blocker before review.
Contributor workload ✅ 10/10 Author activity: 90 registered-repo PR(s), 61 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nickmopen; Gittensor profile; 90 PR(s), 1 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Fix the blocker.
  • Triage stale or unlinked PRs.
  • 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

Add a REES analyzer (JSONbored#1513) that flags the changed files which are statistical fragility hotspots — a high
recent commit frequency AND a high fraction of fix/revert commits — so the reviewer scrutinizes defect-prone
areas harder. For each changed (non-added, non-generated) file it reads one page of the file's commit history
from the GitHub commits API over a 90-day window, counts the commits, and classifies each subject line as a
fix/revert. A file with >=8 commits and >=30% fixes is reported. Counts only — never file contents.

Distinct from the history analyzer (JSONbored#1478, author track record); this scores the change AREA's defect density.
Pure helpers (isFixCommit/summarizeChurn/isHotspot) + an injected fetch; registered as a descriptor and rendered
as a public-safe block. Tests in their own file; analyzer-metadata + the descriptor-derived lists regenerated.
@dosubot dosubot Bot added the lgtm Approved by a maintainer. label Jun 30, 2026
@JSONbored JSONbored merged commit 2e6874e into JSONbored:main Jun 30, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. gittensor Gittensor contributor context lgtm Approved by a maintainer. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(enrichment): Churn-hotspot + bug-density scorer

2 participants