fix(review): skip re-publishing a PR surface already current at its head (#1615) - #1616
Merged
Merged
Conversation
…ead (#1615) The scheduled re-gate sweep re-reviewed + re-published every open PR's public surface every ~2-min cycle regardless of change (~4292 pr_public_surface_published in 2h for ~64 PRs). The sticky comment was PATCHed unconditionally and no per-PR marker recorded the head the surface was last published at. Add pull_requests.last_published_surface_sha (migration 0080), stamped head_sha- keyed after a successful publish and omitted from the GitHub-sync SET clause like the sibling approved_head_sha marker. In reReviewStoredPullRequest, after the live-head resync, skip the re-review + re-publish when the marker equals the live head. A never-published PR (NULL marker) or a changed head (push/rebase/force-push) falls through and re-reviews at the new head; the head_sha-keyed AI cache also misses on a rebase, so rebases are never skipped (pinned by a regression test). Also skip the comment PATCH when the body is byte-identical. Folds in the proof-of-power-stats count-up flake fix (force prefers-reduced-motion so the value settles synchronously instead of racing a 3s findByText on the rAF tween — it flaked the ui job repeatedly).
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 5e8d319 | Commit Preview URL Branch Preview URL |
Jun 27 2026, 07:06 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1616 +/- ##
=======================================
Coverage 95.51% 95.51%
=======================================
Files 204 204
Lines 22041 22050 +9
Branches 7963 7966 +3
=======================================
+ Hits 21052 21061 +9
Misses 413 413
Partials 576 576
🚀 New features to boost your workflow:
|
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.
Summary
The scheduled re-gate sweep re-reviewed + re-published every open PR's public surface every ~2-min cycle regardless of change (~4292
pr_public_surface_publishedin 2h for ~64 PRs). The comment was PATCHed unconditionally and there was no per-PR record of the head the surface was last published at, so the sweep couldn't tell a current PR from a changed one. (AI spend was already deduped via the head_sha-keyedai_review_cache; this was GitHub-write/processing churn.)This adds a head_sha-keyed published marker and a sweep skip-guard so the engine only re-reviews/re-publishes non-reviewed or changed PRs:
pull_requests.last_published_surface_sha(migration0080) — stamped (head_sha-pinned) after a successful publish. Omitted from the GitHub-sync SET clause like the siblingapproved_head_sha/merge_blocked_shamarkers, so a later sync can't clobber it.reReviewStoredPullRequest, placed after the live-head resync (so the compare uses the live head): skip the re-review + re-publish whenlast_published_surface_sha === head_sha. A never-published PR (NULL marker) or a changed head (push/rebase/force-push → marker ≠ live head) falls through and re-reviews at the new head. The webhook synchronize/opened paths review directly and always re-stamp — this guard only gates the sweep.proof-of-power-stats.test.tsxcount-up test forced the prefers-reduced-motion path so the value settles synchronously instead of racing a 3sfindByTexton the rAF tween (it flaked theuijob on fix(selfhost): route single-provider AI through the name-aware router (#1610) #1611 and fix(selfhost): surface the CLI's structured stdout error before the exit code (#1612) #1613). Verified deterministic across 5 runs.Rebase re-review is explicitly preserved and pinned by a test: a rebased PR's old-head marker ≠ the live head → it resyncs + re-reviews at the new head (the head_sha-keyed AI cache also misses) → it's never skipped. Expected effect:
pr_public_surface_publisheddrops from ~1/PR/sweep to ~1/PR/head_sha.Closes #1615. Also resolves the #7 ui flake (no separate PR).
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patch≥97% — covered: skip-guard (skip / rebase-fall-through / marker-null),markPullRequestSurfacePublished(stamp / null no-op / stale-head no-op), the publish stamp call + its fail-open catch, and bothhtml_urlarms of the comment-idempotency early return.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
cf-typegenregeneration: no route/schema orwrangler.jsoncchange. The DB change is a hand-written contiguous migration0080(the repo's convention forpull_requestscolumns — see0053_pr_approved_head_sha.sql,0062_pr_last_regated_at.sql);db:migrations:checkpasses.Safety
UI Evidence— N/A (no visible UI change).Notes