Skip to content

feat(enrichment): add revert-recurrence detector for review brief - #1753

Closed
jeffrey701 wants to merge 1 commit into
JSONbored:mainfrom
jeffrey701:feat/revert-recurrence-analyzer
Closed

feat(enrichment): add revert-recurrence detector for review brief#1753
jeffrey701 wants to merge 1 commit into
JSONbored:mainfrom
jeffrey701:feat/revert-recurrence-analyzer

Conversation

@jeffrey701

Copy link
Copy Markdown
Contributor

Summary

Adds a REES analyzer that detects when a PR is reverting or re-introducing previously reverted work — a common source of regressions and review churn the no-checkout claude --print reviewer cannot spot at a glance.

Closes #1696.

Signals (pure; only the request the engine already has — no repo checkout)

  • explicit-revert — revert/rollback/re-introduce language in the PR title or body, including GitHub's Revert "…" titles (captures the reverted subject) and reverts commit <sha> (captures the sha).
  • symmetric-churn — a file whose diff removes lines that re-appear as additions (distinct-line overlap ≥ 3 and ≥ half the larger side) — the textual fingerprint of a revert / re-introduce. Ordinary mostly-new or mostly-deleted edits are not flagged.

Changes (all within review-enrichment/)

  • src/analyzers/revert-recurrence.ts — new scanRevertRecurrence(req) (fail-safe: [] on empty input).
  • src/types.tsRevertRecurrenceFinding + revertRecurrence? on BriefFindings.
  • src/brief.ts — register the analyzer.
  • src/render.ts — a dedicated "Revert / re-introduce recurrence" brief section.
  • test/revert-recurrence.test.ts — explicit titles/bodies, reverts commit <sha>, free-text rollback, symmetric churn (incl. ignoring +++/--- headers), non-revert edits, empty input, and the rendered section.

Acceptance criteria

  • Detects explicit revert titles/bodies
  • Flags symmetric churn patterns in diff hunks
  • Fail-safe: returns [] on empty input
  • Brief renders a dedicated revert-recurrence section when findings exist

Validation

  • npm --prefix review-enrichment test (build + sourcemap validation + node --test) → 165 tests pass.
  • Change is isolated to the review-enrichment/ package (in wantedPaths); src/** does not import it, so the root typecheck/coverage/workers/UI gate is unaffected, and there is no src/** Codecov-patch surface.

Add a REES analyzer that flags when a PR is reverting or re-introducing
previously reverted work — a common regression / review-churn source the
no-checkout reviewer cannot spot at a glance.

Two signals, from the request the engine already has (no repo checkout):
- explicit-revert: revert/rollback/re-introduce language in the PR title or
  body, including GitHub's `Revert "…"` titles (captures the subject) and
  `reverts commit <sha>` (captures the sha).
- symmetric-churn: a file whose diff removes lines that re-appear as
  additions (overlap >= 3 and >= half the larger side) — the textual
  fingerprint of a revert / re-introduce, while ordinary mostly-new or
  mostly-deleted edits are not flagged.

Wires the analyzer into the registry (brief.ts), the structured findings
(types.ts), and a dedicated "Revert / re-introduce recurrence" brief
section (render.ts). Fail-safe: returns [] on empty input.

Tests cover explicit titles/bodies, the commit-sha body line, free-text
rollback language, symmetric churn (incl. ignoring +++/--- headers),
non-revert edits, empty input, and the rendered section.

Closes JSONbored#1696
@jeffrey701
jeffrey701 requested a review from JSONbored as a code owner June 29, 2026 17:08
@dosubot dosubot Bot added the size:L label Jun 29, 2026
@loopover-orb

loopover-orb Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-06-29 21:52:11 UTC

5 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · dirty

⏸️ Suggested Action - Manual Review

Review summary
This change adds a REES analyzer for explicit revert language and same-file symmetric churn, wires it into the brief builder, renders a dedicated section, and covers the main intended paths in tests. The implementation is coherent and CI passed; the main maintainability concern is that the rendered explicit-revert reason can carry raw PR-title/body-derived text into the prompt brief instead of using the renderer’s existing escaping helpers.

Nits — 6 non-blocking
  • nit: review-enrichment/src/render.ts:267 renders item.reason directly, so explicit-revert subjects parsed from PR title/body should be escaped with promptText or represented via safeCodeSpan before entering the prompt brief.
  • nit: review-enrichment/src/analyzers/revert-recurrence.ts:44 trims diff lines before comparing them, which makes whitespace-only indentation changes look like identical removed/re-added lines; document that choice or compare a normalized-but-not-fully-trimmed body if indentation matters.
  • nit: review-enrichment/src/analyzers/revert-recurrence.ts:9 caps symmetric-churn scanning to the first 50 files without surfacing truncation, so large PRs can silently skip later matching files.
  • In review-enrichment/src/render.ts:267, render explicit revert subjects as escaped structured fields instead of trusting the preformatted reason string.
  • In review-enrichment/src/analyzers/revert-recurrence.ts:44, add a test for indentation-only line changes so the distinct-line normalization behavior is intentional.
  • 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 #1696
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: 29 registered-repo PR(s), 16 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jeffrey701; Gittensor profile; 29 PR(s), 0 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

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR itself is valid/no problems, but there are now merge conflicts (previously submitted PR was merged that touched the same files).

This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/gittensory/pull/1753/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

Closing.

@JSONbored JSONbored closed this Jun 29, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 29, 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 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(enrichment): revert-recurrence detector for review brief

2 participants