feat(enrichment): add revert-recurrence detector#3647
Conversation
Adds a history-class review-enrichment analyzer (JSONbored#1514, part of JSONbored#1499) that flags a changed file when the PR re-introduces added lines in a region a prior revert commit removed - a signal the change may be re-treading a path that was already reverted or hot-fixed out. For each changed file it reads recent commit history, detects revert commits (Revert "..." subject or a "This reverts commit <sha>" body), fetches each revert commit patch, and intersects the reverted old-file line ranges with the PR added new-file line ranges. Reports only the file, a re-introduced line, a short revert-SHA prefix, and the reverted PR number when named - never file contents. Bounded fan-out (5 files / 15 commits / 10 revert lookups / 25 findings); fail-safe on missing token, invalid slug, fetch error, or abort. Wires the descriptor into the registry, render, types, UI docs, refreshed metadata, and the analyzer-name lists, with full unit coverage.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3647 +/- ##
=======================================
Coverage 93.13% 93.13%
=======================================
Files 314 314
Lines 32005 32005
Branches 11725 11725
=======================================
Hits 29807 29807
Misses 1552 1552
Partials 646 646
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 22:21:00 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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.
|
Closes #1514 (part of #1499).
What
Adds a history-class review-enrichment analyzer,
revertRecurrence, that flags a changed file when the PR re-introduces added lines in a region a prior revert commit removed — a signal the change may be re-treading a path that was already reverted or hot-fixed out. This is heavy/external/historical analysis the no-checkoutclaude --printreviewer cannot do.How
For each changed file (bounded to the first 5 informative paths — lockfiles/generated/binaries skipped):
?path=, 15 commits).Revert "<title> (#N)"subject or a hand-writtenThis reverts commit <sha>body.Distinct from churn-hotspot (#1513, defect density) and history (#1478, author track record): this intersects the PR's added lines with a specific past revert's removed lines.
Fail-safe: any missing token / invalid slug / non-200 / thrown fetch / aborted signal degrades that lookup (or the whole scan) to
[], never throwing. Bounded fan-out throughout (5 files / 15 commits / 10 revert lookups / 25 findings).Wiring
Registry descriptor (category
history, costgithub-heavy,balanced/deepprofiles), render section,types.ts, UIrees-analyzers.tsdocs, refreshedanalyzer-metadata.json, and both analyzer-name lists (enrichment-analyzer-names.ts,analyzer-registry.test.ts). Metadata is drift-checked.Tests
New
test/revert-recurrence.test.tsunit-covers the pure helpers (isRevertCommit,revertedPrNumber,diffLineRanges,rangesOverlap,firstOverlap) and the scanner: overlap hit, body-style revert without PR number, no-revert (no detail fetch), non-overlapping revert, wrong-file revert, missing-sha skip, empty-add skip, lockfile/binary skip, token/slug guards, the revert-lookup cap, fetch/detail fail-safe, aborted signal, and the public-safe render block. Full REES suite green; root + UI typecheck, UI lint (0 errors), and coverage all pass, withsrc/review/enrichment-analyzer-names.tsat 100%.