@devries-cameron20 / t3code Mirror · read-only / commits / 4cc6bebbac
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 18:30 UTC

fix(desktop): nightly updates no longer depend on GitHub's tag order (#35599)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Nov 12, 2026 at 14:58 UTC 4cc6bebbac4ee89787333e7faac3a22bf4d9149a
7 files changed +400 -31
.github/scripts/check-nightly-release.cjs
+45
@@ -121,9 +121,54 @@ async function resolveLatestNightlyCommit({ github, context, core }) {
121 return { tag, sha: commit.sha, version };
122 }
123
124 +// The two places a nightly install looks for an update: the `update-feed` pointer, and
125 +// releases.atom, which holds the 10 newest git tags of any kind. Older installs take the first
126 +// nightly in the feed. Reports what each names beside the newest published nightly.
127 +async function readNightlyUpdateFeed({ github, context, fetch = globalThis.fetch }) {
128 + const latest = await findLatestNightly({ github, context });
129 + if (!latest) return {};
130 +
131 + const base = `https://github.com/${context.repo.owner}/${context.repo.repo}`;
132 + // Only a missing or malformed pointer is stale. Rewriting deletes the old file first, so a
133 + // GitHub outage must not look like one.
134 + // Node waits five minutes for a stalled response, which is this job's whole time limit.
135 + const signal = () => AbortSignal.timeout(30_000);
136 + const pointer = await fetch(`${base}/releases/download/update-feed/nightly.json`, {
137 + signal: signal(),
138 + });
139 + if (!pointer.ok && pointer.status !== 404) {
140 + throw new Error(`The update-feed pointer answered HTTP ${pointer.status}.`);
141 + }
142 + let pointerTag;
143 + if (pointer.ok) {
144 + // A body that fails to arrive throws here; only one that is not JSON counts as malformed.
145 + const body = await pointer.text();
146 + try {
147 + pointerTag = JSON.parse(body)?.tag_name;
148 + } catch {}
149 + }
150 +
151 + // An unreadable feed leaves `feedTags` unset, so the pointer is still repaired. An error page
152 + // can answer HTTP 200, so only an Atom document counts as read.
153 + let feedTags;
154 + try {
155 + const feed = await fetch(`${base}/releases.atom`, { signal: signal() });
156 + const body = feed.ok ? await feed.text() : "";
157 + if (/<feed[\s>]/.test(body)) {
158 + feedTags = Array.from(body.matchAll(/href="[^"]*\/releases\/tag\/([^"]+)"/g), (match) =>
159 + decodeURIComponent(match[1]),
160 + );
161 + }
162 + } catch {}
163 + const feedNightly = feedTags?.find((tag) => /^v?\d+\.\d+\.\d+-nightly\./.test(tag));
164 +
165 + return { tag: latest.tagName, pointerTag, feedNightly, feedTags };
166 +}
167 +
168 module.exports = {
169 assertCommitOnDefaultBranch,
170 assertReleaseSource,
171 shouldReleaseNightly,
172 resolveLatestNightlyCommit,
173 + readNightlyUpdateFeed,
174 };
.github/scripts/check-nightly-release.test.cjs
+78
@@ -237,3 +237,81 @@ test("stable releases fail when no nightly is published", async () => {
237 const { options } = nightlyCommitFixture({ releases: [nightly(1, { tagName: "v1.0.0" })] });
238 await assert.rejects(resolveLatestNightlyCommit(options), /No published nightly found/);
239 });
240 +
241 +const { readNightlyUpdateFeed } = require("./check-nightly-release.cjs");
242 +
243 +// GitHub percent-encodes tag names in the feed, and any tag in the repository takes a slot.
244 +const atomEntry = (tag) =>
245 + `<entry><link rel="alternate" type="text/html" href="https://github.com/example/app/releases/tag/${encodeURIComponent(tag)}"/></entry>`;
246 +const atomFeed = (tags) => new Response(`<feed>${tags.map(atomEntry).join("")}</feed>`);
247 +const NEWEST = "v1.0.1-nightly.20260905.123";
248 +const OLDER = "v1.0.1-nightly.20260905.100";
249 +
250 +function updateFeedFixture({ feed, pointer }) {
251 + const { options } = fixture({
252 + releases: [nightly(1), nightly(0, { tagName: "v1.0.2-preview.1" })],
253 + });
254 + options.fetch = async (url) =>
255 + url === "https://github.com/example/app/releases.atom"
256 + ? feed
257 + : url === "https://github.com/example/app/releases/download/update-feed/nightly.json"
258 + ? pointer
259 + : assert.fail(`unexpected fetch ${url}`);
260 + return options;
261 +}
262 +
263 +const missing = () => new Response("Not Found", { status: 404 });
264 +// HTTP 200, then the connection drops before the body arrives.
265 +const brokenBody = () =>
266 + new Response(new ReadableStream({ start: (controller) => controller.error(new Error("reset")) }));
267 +for (const [name, { feed, pointer }, expected] of [
268 + [
269 + "a nightly crowded out of the feed and a missing pointer",
270 + { feed: atomFeed(["v1.0.2-preview.1", "mobile-android-build/2.3.0/abc"]), pointer: missing() },
271 + { pointerTag: undefined, feedNightly: undefined },
272 + ],
273 + [
274 + "the first nightly in the feed, which is the one older installs take",
275 + { feed: atomFeed(["update-feed", OLDER, NEWEST]), pointer: Response.json({ tag_name: OLDER }) },
276 + { pointerTag: OLDER, feedNightly: OLDER },
277 + ],
278 + [
279 + "a malformed pointer as stale and an unreadable feed as naming nothing",
280 + { feed: new Response("", { status: 503 }), pointer: Response.json(null) },
281 + { pointerTag: undefined, feedNightly: undefined, unreadable: true },
282 + ],
283 + [
284 + "an HTML page with release links as an unreadable feed",
285 + {
286 + feed: new Response(
287 + `<html><feedback-form></feedback-form><a href="/example/app/releases/tag/${OLDER}">x</a></html>`,
288 + ),
289 + pointer: Response.json({ tag_name: NEWEST }),
290 + },
291 + { pointerTag: NEWEST, feedNightly: undefined, unreadable: true },
292 + ],
293 + [
294 + "the pointer when the feed's body fails to arrive",
295 + { feed: brokenBody(), pointer: Response.json({ tag_name: NEWEST }) },
296 + { pointerTag: NEWEST, feedNightly: undefined, unreadable: true },
297 + ],
298 +]) {
299 + test(`update feed check reports ${name}`, async () => {
300 + const { tag, pointerTag, feedNightly, feedTags } = await readNightlyUpdateFeed(
301 + updateFeedFixture({ feed, pointer }),
302 + );
303 + const { unreadable = false, ...named } = expected;
304 + assert.deepEqual({ tag, pointerTag, feedNightly }, { tag: NEWEST, ...named });
305 + assert.equal(feedTags === undefined, unreadable);
306 + });
307 +}
308 +
309 +for (const [name, pointer, error] of [
310 + ["answers with an error", () => new Response("", { status: 503 }), /pointer answered HTTP 503/],
311 + ["drops the connection", brokenBody, /reset/],
312 +]) {
313 + test(`update feed check does not call a pointer stale when GitHub ${name}`, async () => {
314 + const options = updateFeedFixture({ feed: atomFeed([NEWEST]), pointer: pointer() });
315 + await assert.rejects(readNightlyUpdateFeed(options), error);
316 + });
317 +}
.github/workflows/release.yml
+82 -13
@@ -49,7 +49,8 @@ jobs:
49 # published nightly, so stable only ever ships a build that nightly users
50 # have already run. Scheduled runs also decide here whether a nightly is due.
51 # The PAUSE_NIGHTLY repository variable skips scheduled runs only; every later
52 - # job needs this one, so a skip here skips the whole run.
52 + # job needs this one, so a skip here skips the whole run. `update_feed` runs
53 + # without it and checks the variable itself.
54 resolve_commit:
55 name: Resolve release commit
56 if: github.repository == 'pingdotgg/t3code' && (github.event_name != 'schedule' || vars.PAUSE_NIGHTLY != 'true')
@@ -165,14 +166,12 @@ jobs:
166 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
167 echo "make_latest=false" >> "$GITHUB_OUTPUT"
168 elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-preview}" == "preview" ]]; then
168 - # Manual-only test train: exercises the whole release flow for a
169 - # commit end users must never receive. Never scheduled.
169 + # Manual-only test train: exercises the release flow up to a draft
170 + # release for a commit end users must never receive. Never scheduled.
171 # Same versioning as nightly under its own prerelease identifier.
171 - # A preview release is reachable only by asking for it: npm gets it
172 - # under the `preview` dist-tag, which nothing resolves by default,
173 - # its desktop builds carry no update feed, and no updater manifest
174 - # is attached to the release, so neither stable nor nightly
175 - # installs can ever be offered one.
172 + # A preview release stays a draft (see "Publish prerelease"), its
173 + # desktop builds carry no update feed, no updater manifest is
174 + # attached, and npm gets nothing, so no install can be offered one.
175 nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
176
177 node scripts/resolve-nightly-release.ts \
@@ -183,7 +182,6 @@ jobs:
182 --github-output
183
184 echo "release_channel=preview" >> "$GITHUB_OUTPUT"
186 - echo "cli_dist_tag=preview" >> "$GITHUB_OUTPUT"
185 echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
186 echo "make_latest=false" >> "$GITHUB_OUTPUT"
187 else
@@ -1038,22 +1036,93 @@ jobs:
1036 # The action keeps a stable release a draft until its assets finish uploading, but publishes a
1037 # prerelease first. Desktop clients update connected servers from the CLI archives as soon as
1038 # they see the release, so a prerelease also goes public only once every asset is attached.
1039 + # Previews stay drafts, because a draft has no git tag. releases.atom lists the 10 newest tags,
1040 + # a day's `preview` tags can sort above its `nightly` ones, and older updaters find nightlies only there.
1041 - name: Publish prerelease
1042 - if: needs.preflight.outputs.is_prerelease == 'true'
1042 + if: needs.preflight.outputs.is_prerelease == 'true' && needs.preflight.outputs.release_channel != 'preview'
1043 env:
1044 GH_TOKEN: ${{ github.token }}
1045 GH_REPO: ${{ github.repository }}
1046 RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
1047 run: gh release edit "$RELEASE_TAG" --draft=false
1048
1049 + # A nightly install finds updates in releases.atom, which holds the 10 newest git tags of any
1050 + # kind, so a burst of other tags hides every nightly. The `update-feed` release is the fixed URL
1051 + # newer installs also read. Every unpaused scheduled tick and every nightly repairs it, then fails when
1052 + # the feed's first nightly is not the newest one. See docs/operations/release.md#update-feed.
1053 + update_feed:
1054 + name: Check the update feed
1055 + needs: [preflight, release]
1056 + if: ${{ !cancelled() && github.repository == 'pingdotgg/t3code' && ((github.event_name == 'schedule' && vars.PAUSE_NIGHTLY != 'true') || needs.preflight.outputs.release_channel == 'nightly') }}
1057 + runs-on: blacksmith-2vcpu-ubuntu-2404
1058 + timeout-minutes: 5
1059 + permissions:
1060 + contents: write
1061 + steps:
1062 + - name: Checkout
1063 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
1064 + with:
1065 + sparse-checkout: .github/scripts
1066 +
1067 + - id: feed
1068 + name: Read the update feed
1069 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
1070 + with:
1071 + retries: 3
1072 + script: |
1073 + const { readNightlyUpdateFeed } = require('./.github/scripts/check-nightly-release.cjs');
1074 + const { tag, pointerTag, feedNightly, feedTags } = await readNightlyUpdateFeed({ github, context });
1075 + if (!tag) return;
1076 + core.info(`Newest nightly: ${tag}. Pointer: ${pointerTag}. Feed: ${feedTags?.join(', ')}.`);
1077 + core.setOutput('tag', tag);
1078 + core.setOutput('pointer_stale', pointerTag !== tag);
1079 + core.setOutput('feed', feedTags === undefined ? 'unreadable' : feedNightly === tag ? 'ok' : 'hidden');
1080 +
1081 + - name: Point the update feed at the newest nightly
1082 + if: steps.feed.outputs.pointer_stale == 'true'
1083 + env:
1084 + GH_TOKEN: ${{ github.token }}
1085 + GH_REPO: ${{ github.repository }}
1086 + RELEASE_TAG: ${{ steps.feed.outputs.tag }}
1087 + run: |
1088 + gh api "repos/$GH_REPO/releases/tags/$RELEASE_TAG" --jq '{tag_name, name, body}' > nightly.json
1089 + gh release view update-feed > /dev/null 2>&1 ||
1090 + gh release create update-feed --prerelease --latest=false --title "Update feed" \
1091 + --notes "The desktop updater reads this release to find the newest nightly. Do not delete it. See docs/operations/release.md."
1092 + gh release upload update-feed nightly.json --clobber
1093 +
1094 + # Every run, because the pointer can be current while the release's flags are wrong. A draft's
1095 + # files are not public, and a release marked "latest" is the one stable installs update to.
1096 + - name: Keep the update feed release public and never latest
1097 + if: steps.feed.outputs.tag != ''
1098 + env:
1099 + GH_TOKEN: ${{ github.token }}
1100 + GH_REPO: ${{ github.repository }}
1101 + run: gh release edit update-feed --draft=false --prerelease --latest=false
1102 +
1103 + # An unreadable feed says nothing about its tags and the next tick reads it again, so only a
1104 + # feed that was read and names another nightly first fails the run.
1105 + - name: Fail when the feed hides the newest nightly
1106 + if: steps.feed.outputs.tag != '' && steps.feed.outputs.feed != 'ok'
1107 + env:
1108 + RELEASE_TAG: ${{ steps.feed.outputs.tag }}
1109 + FEED: ${{ steps.feed.outputs.feed }}
1110 + run: |
1111 + if [[ "$FEED" == "unreadable" ]]; then
1112 + echo "::warning::releases.atom could not be read, so this run did not check it."
1113 + exit 0
1114 + fi
1115 + echo "::error::The first nightly in releases.atom is not $RELEASE_TAG. Nightly installs older than 0.1.10-nightly.20261112.4603 cannot reach it, and neither can later builds that do not read the pointer when the feed names an older nightly. A preview from a branch not rebased onto main is the usual cause. See docs/operations/release.md#update-feed."
1116 + exit 1
1117 +
1118 # The `t3` npm package is a launcher that downloads this version's CLI
1119 # archive from the GitHub Release, so it publishes only once that release
1051 - # exists. Preview publishes too, under the `preview` dist-tag, which
1052 - # nothing resolves unless asked for by name.
1120 + # exists. A preview release stays a draft, whose files are not public, so
1121 + # a preview never publishes the launcher.
1122 publish_cli:
1123 name: Publish CLI to npm
1124 needs: [preflight, build_bundle, release]
1056 - if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
1125 + if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
1126 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
1127 timeout-minutes: 15
1128 permissions:
apps/desktop/src/updates/githubUpdateFeed.test.ts new
+107
@@ -0,0 +1,107 @@
1 +import * as NodeModule from "node:module";
2 +
3 +import { GitHubProvider } from "electron-updater/out/providers/GitHubProvider.js";
4 +import { describe, expect, it } from "vite-plus/test";
5 +
6 +type ProviderArgs = ConstructorParameters<typeof GitHubProvider>;
7 +
8 +// electron-updater's own dependency, which apps/desktop does not declare.
9 +const semver = NodeModule.createRequire(
10 + NodeModule.createRequire(import.meta.url).resolve("electron-updater"),
11 +)("semver") as { parse: (version: string) => ProviderArgs[1]["currentVersion"] };
12 +
13 +const REPO = "/pingdotgg/t3code";
14 +const nightly = (build: number) => `v0.1.10-nightly.20261112.${build}`;
15 +
16 +const atomFeed = (tags: ReadonlyArray<string>) =>
17 + `<feed xmlns="http://www.w3.org/2005/Atom">${tags
18 + .map(
19 + (tag) =>
20 + `<entry><link rel="alternate" type="text/html" href="https://github.com${REPO}/releases/tag/${tag}"/><title>${tag}</title><content type="html">${tag} feed notes</content></entry>`,
21 + )
22 + .join("")}</feed>`;
23 +
24 +/**
25 + * The release a nightly install on 4580 is offered when GitHub serves this feed, this `update-feed`
26 + * pointer, and this newest nightly from the REST API scan.
27 + */
28 +const offeredRelease = async (
29 + feedTags: ReadonlyArray<string>,
30 + pointerTag: string | undefined,
31 + listedTag?: string | Error,
32 +) => {
33 + let apiScans = 0;
34 + const request = async ({ path = "" }: { readonly path?: string | null }) => {
35 + if (path === `${REPO}/releases.atom`) return atomFeed(feedTags);
36 + if (path === `${REPO}/releases/download/update-feed/nightly.json`) {
37 + if (pointerTag === undefined) throw new Error("404");
38 + return JSON.stringify({ tag_name: pointerTag, name: pointerTag, body: "pointer notes" });
39 + }
40 + const manifest = /\/releases\/download\/v([^/]+)\/nightly\.yml$/.exec(path ?? "");
41 + if (manifest) return `version: ${manifest[1]}\npath: T3-Code.exe\nsha512: abc\n`;
42 + apiScans += 1;
43 + if (listedTag instanceof Error) throw listedTag;
44 + return JSON.stringify(listedTag ? [{ tag_name: listedTag, body: "API notes" }] : []);
45 + };
46 + const provider = new GitHubProvider(
47 + { provider: "github", owner: "pingdotgg", repo: "t3code" },
48 + // Only the four fields the provider reads; a real AppUpdater needs Electron.
49 + {
50 + allowPrerelease: true,
51 + channel: "nightly",
52 + currentVersion: semver.parse("0.1.10-nightly.20261112.4580"),
53 + fullChangelog: true,
54 + } as ProviderArgs[1],
55 + {
56 + isUseMultipleRangeRequest: false,
57 + platform: "win32",
58 + executor: { request },
59 + } as ProviderArgs[2],
60 + );
61 + const { tag, releaseNotes } = await provider.getLatestVersion();
62 + return { tag, releaseNotes, apiScans };
63 +};
64 +
65 +// What filled releases.atom on 2026-11-12: ten tags, none of them a nightly.
66 +const crowdedFeed = Array.from({ length: 10 }, (_, i) => `v0.1.10-preview.20261112.${4550 + i}`);
67 +
68 +describe("GitHubProvider nightly lookup", () => {
69 + it.each([
70 + ["other tags fill the feed", crowdedFeed],
71 + ["the feed's first nightly is an older one", [nightly(4603)]],
72 + ])("finds the newest nightly at the fixed pointer when %s", async (_case, feedTags) => {
73 + expect(await offeredRelease(feedTags, nightly(4606))).toEqual({
74 + tag: nightly(4606),
75 + releaseNotes: "pointer notes",
76 + apiScans: 0,
77 + });
78 + });
79 +
80 + it("still scans the API when the feed has no nightly and the pointer offers nothing new", async () => {
81 + expect(await offeredRelease(crowdedFeed, nightly(4580), nightly(4606))).toEqual({
82 + tag: nightly(4606),
83 + releaseNotes: "API notes",
84 + apiScans: 1,
85 + });
86 + });
87 +
88 + it("keeps the pointer's answer when the API scan fails", async () => {
89 + const rateLimited = new Error("403");
90 + expect(await offeredRelease(crowdedFeed, nightly(4580), rateLimited)).toMatchObject({
91 + tag: nightly(4580),
92 + apiScans: 1,
93 + });
94 + });
95 +
96 + it.each([
97 + ["the feed is newer than the pointer", nightly(4603)],
98 + ["there is no pointer", undefined],
99 + ["the pointer names another channel", "v0.1.10-preview.20261112.4700"],
100 + ])("keeps the feed's nightly when %s", async (_case, pointerTag) => {
101 + expect(await offeredRelease([nightly(4606)], pointerTag)).toEqual({
102 + tag: nightly(4606),
103 + releaseNotes: [{ version: nightly(4606).slice(1), note: `${nightly(4606)} feed notes` }],
104 + apiScans: 0,
105 + });
106 + });
107 +});
docs/operations/release.md
+44 -7
@@ -19,7 +19,7 @@ the version.
19 - push tag matching `v*.*.*` for a stable release of an explicit commit
20 - scheduled nightly check every 30 minutes
21 - manual `workflow_dispatch` with `channel=nightly`
22 - - manual `workflow_dispatch` with `channel=preview`, the maintainers' test train. It exercises the whole release flow (build, sign, notarize, smoke, publish) for a commit that end users must never receive, which is how an unmerged branch or a risky change gets a real release run before it lands. It builds the triggering commit with nightly's versioning under the `preview` prerelease identifier (`0.0.41-preview.<date>.<run>`) and publishes a GitHub prerelease plus the npm packages under the `preview` dist-tag. Preview is not on the schedule, no default npm dist-tag points at it, its desktop builds carry no update feed, and no updater manifest (`latest*.yml`, `nightly*.yml`, blockmaps) is attached, so a stable or nightly install cannot be offered one. The only ways onto it are downloading the release by hand, `npx t3@preview`, `T3CODE_CHANNEL=preview` for the install scripts, or `t3 update --channel preview` from a terminal; each prints a warning, and the CLI asks for confirmation when the running build is not itself a preview. The release itself is named as a maintainer test build and its body is a warning rather than generated notes: a changelog of unmerged branch history is not a changelog, and nightly and stable notes are unaffected because each series resolves its previous tag within its own channel. The hosted web app, AUR, and Discord announcements are skipped. Keep it; it costs nothing when idle.
22 + - manual `workflow_dispatch` with `channel=preview`, the maintainers' test train. It exercises the release flow up to a draft release (build, sign, notarize, smoke) for a commit that end users must never receive, which is how an unmerged branch or a risky change gets a real release run before it lands. It builds the triggering commit with nightly's versioning under the `preview` prerelease identifier (`0.0.41-preview.<date>.<run>`) and leaves its GitHub prerelease as a draft. It publishes nothing to npm. It stays a draft because a draft has no git tag, and published preview tags hide nightlies from the updater (see [Update feed](#update-feed)). Do not publish a preview draft by hand. Preview is not on the schedule, its desktop builds carry no update feed, and no updater manifest (`latest*.yml`, `nightly*.yml`, blockmaps) is attached, so a stable or nightly install cannot be offered one. The only ways onto a new preview are by hand: the draft release, which maintainers can open, and the run's Actions artifacts. A draft's files are not public, so `T3CODE_CHANNEL=preview` and `t3 update --channel preview` see only previews published before this rule, and a fresh `npx t3@preview` fails while npm's `preview` dist-tag names a draft. Rebase a branch onto `main` before dispatching a preview from it. The run uses the branch's own `release.yml`, and an older copy publishes the preview with a tag. The release itself is named as a maintainer test build and its body is a warning rather than generated notes: a changelog of unmerged branch history is not a changelog, and nightly and stable notes are unaffected because each series resolves its previous tag within its own channel. The hosted web app, AUR, and Discord announcements are skipped. Keep it; it costs nothing when idle.
23 - A manual stable release builds the commit of the latest published nightly, not `main` HEAD.
24 Nightly is the release candidate: verify the nightly, then promote it. Merges to `main` keep
25 landing while you verify and never leak into the stable build.
@@ -52,7 +52,7 @@ the version.
52 - After the GitHub Release is published, publishes the `t3` npm package with OIDC trusted publishing from the same workflow file. It is only a launcher (`scripts/npm-launcher/t3.mjs`): on first run it downloads its exact version's CLI archive from the GitHub Release, verifies it against `SHA256SUMS`, and unpacks it into `<T3 home>/runtime/versions/<version>`, the layout the install scripts and `t3 update` share. The executables are not on npm. They used to be, as `@t3code/t3-<platform>-<arch>` optional dependencies, but npm's publish-time scanning held those 80-250 MB packages back for up to an hour after the launcher was live, and every install in that window got a launcher with no executable. Those packages stay on npm at their old versions and get no new ones. Because the launcher reads from the release, `publish_cli` runs after `release`, never before.
53 - stable releases publish npm dist-tag `latest`
54 - nightly releases publish npm dist-tag `nightly`
55 - - preview releases publish npm dist-tag `preview`, which nothing resolves unless asked for by name
55 + - preview releases publish nothing to npm
56 - one-time setup: package `t3` needs a trusted publisher registered for this workflow file (see below).
57 - Builds the hosted web app on Vercel while the desktop jobs run, and makes it live only after a release is published:
58 - stable releases are aliased to the `latest` hosted app channel
@@ -436,13 +436,13 @@ release archives, and then its npm launcher, available before users can receive
436
437 The workflow enforces this ordering:
438
439 -1. `release` publishes the GitHub Release with the CLI archives and `SHA256SUMS`. Every channel
440 - uploads to a draft and publishes only after all assets are attached, so a new version in the
439 +1. `release` publishes the GitHub Release with the CLI archives and `SHA256SUMS`. Stable and
440 + nightly upload to a draft and publish only after all assets are attached, so a new version in the
441 desktop update feed already has its archives. **Update everything** relies on this to update
442 background-service hosts before npm has the version. Rerunning `release` after publication
443 replaces assets in a public release, so service updates can fail until the upload finishes.
444 -2. `publish_cli` publishes the `t3@<version>` launcher, which downloads from that release, on every
445 - channel.
444 +2. `publish_cli` publishes the `t3@<version>` launcher, which downloads from that release, on
445 + stable and nightly. A preview stays a draft and publishes no launcher.
446 3. `deploy_web` depends on both before moving the hosted channel to the new client.
447 `build_web` builds that client earlier with `vercel deploy --prod --skip-domain`, which
448 leaves the custom domains alone but moves the project's own `*.vercel.app` production
@@ -465,6 +465,43 @@ verify that the update stops before restart and run `npx t3@<version> service up
465 server machine. Also test the manual or desktop-managed guidance when those environments are
466 available.
467
468 +## Update feed
469 +
470 +A nightly install finds the newest nightly in up to three places.
471 +
472 +- `releases.atom` lists the 10 newest git tags in the repository, of any kind, and a day's
473 + `preview` tags can sort above its `nightly` ones. Every install reads it first and takes its first
474 + nightly entry. Nightlies before `0.1.10-nightly.20261112.4603`, and stable `0.1.9` and older
475 + switched to the nightly channel, read nothing else. Ten other tags in a row hide every nightly
476 + from them.
477 +- `releases/download/update-feed/nightly.json` names the newest nightly. Installs that know the
478 + pointer read it after the feed and take the newer of the two, so their updates do not depend on
479 + tag order. The `update-feed` release holds that file. Never delete it.
480 +- The GitHub REST API, without auth, at 60 requests per hour per IP. Installs from `4603` on scan
481 + it when the feed has no nightly. Installs that know the pointer do so only when the pointer also
482 + offers nothing new.
483 +
484 +The release workflow's `Check the update feed` job runs on every scheduled tick, unless
485 +`PAUSE_NIGHTLY` is set, and after every nightly. It waits in the same queue as nightlies and
486 +previews. It rewrites a missing or outdated pointer. Its last step fails when the first nightly
487 +in the feed is not the newest one. A feed it could not read is only a warning: that says nothing
488 +about the tags, and the next tick reads it again.
489 +
490 +When that step fails, installs that read only the feed cannot reach the newest nightly. If the
491 +feed still names an older nightly first, installs from `4603` up to the first build with the
492 +pointer miss it too, because their API scan runs only when the feed has no nightly at all. The job
493 +log lists the tags in the feed. The usual cause is a preview dispatched from a branch that was not
494 +rebased onto `main`. Delete the tags nothing needs with `git push origin :refs/tags/<tag>`.
495 +Converting a release to a draft keeps its tag, so it does not help. To keep this from happening,
496 +anything users should not be offered stays a draft or uses one rolling tag, like `desktop-preview`.
497 +
498 +To pull a bad nightly, delete its release and tag, then run
499 +`gh release delete-asset update-feed nightly.json`. Installs fall back to the feed until the next
500 +unpaused tick or manual nightly rewrites the pointer. Without that command, installs that know the
501 +pointer report an update error until then. If npm's `nightly` dist-tag still names the pulled
502 +build, also move it to the last good one with `npm dist-tag add t3@<version> nightly`. The channel
503 +switch in Settings reads that tag and refuses an older desktop build.
504 +
505 ## Desktop auto-update notes
506
507 - Updater runtime: `apps/desktop/src/updates/DesktopUpdates.ts`.
@@ -551,7 +588,7 @@ Checklist:
588 3. Ensure npm account and org policies allow trusted publishing for the package.
589 4. Create release tag `vX.Y.Z` and push; the workflow publishes the GitHub Release and then the
590 launcher with npm dist-tag `latest`.
554 -5. Nightly runs publish with npm dist-tag `nightly`; preview runs with `preview`.
591 +5. Nightly runs publish with npm dist-tag `nightly`; preview runs do not publish.
592
593 ## 1) Release validation and unsigned builds
594
patches/electron-updater@6.8.9.patch
+41 -8
@@ -39,23 +39,43 @@ index 0ae9e1126e1dc136977914ef1bfd46709fc9db1b..c298ffe7808c421c29e16f1e2ba8510f
39 request.on("redirect", (statusCode, method, redirectUrl) => {
40 // no way to modify request options, abort old and make a new one
41 diff --git a/out/providers/GitHubProvider.js b/out/providers/GitHubProvider.js
42 -index e768d24e7a957caf32a4b8ca6c68cb50eb5865ee..34a0759220c0cce052285204b2d14fdf0db905e5 100644
42 +index e768d24e7a957caf32a4b8ca6c68cb50eb5865ee..708a1fa7d740192944f04259cde6d6bf79d58c53 100644
43 --- a/out/providers/GitHubProvider.js
44 +++ b/out/providers/GitHubProvider.js
45 -@@ -107,6 +107,12 @@ class GitHubProvider extends BaseGitHubProvider {
45 +@@ -107,6 +107,32 @@ class GitHubProvider extends BaseGitHubProvider {
46 catch (e) {
47 throw (0, builder_util_runtime_1.newError)(`Cannot parse releases feed: ${e.stack || e.message},\nXML:\n${feedXml}`, "ERR_UPDATER_INVALID_RELEASE_FEED");
48 }
49 -+ // The atom feed lists only the 10 newest releases, which other prereleases can fill.
49 ++ // The atom feed lists only the 10 newest git tags of any kind, in an order GitHub picks, so
50 ++ // the release workflow also records a prerelease channel's newest release at one fixed URL.
51 ++ // The newer of the two answers wins; the API scan is the last resort.
52 + let apiRelease = null;
51 -+ if (tag == null && this.updater.allowPrerelease && this.updater.channel) {
52 -+ apiRelease = await this.getLatestChannelRelease(this.updater.channel, cancellationToken);
53 -+ tag = apiRelease === null ? null : apiRelease.tag_name;
53 ++ if (this.updater.allowPrerelease && this.updater.channel) {
54 ++ const feedTag = tag;
55 ++ const pointer = await this.getChannelPointerRelease(this.updater.channel, cancellationToken);
56 ++ if (pointer !== null && (tag == null || semver.gt(pointer.tag_name, tag))) {
57 ++ apiRelease = pointer;
58 ++ tag = pointer.tag_name;
59 ++ }
60 ++ // With no nightly in the feed, a pointer that offers nothing new may be stale, so the API
61 ++ // scan still runs. Its failure is fatal only when nothing else answered.
62 ++ if (feedTag == null && (tag == null || !semver.gt(tag, this.updater.currentVersion))) {
63 ++ const listed = await this.getLatestChannelRelease(this.updater.channel, cancellationToken).catch(e => {
64 ++ if (tag == null) {
65 ++ throw e;
66 ++ }
67 ++ return null;
68 ++ });
69 ++ if (listed !== null && (tag == null || semver.gt(listed.tag_name, tag))) {
70 ++ apiRelease = listed;
71 ++ tag = listed.tag_name;
72 ++ }
73 ++ }
74 + }
75 if (tag == null) {
76 throw (0, builder_util_runtime_1.newError)(`No published versions on GitHub`, "ERR_UPDATER_NO_PUBLISHED_VERSIONS");
77 }
58 -@@ -144,6 +150,14 @@ class GitHubProvider extends BaseGitHubProvider {
78 +@@ -144,6 +170,14 @@ class GitHubProvider extends BaseGitHubProvider {
79 }
80 }
81 const result = (0, Provider_1.parseUpdateInfo)(rawData, channelFile, channelFileUrl);
@@ -70,10 +90,23 @@ index e768d24e7a957caf32a4b8ca6c68cb50eb5865ee..34a0759220c0cce052285204b2d14fdf
90 if (result.releaseName == null) {
91 result.releaseName = latestRelease.elementValueOrEmpty("title");
92 }
73 -@@ -155,6 +169,29 @@ class GitHubProvider extends BaseGitHubProvider {
93 +@@ -155,6 +189,42 @@ class GitHubProvider extends BaseGitHubProvider {
94 ...result,
95 };
96 }
97 ++ async getChannelPointerRelease(channel, cancellationToken) {
98 ++ try {
99 ++ const url = (0, util_1.newUrlFromBase)(this.getBaseDownloadPath("update-feed", `${channel}.json`), this.baseUrl);
100 ++ const rawData = await this.httpRequest(url, { accept: "application/json, */*" }, cancellationToken);
101 ++ const release = rawData == null ? null : JSON.parse(rawData);
102 ++ const releaseChannel = release == null || typeof release.tag_name !== "string" ? null : semver.prerelease(release.tag_name);
103 ++ return releaseChannel !== null && releaseChannel[0] === channel ? release : null;
104 ++ }
105 ++ catch (e) {
106 ++ // A fork, or a moment between two uploads, has no pointer. The feed still answers.
107 ++ return null;
108 ++ }
109 ++ }
110 + async getLatestChannelRelease(channel, cancellationToken) {
111 + for (let page = 1; page <= 5; page++) {
112 + const url = new url_1.URL(`${this.computeGithubBasePath(`/repos/${this.options.owner}/${this.options.repo}/releases`)}?per_page=100&page=${page}`, this.baseApiUrl);
pnpm-lock.yaml
+3 -3
@@ -373,7 +373,7 @@ patchedDependencies:
373 alchemy@2.0.0-beta.85: 07cc8c7e14b3b9af143ddd40a059f117c27e55139fbf20bd5dde2eb30509cedd
374 app-builder-lib@26.16.1: 0fbe9ae51783f5768ebe197d12d1fdb7d477a08c92e5db2f6356bcce62613c53
375 dbus-next@0.10.2: cfff57561b0ee59b5addb3b2e6c6f20906e967507a530ab67e8db8108e520ba4
376 - electron-updater@6.8.9: 71117ae11bf6058893dca8b40ce46025996924b76e534d56a53e04058781071e
376 + electron-updater@6.8.9: 5e096d34a46fdbaa6d48a5803b2c0ed9c7c04f8ab43a30ebebbf726f8f28ed8e
377 expo-audio@58.0.11: 93691f7f59edb30a3bb2c23b489e605e7ea35506b1212d4a2ebbd1fd79079483
378 expo-modules-core@58.0.30: f0b0fd100550ed76e5c25b4d13eb7c9ff62825f8f197c53edf7bf447c50c9fb7
379 expo-network@58.0.4: 159c2d760d1cd5102e95df51c20600111e7a72096ef0daea8215d50cae48bd98
@@ -463,7 +463,7 @@ importers:
463 version: 8.2.0
464 electron-updater:
465 specifier: 6.8.9
466 - version: 6.8.9(patch_hash=71117ae11bf6058893dca8b40ce46025996924b76e534d56a53e04058781071e)(supports-color@8.1.1)
466 + version: 6.8.9(patch_hash=5e096d34a46fdbaa6d48a5803b2c0ed9c7c04f8ab43a30ebebbf726f8f28ed8e)(supports-color@8.1.1)
467 electron-webauthn:
468 specifier: 'catalog:'
469 version: 1.3.1(typescript@6.0.3)
@@ -19015,7 +19015,7 @@ snapshots:
19015
19016 electron-to-chromium@1.5.430: {}
19017
19018 - electron-updater@6.8.9(patch_hash=71117ae11bf6058893dca8b40ce46025996924b76e534d56a53e04058781071e)(supports-color@8.1.1):
19018 + electron-updater@6.8.9(patch_hash=5e096d34a46fdbaa6d48a5803b2c0ed9c7c04f8ab43a30ebebbf726f8f28ed8e)(supports-color@8.1.1):
19019 dependencies:
19020 builder-util-runtime: 9.7.0(supports-color@8.1.1)
19021 fs-extra: 10.1.0