feat: add churn-hotspot + bug-density scorer analyzer - #1706
feat: add churn-hotspot + bug-density scorer analyzer#1706Daedalus-Icarus wants to merge 1 commit into
Conversation
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review — held for maintainer review
⏸️ Held for maintainer review Review summary
Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. This adds a REES analyzer for recent per-file commit history, wires it into the brief registry, and renders a public-safe churn-hotspot section. The implementation follows the existing analyzer pattern and has reasonable fail-safe behavior for token/network issues, with aborts propagated through the orchestrator. The main review concern is precision: the first-15 scan cap can silently miss the actual hotspot files in larger PRs, and the classifier is broader than the documented Conventional Commit shape. Nits (5)
🟩 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.
|
|
hi, @JSONbored. I wanted to contribute to this project based on your suggestion (I've already contributed to metagraphed-ui). Could you please review my PR? |
JSONbored
left a comment
There was a problem hiding this comment.
There are merge conflicts that should be fixed before resubmitting this PR - please note, the analyzer issues/PRs can be high-churn as they touch similar files, so be careful of trying to submit without proper preparation and thought/planning, since reviews are one-shot (no change requests, it's either merge or close on first review).
This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/gittensory/pull/1706/conflicts) or the command line to resolve conflicts before continuing.
review-enrichment/src/brief.ts
review-enrichment/src/render.ts
review-enrichment/src/types.ts
review-enrichment/test/enrichment.test.ts
Summary
Adds a REES (review-enrichment service) analyzer that flags changed files which are statistical churn hotspots — high commit frequency AND a high fraction of fix/revert commits in the last 90 days. Defects cluster in such files, so the reviewer scrutinizes harder. This is heavy/historical git-log analysis the no-checkout headless
claude --printreviewer cannot perform; the REES returns it as a brief block the engine splices into the review prompt.The analyzer fetches up to 100 commits per changed file via the GitHub REST commits-by-path endpoint (
GET /repos/{owner}/{repo}/commits?path=<file>&since=<90d>&per_page=100) and classifies each commit subject locally (Conventional Commitfix:/revert/bugfix/hotfix). A file is flagged when it carries ≥10 commits AND ≥30% fix/revert — the two together keep the signal high-precision (a busy file with few fixes is just active; a quiet file with two fixes is not a cluster).Follows the established analyzer pattern end-to-end: finding type → pure analyzer (inject
fetchfor tests) → brief registry → public-safe render block →node:testunits againstdist/. Fail-safe: returns[]on any network error; one file's fetch failure does not abort the rest. Abort propagates asanalyzer_aborted→degraded. Distinct from #1478 (author-track-record), which grades the submitter; this grades the file.Closes #1513.
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥97% coverage of the lines AND branches you changed (aim for 98%+ 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:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
review-enrichment/(a standalone package with its owntsconfig.json,node:testrunner, andpackage.json— seereview-enrichment/package.json). It is outside the worker'ssrc/**/*.tsCodecov scope (codecov.ymlmeasuressrc/**only) and outside the worker's vitest scope (vitest.config.tsinclude: ["test/**/*.test.ts"]is repo-root-relative and does not matchreview-enrichment/test/**). So the worker-side checks above (test:coverage,test:workers,build:mcp,test:mcp-pack,ui:*) are structurally unable to exercise or regress from this change — the checklist is reproduced unchecked only because the form is shared with worker PRs.npm test(=npm run build && node --test) insidereview-enrichment/→ 70/70 pass (56 original + 14 new),tsc -p tsconfig.json→ exit 0.test:cichain has pre-existing environmental failures unrelated to this diff (Windows libuvUV_HANDLE_CLOSINGassertion inmcp-cli-*subprocess tests,spawn claude ENOENTinselfhost-ai, bundled-YAML drift ingittensory-focus-manifest). Verified by stashing the diff and re-running: identical vitest totals (266 files / 4754 tests) with and without these changes. These pass on the upstream Linux CI (Node 22, provisioned toolchain).Safety
UI Evidencesection 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.Notes
codeowners.tsprecedent): any network error or non-ok response yields[]; one file's failure does not abort the rest; only an abort signal propagates asanalyzer_abortedso the orchestrator marks the briefpartial.safeCodeSpan(the same path-forgery guard the other render blocks use).MIN_COMMITS=10,MIN_FIX_REVERT_RATE=0.3,MAX_FILES_REPORTED=15,LOOKBACK_DAYS=90) are committed as named constants at the top of the analyzer, matching how every other analyzer exposes its tuning knobs./^\s*(?:fix\b|revert\b|bugfix\b|hotfix\b)/i) — linear-time, no backtracking risk on adversarial input (the same ReDoS disciplinesecret-log.tsdocuments). Verified against 14 positive/negative cases including body-only mentions and prefix-in-word false positives.