Polish attestation commit (faster, better head check, correct push)#8823
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the “attestation commit” review flow by wiring an optional attestation commit through webview review submission, optimizing timeline updates to avoid unnecessary refreshes, and tightening the approval head-SHA check when the extension just pushed a commit.
Changes:
- Add an “Add attestation” checkbox to the pending review summary UI and plumb
addAttestationthrough review submit/request-changes/approve commands. - Avoid a full timeline refetch after pushing an attestation commit by sending a synthetic
CommitEventasadditionalEventsfor the webview to splice in. - Improve approval robustness by polling GitHub’s PR head SHA for a short time when the caller expects the head to advance to a just-pushed attestation commit.
Show a summary per file
| File | Description |
|---|---|
| webviews/components/timeline.tsx | Adds an “Add attestation” checkbox to the pending review summary UI and forwards the flag on review submission. |
| webviews/common/context.tsx | Extends webview review commands to include addAttestation; updates timeline append logic to support additionalEvents. |
| src/github/views.ts | Extends SubmitReviewReply to optionally include additionalEvents. |
| src/github/pullRequestReviewCommon.ts | Propagates additionalEvents through review message/command reply payloads. |
| src/github/pullRequestOverview.ts | Implements attestation-aware review submission and skips timeline refetch when synthetic events are available; passes expected head SHA into approve. |
| src/github/pullRequestModel.ts | Adds an expectedRemoteHead parameter to approve() and polls briefly for GitHub’s PR head SHA to converge. |
| src/github/attestationCommit.ts | Returns { sha, event }, uses an explicit refspec for upstream pushes, rewinds local commit on push failure, and creates a synthetic commit timeline event. |
| src/github/activityBarViewProvider.ts | Mirrors the overview panel behavior: attestation-aware review submission with optional synthetic timeline events and expected head SHA for approve. |
| src/api/api.d.ts | Adds noVerify to CommitOptions typing. |
Review details
- Files reviewed: 8/9 changed files
- Comments generated: 3
- Review effort level: Low
Comment on lines
321
to
325
| async function submitAction(event: React.MouseEvent | React.KeyboardEvent, action: ReviewType): Promise<void> { | ||
| event.preventDefault(); | ||
| const value = commentText; | ||
| setBusy(true); | ||
| switch (action) { |
Comment on lines
+156
to
+158
| const detail = isPermissionDenied | ||
| ? vscode.l10n.t('You do not have push access to the pull request branch (`{0}:{1}`). The local attestation commit was rewound.', pullRequestModel.head?.repositoryCloneUrl.owner ?? '', pullRequestModel.head?.ref ?? '') | ||
| : vscode.l10n.t('Failed to push the attestation commit: {0}. The local commit was rewound.', errText); |
Comment on lines
+363
to
+374
| // If the caller just pushed a commit, GitHub's PR API can briefly lag | ||
| // behind. Poll for it to catch up to *that specific sha* - never | ||
| // bypass the check. A concurrent third-party push would leave | ||
| // `remoteHead` at some other sha and we'd still reject below. | ||
| if (expectedRemoteHead && remoteHead !== expectedRemoteHead) { | ||
| const maxAttempts = 5; | ||
| const delayMs = 750; | ||
| for (let attempt = 0; attempt < maxAttempts && remoteHead !== expectedRemoteHead; attempt++) { | ||
| await new Promise(resolve => setTimeout(resolve, delayMs)); | ||
| remoteHead = (await this.githubRepository.getPullRequest(this.number, 'PullRequestModel.approve'))?.head?.sha; | ||
| } | ||
| } |
dbaeumer
approved these changes
Jul 2, 2026
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.
No description provided.