feat(enrichment): flag review/approval integrity signals#2697
Conversation
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-03 07:01:05 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 4 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.
|
32a7065 to
3a95eae
Compare
3a95eae to
22d7a4c
Compare
What
A new local REES analyzer,
approvalIntegrity, that flags review/approval integrity signals a PR's own pagedoesn't always surface without branch protection's "dismiss stale reviews" setting enabled.
Detections (structured PR-reviews API fields only — a bounded, documented schema)
stale-approval— the reviewer's latest APPROVED review predates the PR's current head commit (new commitslanded after the approval).
self-approval— the PR author approved their own PR.outstanding-changes-requested— a reviewer's CURRENT (most recent) review is still CHANGES_REQUESTED, not yetsuperseded by a later review from the same person.
Each reviewer is reduced to their single latest-submitted review before these checks run — the same semantics
GitHub itself uses to decide whether a reviewer's vote is still outstanding. A dismissed review is reported back
by the API with
state: "DISMISSED", so a dismissed CHANGES_REQUESTED naturally stops counting as outstandingwithout any extra handling.
Why it is bounded / merge-safe
It reads only documented fields from the GitHub PR-reviews API (
state,commit_id,user.login,submitted_at) and compares them — never diff, file, or review-body text. There is no text/YAML/code parsing ofany kind, so there are no ambiguous-syntax edge cases to find. Fail-safe throughout: a missing token, missing head
SHA, malformed repo slug, or fetch error all yield no finding rather than an error. Bounded to one page of reviews
(100), which covers the overwhelming majority of PRs. Mirrors the existing
blame-linkanalyzer's structure(same header/fetch helper shape, same
ScanOptions/fail-safe conventions).Value
Reviewers and auto-merge tooling can miss that an "Approved" PR was actually approved before the last few pushes,
that the author approved their own change, or that a CHANGES_REQUESTED review was never actually resolved (just
silently outpaced by new commits). Surfacing these in the review brief closes that gap without requiring the repo
to turn on GitHub's own stale-review-dismissal branch protection.
Tests
review-enrichment/test/approval-integrity.test.tscovers: the latest-per-reviewer reduction (including aPENDING draft exclusion and case-insensitive login grouping), each of the 3 finding kinds, a fresh (non-stale)
approval, a stale+self approval on the same review, no self-approval when the author is unknown, a later APPROVED
superseding an earlier CHANGES_REQUESTED, a dismissed review no longer counting as outstanding, a COMMENTED review
producing no finding, and fail-safe paths (no token, no head SHA, malformed repo slug, fetch failure, empty
reviews, the exact bounded request URL). 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.