feat(enrichment): flag PRs significantly behind the default branch#2725
Closed
jaso0n0818 wants to merge 1 commit into
Closed
feat(enrichment): flag PRs significantly behind the default branch#2725jaso0n0818 wants to merge 1 commit into
jaso0n0818 wants to merge 1 commit into
Conversation
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
JSONbored
reviewed
Jul 3, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
Not something we need, closing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new local REES analyzer,
staleBranch, that flags a PR whose head is significantly behind the repo's currentdefault branch — a staleness risk GitHub's own PR page doesn't summarize as a number (it only shows an
"out-of-date" badge, not how far).
Detection (structured GitHub repo + compare API fields only — a bounded, documented schema)
default_branch, then compares it against the PR's head via the GitHub compare API.behind_by >= 100commits.Why it is bounded / merge-safe
It reads only documented fields from the GitHub repo API (
default_branch) and the compare API (behind_by) andcompares a single number against a fixed threshold — never diff, commit, or file content. There is no
text/YAML/code parsing, so there are no ambiguous-syntax edge cases. Fail-safe throughout: a missing token,
missing head SHA, malformed repo slug, a missing/non-numeric
behind_by, or either fetch failing all yield nofinding rather than an error (the repo-info fetch failing short-circuits before ever calling compare). Mirrors
the existing
blame-link/approval-integrity/ci-check-signalsanalyzers' structure (same header/fetchhelper shape, same
ScanOptions/fail-safe conventions, a pure reducer separated from the network entrypoint).Value
A branch far behind the current default branch is more likely to hide a subtle semantic conflict that a clean
mergeablecheck alone would miss — the merge itself can be mechanically clean while the combined result isstill wrong. Surfacing how far behind (not just "out of date") gives a reviewer a concrete signal for whether a
rebase is worth requesting before merge.
Tests
review-enrichment/test/stale-branch.test.tscovers: the pureevaluateStaleBranchreduction (the threshold'sboundary in both directions, the identical/ahead cases, and fail-closed on a missing/non-numeric/negative
behind_by), plus the network entrypoint's fail-safe paths (no token, no head SHA, malformed repo slug, therepo-info fetch failing without ever calling compare, a repo response missing
default_branch, the compare fetchfailing) and the exact two-request URL shape. Analyzer metadata is regenerated and committed.
No linked issue
No linked issue because this is a net-new analyzer; there is no tracking issue to link.