Skip to content

Commit e6ca170

Browse files
t3dotggclaude
andauthored
fix(web): update everything no longer waits on npm for service hosts (#26917)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 48247dd commit e6ca170

6 files changed

Lines changed: 73 additions & 20 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@ jobs:
947947
body_path: ${{ hashFiles('release-notes.md') != '' && 'release-notes.md' || '' }}
948948
previous_tag: ${{ needs.preflight.outputs.previous_tag }}
949949
prerelease: ${{ needs.preflight.outputs.is_prerelease }}
950+
draft: ${{ needs.preflight.outputs.is_prerelease }}
950951
make_latest: ${{ needs.preflight.outputs.make_latest }}
951952
files: ${{ steps.release_files.outputs.files }}
952953
fail_on_unmatched_files: true
@@ -962,11 +963,23 @@ jobs:
962963
generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
963964
body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
964965
prerelease: ${{ needs.preflight.outputs.is_prerelease }}
966+
draft: ${{ needs.preflight.outputs.is_prerelease }}
965967
make_latest: ${{ needs.preflight.outputs.make_latest }}
966968
files: ${{ steps.release_files.outputs.files }}
967969
fail_on_unmatched_files: true
968970
token: ${{ github.token }}
969971

972+
# The action keeps a stable release a draft until its assets finish uploading, but publishes a
973+
# prerelease first. Desktop clients update connected servers from the CLI archives as soon as
974+
# they see the release, so a prerelease also goes public only once every asset is attached.
975+
- name: Publish prerelease
976+
if: needs.preflight.outputs.is_prerelease == 'true'
977+
env:
978+
GH_TOKEN: ${{ github.token }}
979+
GH_REPO: ${{ github.repository }}
980+
RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
981+
run: gh release edit "$RELEASE_TAG" --draft=false
982+
970983
# The `t3` npm package is a launcher that downloads this version's CLI
971984
# archive from the GitHub Release, so it publishes only once that release
972985
# exists. Preview publishes too, under the `preview` dist-tag, which

‎apps/web/src/components/sidebar/updateEverything.logic.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe("collectServerUpdateTargets", () => {
6969
machine("manual", "0.0.40", undefined),
7070
],
7171
"0.0.50",
72+
true,
7273
);
7374

7475
expect(targets.map((target) => [target.serverLabel, target.targetVersion])).toEqual([
@@ -84,6 +85,22 @@ describe("collectServerUpdateTargets", () => {
8485
["manual", "needs a manual update"],
8586
]);
8687
});
88+
89+
it("waits for npm only for hosts that install from it or when the release may lack archives", () => {
90+
const hosts = [
91+
machine("archive-service", "0.1.4", "boot-service"),
92+
machine("npm-service", "0.0.40", "boot-service"),
93+
machine("legacy-respawn", "0.1.4", "respawn"),
94+
machine("desktop", "0.1.4", "desktop-managed"),
95+
];
96+
const waits = (releaseArchivesPublished: boolean) =>
97+
collectServerUpdateTargets(hosts, "0.1.5", releaseArchivesPublished).waitForNpm.map(
98+
(target) => target.serverLabel,
99+
);
100+
101+
expect(waits(true)).toEqual(["npm-service", "legacy-respawn"]);
102+
expect(waits(false)).toEqual(["archive-service", "npm-service", "legacy-respawn"]);
103+
});
87104
});
88105

89106
describe("collectChannelSwitchTargets", () => {

‎apps/web/src/components/sidebar/updateEverything.logic.ts‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,25 @@ export interface SkippedMachine {
6363
readonly reason: string;
6464
}
6565

66+
/** Boot services before this build installed the server from npm, not from release archives. */
67+
const RELEASE_ARCHIVE_SELF_UPDATE_SINCE = "0.0.41-nightly.20260914.1700";
68+
6669
/** Skip current and app-hosted servers; the latter update with the app and would relaunch mid-run.
67-
* Desktop-managed servers use their own feed. */
70+
* Desktop-managed servers use their own feed. `waitForNpm` lists targets that need
71+
* `t3@<targetVersion>` on npm first. `releaseArchivesPublished` means the version came from the
72+
* desktop feed: its GitHub Release goes public with the CLI archives that boot services download. */
6873
export function collectServerUpdateTargets(
6974
machines: ReadonlyArray<UpdateEverythingMachine>,
7075
targetVersion: string,
71-
): { readonly targets: ServerUpdateTarget[]; readonly skipped: SkippedMachine[] } {
76+
releaseArchivesPublished: boolean,
77+
): {
78+
readonly targets: ServerUpdateTarget[];
79+
readonly skipped: SkippedMachine[];
80+
readonly waitForNpm: ServerUpdateTarget[];
81+
} {
7282
const targets: ServerUpdateTarget[] = [];
7383
const skipped: SkippedMachine[] = [];
84+
const waitForNpm: ServerUpdateTarget[] = [];
7485
for (const machine of machines) {
7586
const config = machine.serverConfig;
7687
if (machine.hostedByThisApp) continue;
@@ -105,16 +116,25 @@ export function collectServerUpdateTargets(
105116
skip(`on the ${cliReleaseChannelOf(serverVersion)} channel`);
106117
continue;
107118
}
108-
targets.push({
119+
const target: ServerUpdateTarget = {
109120
environmentId: machine.environmentId,
110121
serverLabel: machine.label,
111122
selfUpdate,
112123
installation: config.environment.capabilities.serverInstallation,
113124
desktopAppUpdate,
114125
targetVersion,
115-
});
126+
};
127+
targets.push(target);
128+
if (
129+
selfUpdate !== "desktop-managed" &&
130+
(!releaseArchivesPublished ||
131+
selfUpdate === "respawn" ||
132+
compareSemverVersions(serverVersion, RELEASE_ARCHIVE_SELF_UPDATE_SINCE) < 0)
133+
) {
134+
waitForNpm.push(target);
135+
}
116136
}
117-
return { targets, skipped };
137+
return { targets, skipped, waitForNpm };
118138
}
119139

120140
function unavailableReason(machine: UpdateEverythingMachine): string | null {

‎apps/web/src/components/sidebar/useUpdateEverything.ts‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,18 @@ export function useUpdateEverything(
6868
canMaintain: canUpdateServer(sessionStates[index]!),
6969
updateState: updateStates[index]!,
7070
}));
71-
const { targets: behindServers, skipped: unreachable } = channelSwitch
72-
? collectChannelSwitchTargets(machines, channelSwitch)
73-
: collectServerUpdateTargets(machines, targetVersion);
74-
// Desktop-managed servers use their app feed; only npm installs need to wait for publication.
7571
// A track switch's target came from npm already.
76-
const needsNpm =
77-
channelSwitch === undefined &&
78-
behindServers.some((server) => server.selfUpdate !== "desktop-managed");
79-
const published = useNpmReleasePublished(needsNpm ? targetVersion : null);
80-
const servers =
81-
published || channelSwitch !== undefined
82-
? behindServers
83-
: behindServers.filter((server) => server.selfUpdate === "desktop-managed");
72+
const {
73+
targets: behindServers,
74+
skipped: unreachable,
75+
waitForNpm,
76+
} = channelSwitch
77+
? { ...collectChannelSwitchTargets(machines, channelSwitch), waitForNpm: [] }
78+
: collectServerUpdateTargets(machines, targetVersion, localUpdateVersion !== null);
79+
const published = useNpmReleasePublished(waitForNpm.length > 0 ? targetVersion : null);
80+
const servers = published
81+
? behindServers
82+
: behindServers.filter((server) => !waitForNpm.includes(server));
8483
const skipped: ReadonlyArray<SkippedMachine> = [
8584
...unreachable,
8685
...behindServers

‎docs/operations/release.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,10 @@ release archives, and then its npm launcher, available before users can receive
431431

432432
The workflow enforces this ordering:
433433

434-
1. `release` publishes the GitHub Release with the CLI archives and `SHA256SUMS`.
434+
1. `release` publishes the GitHub Release with the CLI archives and `SHA256SUMS`. Every channel
435+
uploads to a draft and publishes only after all assets are attached, so a version in the
436+
desktop update feed always has its archives. **Update everything** relies on this to update
437+
background-service hosts before npm has the version.
435438
2. `publish_cli` publishes the `t3@<version>` launcher, which downloads from that release, on every
436439
channel.
437440
3. `deploy_web` depends on both before moving the hosted channel to the new client.

‎docs/user/updating.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ restart from the update button when you are ready. A server still restarting
2222
finishes on its own, and the button keeps showing it after the desktop app
2323
restarts.
2424

25-
Server updates appear only after that version is published to npm. Remote
26-
desktop apps do not wait for npm. The confirmation lists each machine it skips
25+
Remote desktop apps never wait for npm. Background services do not wait either
26+
when the version comes from the desktop app's update. Other server updates
27+
appear only after that version is published to npm. The confirmation lists each machine it skips
2728
and why, such as a machine that is offline or needs a manual update. Use
2829
**Settings → Environments** for those.
2930

0 commit comments

Comments
 (0)