Skip to content

Commit bb98231

Browse files
ref(autofix): Remove PR card retry button, improve error state
Remove the header retry button from PullRequestsCard since it's a no-op when PRs are in sync. The error state now shows "Failed to create PR — Retry" as a clickable button. Remove dead isOutOfSync/Update code since the NextStep flow handles that case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0750db9 commit bb98231

File tree

2 files changed

+3
-55
lines changed

2 files changed

+3
-55
lines changed

static/app/components/events/autofix/v3/autofixCards.spec.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,6 @@ describe('Retry button', () => {
698698
expect(startStep).toHaveBeenCalledWith('code_changes', 42, undefined, 5);
699699
});
700700

701-
it('calls createPR with runId on PullRequestsCard retry click', async () => {
702-
const createPR = jest.fn();
703-
704-
render(
705-
<PullRequestsCard
706-
autofix={{...autofixWithRun, createPR}}
707-
section={makeSection('pull_request', 'completed', [[makePR()]])}
708-
/>
709-
);
710-
711-
await userEvent.click(screen.getByRole('button', {name: 'Retry'}));
712-
expect(createPR).toHaveBeenCalledWith(42);
713-
});
714-
715701
it('does not show retry button when section is processing', () => {
716702
const artifact = makeSolutionArtifact({
717703
one_line_summary: 'Fix the bug',

static/app/components/events/autofix/v3/autofixCards.tsx

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, useCallback, useEffect, useMemo, useRef, type ReactNode} from 'react';
1+
import {Fragment, useEffect, useMemo, useRef, type ReactNode} from 'react';
22
import styled from '@emotion/styled';
33

44
import {Tag} from '@sentry/scraps/badge';
@@ -299,34 +299,8 @@ export function PullRequestsCard({autofix, section}: AutofixCardProps) {
299299
const {createPR, runState, isPolling} = autofix;
300300
const runId = runState?.run_id;
301301

302-
// Check if code has changed since each PR was last pushed
303-
const isOutOfSync = useCallback(
304-
(repoName: string, prCommitSha: string | null) => {
305-
const blocks = runState?.blocks ?? [];
306-
if (!prCommitSha) {
307-
return true;
308-
}
309-
for (let i = blocks.length - 1; i >= 0; i--) {
310-
const block = blocks[i];
311-
if (block?.merged_file_patches?.some(p => p.repo_name === repoName)) {
312-
return block.pr_commit_shas?.[repoName] !== prCommitSha;
313-
}
314-
}
315-
return true;
316-
},
317-
[runState?.blocks]
318-
);
319-
320302
return (
321-
<ArtifactCard
322-
icon={<IconPullRequest />}
323-
title={t('Pull Requests')}
324-
trailingItems={
325-
section.status === 'completed' && runId ? (
326-
<RetryButton onClick={() => createPR(runId)} disabled={isPolling} />
327-
) : undefined
328-
}
329-
>
303+
<ArtifactCard icon={<IconPullRequest />} title={t('Pull Requests')}>
330304
{artifact?.map(pullRequest => {
331305
if (pullRequest.pr_creation_status === 'creating') {
332306
const isUpdating = !!(pullRequest.pr_number && pullRequest.pr_url);
@@ -344,18 +318,6 @@ export function PullRequestsCard({autofix, section}: AutofixCardProps) {
344318
pullRequest.pr_url &&
345319
pullRequest.pr_number
346320
) {
347-
if (isOutOfSync(pullRequest.repo_name, pullRequest.commit_sha) && runId) {
348-
return (
349-
<Button
350-
key={pullRequest.repo_name}
351-
priority="primary"
352-
onClick={() => createPR(runId, pullRequest.repo_name)}
353-
disabled={isPolling}
354-
>
355-
{t('Update %s#%s', pullRequest.repo_name, pullRequest.pr_number)}
356-
</Button>
357-
);
358-
}
359321
return (
360322
<LinkButton
361323
key={pullRequest.repo_name}
@@ -375,7 +337,7 @@ export function PullRequestsCard({autofix, section}: AutofixCardProps) {
375337
onClick={() => runId && createPR(runId, pullRequest.repo_name)}
376338
disabled={isPolling || !runId}
377339
>
378-
{t('Retry PR in %s', pullRequest.repo_name)}
340+
{t('Failed to create PR in %s — Retry', pullRequest.repo_name)}
379341
</Button>
380342
);
381343
})}

0 commit comments

Comments
 (0)