Repository navigation
fix(web): retrying a failed Issues list no longer restarts another environment's read #38654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
juliusmarminge
merged 4 commits into
pingdotgg:main
from
StiensWout:t3/1148-retrying-a-failed-issues-list-interrupts
Nov 19, 2026
+212
−12
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
216e4ef
test(web): retrying a failed Issues list keeps another environment's …
StiensWout 40905c4
fix(web): retrying a failed Issues list no longer restarts another en…
StiensWout 51ecafd
refactor(issues): share the retry rule for settled failures
StiensWout 6ea71e6
Merge remote-tracking branch 'origin/main' into t3/1148-retrying-a-fa…
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
153 changes: 153 additions & 0 deletions
153
scripts/scenarios/issues-retry-keeps-pending-environment.e2e.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| /// <reference lib="dom" /> | ||
| import type { IssueListResult } from "@t3tools/contracts"; | ||
| import { expect } from "e2e"; | ||
|
|
||
| import { SECOND_HOME, startSecondServer } from "./second-server.ts"; | ||
| import { makeState, test, WEB } from "./t3.ts"; | ||
|
|
||
| test( | ||
| "Retrying a failed environment keeps the Issues refresh already in progress", | ||
| WEB, | ||
| async ({ t3, app, screen, browser }) => { | ||
| await t3.project("demo"); | ||
| const server = startSecondServer(app.baseUrl ?? ""); | ||
| try { | ||
| const { host, token } = await server.ready; | ||
| await makeState(SECOND_HOME).state.project("remote-demo"); | ||
| await browser.addInitScript((remoteHost) => { | ||
| const { promise: slowRead, resolve: release } = Promise.withResolvers<void>(); | ||
| let refreshing = false; | ||
| let primaryRefreshStarted = false; | ||
| let remoteRefreshStarted = false; | ||
| Object.assign(window, { | ||
| armIssuesRefresh: () => { | ||
| refreshing = true; | ||
| }, | ||
| releaseSlowIssuesRead: release, | ||
| }); | ||
| const date = "2026-10-01T00:00:00.000Z"; | ||
| const tracker = "github" as IssueListResult["trackers"][number]["tracker"]; | ||
| const list = (title: string, remote: boolean): IssueListResult => { | ||
| const key = remote ? "2" : "1"; | ||
| return { | ||
| entries: [ | ||
| { | ||
| tracker, | ||
| host: "github.com", | ||
| scope: "example/demo", | ||
| key, | ||
| displayKey: "#" + key, | ||
| title, | ||
| projectId: (remote | ||
| ? "remote-demo" | ||
| : "demo") as IssueListResult["entries"][number]["projectId"], | ||
| projectTitle: remote ? "remote-demo" : "demo", | ||
| url: "https://github.com/example/demo/issues/" + key, | ||
| author: null, | ||
| state: { category: "open", name: "Open" }, | ||
| createdAt: date, | ||
| updatedAt: date, | ||
| closedAt: null, | ||
| assignees: [], | ||
| labels: [], | ||
| commentCount: 0, | ||
| }, | ||
| ], | ||
| errors: [], | ||
| nextCursors: {}, | ||
| viewers: {}, | ||
| trackers: [ | ||
| { | ||
| tracker, | ||
| host: "github.com", | ||
| projectCount: 1, | ||
| capabilities: null, | ||
| configured: true, | ||
| detail: null, | ||
| }, | ||
| ], | ||
| }; | ||
| }; | ||
| const send = WebSocket.prototype.send; | ||
| WebSocket.prototype.send = function (data) { | ||
| const request: { _tag: string; id: string; tag: string } | null = | ||
| typeof data === "string" ? JSON.parse(data) : null; | ||
| if (request?._tag !== "Request" || request.tag !== "issues.list") | ||
| return send.call(this, data); | ||
| const remote = new URL(this.url).host === remoteHost; | ||
| const reply = (exit: unknown) => | ||
| this.dispatchEvent( | ||
| new MessageEvent("message", { | ||
| data: JSON.stringify({ _tag: "Exit", requestId: request.id, exit }), | ||
| }), | ||
| ); | ||
| const success = (title: string) => reply({ _tag: "Success", value: list(title, remote) }); | ||
|
|
||
| if (!refreshing) { | ||
| queueMicrotask(() => | ||
| success(remote ? "Issue from the linked environment" : "Before refresh"), | ||
| ); | ||
| } else if (remote && !remoteRefreshStarted) { | ||
| remoteRefreshStarted = true; | ||
| queueMicrotask(() => | ||
| reply({ | ||
| _tag: "Failure", | ||
| cause: [ | ||
| { | ||
| _tag: "Fail", | ||
| error: { | ||
| _tag: "IssueOperationError", | ||
| operation: "list", | ||
| detail: "The linked environment could not list issues.", | ||
| }, | ||
| }, | ||
| ], | ||
| }), | ||
| ); | ||
| } else if (remote) { | ||
| queueMicrotask(() => success("Issues recovered on the linked environment")); | ||
| } else if (!primaryRefreshStarted) { | ||
| primaryRefreshStarted = true; | ||
| // Only the original slow read is allowed to finish. Restarting it strands its result. | ||
| void slowRead.then(() => success("Updated issue from the slow environment")); | ||
| } | ||
| }; | ||
| }, new URL(host).host); | ||
|
|
||
| await t3.open("/settings/connections"); | ||
| await screen.getByRole("button", "Add environment").tap(); | ||
| const dialog = screen.getByRole("dialog"); | ||
| await dialog.getByPlaceholder("backend.example.com").fill(host); | ||
| await dialog.getByPlaceholder("PAIRCODE").fill(token); | ||
| await dialog.getByRole("button", "Add environment").tap(); | ||
| await screen.getByRole("button", "More actions for Scenario").waitFor({ timeout: 60_000 }); | ||
| await app.open("/issues"); | ||
|
|
||
| await screen.getByText("Before refresh", { exact: true }).waitFor({ timeout: 60_000 }); | ||
| await screen.getByText("Issue from the linked environment", { exact: true }).waitFor(); | ||
| await browser.evaluate(() => { | ||
| (window as unknown as { armIssuesRefresh: () => void }).armIssuesRefresh(); | ||
| return null; | ||
| }); | ||
| await screen.getByRole("button", "Refresh issues", { exact: true }).tap(); | ||
| await screen.getByText(/Showing the issues that loaded/).waitFor(); | ||
| await screen.getByRole("button", "Retry", { exact: true }).tap(); | ||
| await screen | ||
| .getByText("Issues recovered on the linked environment", { exact: true }) | ||
| .waitFor(); | ||
| await browser.evaluate(() => { | ||
| (window as unknown as { releaseSlowIssuesRead: () => void }).releaseSlowIssuesRead(); | ||
| return null; | ||
| }); | ||
| try { | ||
| await expect( | ||
| screen.getByText("Updated issue from the slow environment", { exact: true }), | ||
| ).toBeVisible(); | ||
| } finally { | ||
| await app.screenshot("partial-issues-after-retry"); | ||
| } | ||
| } finally { | ||
| await server.stop(); | ||
| } | ||
| }, | ||
| ); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not leave Retry enabled when no failure can be retried.
After Retry starts, the linked environment’s result can remain a
Failurewithwaiting=true. The banner still shows the error and the button stays enabled, but another click does nothing. If the primary was already pending, the first click may also produce no visible change. (raw.githubusercontent.com)Use the presence of a settled failure to enable Retry. If recovery is already in progress and no other failure is eligible, show that state instead. Do not disable Retry based on
list.isPendingalone; that would block retries while an unrelated environment loads.