Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ GITTENSORY_REVIEW_ENRICHMENT=false
# blameLink,approvalIntegrity,ciCheckSignals,undocumentedExport,staleBranch,commitHygiene
# pendingReviewRequests,testRatio,migrationSafety,looseRange,terminology,todoMarker,magicNumber
# conflictMarker,debugLeftover,sizeSmell,floatingPromise,deepNesting,errorSwallow,unsafeAny,a11y
# i18n,unusedExport,exhaustiveness,flakyTest,commitLint,apiBreak,deprecatedDep
# i18n,unusedExport,exhaustiveness,flakyTest,commitLint,apiBreak,deprecatedDep,revertRecurrence
#
# Profile defaults:
# fast: dependency,dependencyDiff,lockfileDrift,secret,license,installScript,heavyDependency
Expand All @@ -84,14 +84,14 @@ GITTENSORY_REVIEW_ENRICHMENT=false
# commitHygiene,pendingReviewRequests,testRatio,migrationSafety,looseRange,terminology
# todoMarker,magicNumber,conflictMarker,debugLeftover,sizeSmell,floatingPromise,deepNesting
# errorSwallow,unsafeAny,a11y,i18n,unusedExport,exhaustiveness,flakyTest,commitLint,apiBreak
# deprecatedDep
# deprecatedDep,revertRecurrence
# deep: dependency,dependencyDiff,lockfileDrift,secret,license,installScript,heavyDependency
# hardcodedUrl,actionPin,eol,redos,provenance,codeowners,secretLog,assetWeight,typosquat
# commitSignature,iacMisconfig,nativeBuild,history,docCommentDrift,duplication,churnHotspot
# blameLink,approvalIntegrity,ciCheckSignals,undocumentedExport,staleBranch,commitHygiene
# pendingReviewRequests,testRatio,migrationSafety,looseRange,terminology,todoMarker,magicNumber
# conflictMarker,debugLeftover,sizeSmell,floatingPromise,deepNesting,errorSwallow,unsafeAny,a11y
# i18n,unusedExport,exhaustiveness,flakyTest,commitLint,apiBreak,deprecatedDep
# i18n,unusedExport,exhaustiveness,flakyTest,commitLint,apiBreak,deprecatedDep,revertRecurrence
# END GENERATED REES ANALYZERS

# Submitter-reputation spend control (internal-only): downgrades new/burst/low-rep
Expand Down
27 changes: 27 additions & 0 deletions apps/gittensory-ui/src/lib/rees-analyzers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,33 @@ export const REES_ANALYZERS = [
"Conservative: only an exact match against the bundled list is flagged, so a package it does not name is never reported. Bounded by manifest, patch-line, and finding caps; fail-safe on absent patches or an aborted signal.",
},
},
{
name: "revertRecurrence",
title: "Revert recurrence",
category: "history",
cost: "github-heavy",
defaultEnabled: true,
profiles: ["balanced", "deep"],
requires: ["files", "github-token"],
limits: {
maxFilesProbed: 5,
commitsPerFile: 15,
maxRevertLookups: 10,
maxFindings: 25,
},
docs: {
summary:
"Flags a changed file where the PR re-introduces added lines in a region a prior revert commit removed — a signal it may be re-treading a path that was already reverted or hot-fixed out.",
looksAt:
"For each changed file's added line-ranges, the file's recent commit history and the patch of any revert commit in it, intersecting the reverted (removed) old-file line-ranges with this PR's added new-file line-ranges.",
reports:
"File, a re-introduced line, a short revert commit-SHA prefix, and the reverted PR number when the revert message names one — never file contents.",
network:
"Calls the GitHub commits API per probed file and the single-commit API per revert commit, both bounded by fixed fanout caps. Requires GitHub token forwarding for private repos.",
notes:
"Conservative: only a message-confirmed revert commit whose removed range overlaps an added range is reported (one finding per file); line-range overlap is a heuristic across history, and lockfiles/generated/binary paths are skipped. Fail-safe on missing token/invalid slug/fetch error or an aborted signal.",
},
},
] as const satisfies readonly ReesAnalyzerDoc[];

export const REES_ANALYZER_NAMES = REES_ANALYZERS.map((analyzer) => analyzer.name);
28 changes: 28 additions & 0 deletions review-enrichment/analyzer-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,34 @@
"network": "Pure local analyzer. No external network call; the curated list is bundled.",
"notes": "Conservative: only an exact match against the bundled list is flagged, so a package it does not name is never reported. Bounded by manifest, patch-line, and finding caps; fail-safe on absent patches or an aborted signal."
}
},
{
"name": "revertRecurrence",
"title": "Revert recurrence",
"category": "history",
"cost": "github-heavy",
"defaultEnabled": true,
"profiles": [
"balanced",
"deep"
],
"requires": [
"files",
"github-token"
],
"limits": {
"maxFilesProbed": 5,
"commitsPerFile": 15,
"maxRevertLookups": 10,
"maxFindings": 25
},
"docs": {
"summary": "Flags a changed file where the PR re-introduces added lines in a region a prior revert commit removed — a signal it may be re-treading a path that was already reverted or hot-fixed out.",
"looksAt": "For each changed file's added line-ranges, the file's recent commit history and the patch of any revert commit in it, intersecting the reverted (removed) old-file line-ranges with this PR's added new-file line-ranges.",
"reports": "File, a re-introduced line, a short revert commit-SHA prefix, and the reverted PR number when the revert message names one — never file contents.",
"network": "Calls the GitHub commits API per probed file and the single-commit API per revert commit, both bounded by fixed fanout caps. Requires GitHub token forwarding for private repos.",
"notes": "Conservative: only a message-confirmed revert commit whose removed range overlaps an added range is reported (one finding per file); line-range overlap is a heuristic across history, and lockfiles/generated/binary paths are skipped. Fail-safe on missing token/invalid slug/fetch error or an aborted signal."
}
}
]
}
43 changes: 43 additions & 0 deletions review-enrichment/src/analyzers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { scanExhaustivenessDrift } from "./exhaustiveness-drift.js";
import { scanFlakyTest } from "./flaky-test.js";
import { scanApiBreak } from "./api-break.js";
import { scanDeprecatedDependencies } from "./deprecated-dep.js";
import { scanRevertRecurrence } from "./revert-recurrence.js";
import type {
AnalyzerDescriptor,
AnalyzerFn,
Expand Down Expand Up @@ -1446,6 +1447,48 @@ export const ANALYZER_DESCRIPTORS = [
},
run: (req, { signal }) => scanDeprecatedDependencies(req, signal),
}),
descriptor({
name: "revertRecurrence",
title: "Revert recurrence",
category: "history",
cost: "github-heavy",
defaultEnabled: true,
requires: ["files", "github-token"],
limits: {
maxFilesProbed: 5,
commitsPerFile: 15,
maxRevertLookups: 10,
maxFindings: 25,
},
docs: {
summary:
"Flags a changed file where the PR re-introduces added lines in a region a prior revert commit removed — a signal it may be re-treading a path that was already reverted or hot-fixed out.",
looksAt:
"For each changed file's added line-ranges, the file's recent commit history and the patch of any revert commit in it, intersecting the reverted (removed) old-file line-ranges with this PR's added new-file line-ranges.",
reports:
"File, a re-introduced line, a short revert commit-SHA prefix, and the reverted PR number when the revert message names one — never file contents.",
network:
"Calls the GitHub commits API per probed file and the single-commit API per revert commit, both bounded by fixed fanout caps. Requires GitHub token forwarding for private repos.",
notes:
"Conservative: only a message-confirmed revert commit whose removed range overlaps an added range is reported (one finding per file); line-range overlap is a heuristic across history, and lockfiles/generated/binary paths are skipped. Fail-safe on missing token/invalid slug/fetch error or an aborted signal.",
},
render: (findings, helpers) => {
if (!findings.length) return [];
const lines = [
"### Revert recurrence (re-introduces code from a previously reverted region)",
];
for (const item of findings) {
const pr =
item.revertedPr !== undefined ? ` (revert of #${item.revertedPr})` : "";
lines.push(
`- ${helpers.safeCodeSpan(`${item.file}:${item.line}`)} overlaps a region removed by revert commit ${helpers.safeCodeSpan(item.revertShaPrefix)}${pr}`,
);
}
return lines;
},
run: (req, { signal, analysis, diagnostics }) =>
scanRevertRecurrence(req, fetch, { signal, analysis, diagnostics }),
}),
] as const satisfies readonly AnyAnalyzerDescriptor[];

export const ANALYZER_NAMES = ANALYZER_DESCRIPTORS.map(
Expand Down
Loading
Loading