fix(gate): refresh PR files on manual review rerun - #928
Conversation
The webhook gate path refreshes the PR's files before evaluating the slop and manifest-policy gates (JSONbored#866/JSONbored#925), but the manual 'Re-run Gittensory review' retrigger called the same publish path without refreshing. A user re-running after pushing commits got the slop/manifest gate evaluated against stale (or empty) cached files, so the re-published Gate check reflected the wrong diff. Mirror the webhook guard: refresh the PR files before publishing on the retrigger path too. refreshPullRequestDetails is fail-safe (preserves the cache on a fetch error). Closes JSONbored#927
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 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. |
🔍 Maintainer reviewReviewed 2 file(s) — ✅ all CI green. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · No blocking issues spotted. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #928 +/- ##
=======================================
Coverage 96.60% 96.61%
=======================================
Files 110 110
Lines 14926 14928 +2
Branches 5398 5399 +1
=======================================
+ Hits 14420 14422 +2
Misses 104 104
Partials 402 402 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
The webhook gate path refreshes the PR's changed files before evaluating the slop and focus-manifest-policy gates (#866/#925) — the refresh is the caller's job, since
maybePublishPrPublicSurfaceonly reads the cached files (listPullRequestFiles):But
maybePublishPrPublicSurfacehas two callers. The manual "Re-run Gittensory review" retrigger (maybeProcessPrPanelRetrigger) called it with no refresh (andbuildAuthorizedPrActionAdvisorydoesn't refresh either):Impact: the retrigger is a re-evaluation surface — a user clicks it after the PR changed. Without the refresh, the slop gate (file additions/paths) and manifest-policy gate (blocked paths, missing-tests over changed paths) compute against stale (or empty, if never synced) cached files, so the re-published required Gate check reflects the wrong diff — the exact stale-gate class #866/#925 set out to eliminate, left unaddressed on the second caller.
Fix
Mirror the webhook guard in
maybeProcessPrPanelRetrigger, before the publish:refreshPullRequestDetailsis already imported and fail-safe (#866: preserves the cached files and returnsstatus: "partial"on a fetch error), so it never makes the retrigger worse on an API hiccup. The slop/manifest findings are computed insidemaybePublishPrPublicSurfaceafter the refresh — identical ordering to the webhook path.Tests
Added a regression test: a maintainer rerun with
slopGateModeenabled now fetches/pulls/<n>/files(the refresh) before publishing, and the retrigger still auditscompleted. The existing rerun test (gates off → guard not taken) is unchanged, so both arms of the new guard are exercised.Full unit suite green locally (2219 passed; only the known local-only CRLF
gittensory-focus-manifesttest fails locally, passes in CI).Closes #927