fix(review): invalidate findings when targeted diff hunks disappear on force-push (#336)#397
Open
devops-thiago wants to merge 2 commits into
Open
fix(review): invalidate findings when targeted diff hunks disappear on force-push (#336)#397devops-thiago wants to merge 2 commits into
devops-thiago wants to merge 2 commits into
Conversation
…ff (#336) A force-push can remove the code a prior finding targeted; the model can still report it "unresolved", holding APPROVE over code that no longer exists. Vanished findings are now rewritten to a synthetic "superseded" status (judged by DiffLineResolver.isFindingPresent on the persisted anchor), surfaced in the summary counts, and the regenerated summary is re-posted on follow-up so it no longer describes removed code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
🤖 ThrillhouseBot PR SummaryWhat this PR doesOn a follow-up review after a force-push, each model-reported 'unresolved' finding is re-checked against the current diff using its suggestion_old anchor. If the anchored hunk is gone, the status is rewritten to 'superseded' so it no longer blocks APPROVE. When any finding is superseded, a revised summary comment is posted.
|
| File | Change | Summary |
|---|---|---|
src/main/java/dev/thiagogonzaga/thrillhousebot/review/FollowUpAnalyzer.java |
Modified | Adds supersedeVanished method that rewrites unresolved to superseded when the anchored code is gone, and includes superseded in toStatuses. |
src/main/java/dev/thiagogonzaga/thrillhousebot/review/PrSummaryGenerator.java |
Modified | Adds a 'Superseded' row to the Previous Findings Status table when there is at least one superseded finding. |
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ReviewPublisher.java |
Modified | Triggers a summary re-post on follow-up reviews when a finding was superseded, so the comment reflects the new statuses. |
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ReviewResult.java |
Modified | Adds hasSupersededPrevious() method to detect when a prior finding was superseded this round. |
src/main/java/dev/thiagogonzaga/thrillhousebot/review/VerdictBuilder.java |
Modified | Calls supersedeVanished before the APPROVE gates, builds an effective response with superseded statuses, and uses that for unresolved count and backstop. |
src/test/java/dev/thiagogonzaga/thrillhousebot/review/FollowUpAnalyzerTest.java |
Modified | - |
src/test/java/dev/thiagogonzaga/thrillhousebot/review/PrSummaryGeneratorTest.java |
Modified | - |
src/test/java/dev/thiagogonzaga/thrillhousebot/review/ReviewPublisherTest.java |
Added | - |
src/test/java/dev/thiagogonzaga/thrillhousebot/review/VerdictBuilderTest.java |
Modified | Integration tests for VerdictBuilder with real FollowUpAnalyzer: vanished file APPROVEs, present file holds REQUEST_CHANGES. |
Risk Assessment
| Risk | Count |
|---|---|
| 🔴 Critical | 0 |
| 🟠 High | 0 |
| 🟡 Medium | 1 |
| 🔵 Low | 0 |
Key Findings
- MEDIUM: Summary re-post does not delete the old comment, causing duplicate summaries (
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ReviewPublisher.java:96)
⚠️ Required CI Checks Status
Some required checks are still pending or have failed:
| Check | Type | Status | Detail |
|---|---|---|---|
| dependency-review | check-run | ⏳ Pending | - |
| format | missing | ⏳ Pending | - |
| test | missing | ⏳ Pending | - |
| frontend | missing | ⏳ Pending | - |
| trivy | missing | ⏳ Pending | - |
Automated review by ThrillhouseBot. Reply with /review to re-run.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…of stacking a new comment (#336) Re-posting left the stale summary (describing removed code) visible next to the fresh one. The superseded path now finds the bot's newest summary comment and PATCHes it, creating a new comment only when none exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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 type of PR is this?
Description
Dogfood on #299 showed that after a force-push removed the code a prior finding targeted, the bot still held the finding open ("unresolved") and the summary kept describing code that no longer existed.
This PR adds a stale-finding lifecycle on the inline/model-status path (the deterministic backstop from #118 already checked presence; the model-reported path did not):
FollowUpAnalyzer.supersedeVanished: before the APPROVE gates run, each model-reportedunresolvedstatus is re-checked against the current diff viaDiffLineResolver.isFindingPresenton the finding's persistedsuggestion_oldanchor. If the anchored hunk is gone (file left the diff or the hunk vanished), the status is rewritten to a syntheticsupersededwith an explanatory note — it no longer blocks APPROVE and no longer entersoutstanding, so it can't force REQUEST_CHANGES either.unresolvedand out-of-range statuses pass through untouched. The existing backstop path is unchanged (it already filters by presence).toStatuseskeeps the synthetic status, and the summary's "Previous Findings Status" table gains a🗂️ Superseded (targeted code left the diff)row (only when > 0).ReviewPublisher.publishSummarynow also posts the freshly regenerated summary on a follow-up review when a prior finding was superseded (ReviewResult.hasSupersededPrevious()), so the visible summary no longer describes removed code.Related Issues
Fixes #336
How Has This Been Tested?
Unit tests
Integration tests
Manual testing
FollowUpAnalyzerTest: supersede on vanished file, presence judged by anchor (not just file), null-file / non-unresolved / out-of-range statuses untouched, missing-input pass-through,toStatuseskeepssuperseded.VerdictBuilderTest(realFollowUpAnalyzer): force-push removes the file → prior unresolved finding is superseded and the review APPROVEs; finding still present in the diff → still holds (REQUEST_CHANGES).PrSummaryGeneratorTest: superseded row rendered only when a finding was superseded.ReviewPublisherTest(new): follow-up with a superseded finding re-posts the summary; plain follow-up does not../mvnw verifygreen locally (1600 tests, Spotless, SpotBugs, JaCoCo); no uncovered changed lines.Checklist
🤖 Generated with Claude Code