Skip to content

Commit 4ea0b78

Browse files
t3dotggclaude
andcommitted
fix(release): the update-feed release can never become "latest"
Council round 3: - Publishing a drafted update-feed release now also sets prerelease and latest=false, so it cannot become the release stable installs update to. - An unreadable releases.atom is a warning, not a failed run. Only a feed that was read and names another nightly first fails. An HTML error page that answers HTTP 200 counts as unreadable. - Test: the pointer also wins over a feed whose first nightly is older. Co-Authored-By: Claude Fable 5.2 <[email protected]>
1 parent 4219491 commit 4ea0b78

5 files changed

Lines changed: 39 additions & 19 deletions

File tree

‎.github/scripts/check-nightly-release.cjs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,15 @@ async function readNightlyUpdateFeed({ github, context, fetch = globalThis.fetch
144144
} catch {}
145145
}
146146

147-
// An unreadable feed leaves `feedTags` unset, so the pointer is still repaired.
147+
// An unreadable feed leaves `feedTags` unset, so the pointer is still repaired. An error page
148+
// can answer HTTP 200, so only an Atom document counts as read.
148149
let feedTags;
149150
try {
150151
const feed = await fetch(`${base}/releases.atom`);
151-
if (feed.ok) {
152-
feedTags = Array.from(
153-
(await feed.text()).matchAll(/href="[^"]*\/releases\/tag\/([^"]+)"/g),
154-
(match) => decodeURIComponent(match[1]),
152+
const body = feed.ok ? await feed.text() : "";
153+
if (body.includes("<feed")) {
154+
feedTags = Array.from(body.matchAll(/href="[^"]*\/releases\/tag\/([^"]+)"/g), (match) =>
155+
decodeURIComponent(match[1]),
155156
);
156157
}
157158
} catch {}

‎.github/scripts/check-nightly-release.test.cjs‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,19 +278,29 @@ for (const [name, { feed, pointer }, expected] of [
278278
[
279279
"a malformed pointer as stale and an unreadable feed as naming nothing",
280280
{ feed: new Response("", { status: 503 }), pointer: Response.json(null) },
281-
{ pointerTag: undefined, feedNightly: undefined },
281+
{ pointerTag: undefined, feedNightly: undefined, unreadable: true },
282+
],
283+
[
284+
"an HTML page that links the nightly as an unreadable feed",
285+
{
286+
feed: new Response(`<html><a href="/example/app/releases/tag/${NEWEST}">x</a></html>`),
287+
pointer: Response.json({ tag_name: NEWEST }),
288+
},
289+
{ pointerTag: NEWEST, feedNightly: undefined, unreadable: true },
282290
],
283291
[
284292
"the pointer when the feed's body fails to arrive",
285293
{ feed: brokenBody(), pointer: Response.json({ tag_name: NEWEST }) },
286-
{ pointerTag: NEWEST, feedNightly: undefined },
294+
{ pointerTag: NEWEST, feedNightly: undefined, unreadable: true },
287295
],
288296
]) {
289297
test(`update feed check reports ${name}`, async () => {
290-
const { tag, pointerTag, feedNightly } = await readNightlyUpdateFeed(
298+
const { tag, pointerTag, feedNightly, feedTags } = await readNightlyUpdateFeed(
291299
updateFeedFixture({ feed, pointer }),
292300
);
293-
assert.deepEqual({ tag, pointerTag, feedNightly }, { tag: NEWEST, ...expected });
301+
const { unreadable = false, ...named } = expected;
302+
assert.deepEqual({ tag, pointerTag, feedNightly }, { tag: NEWEST, ...named });
303+
assert.equal(feedTags === undefined, unreadable);
294304
});
295305
}
296306

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ jobs:
10481048

10491049
# A nightly install finds updates in releases.atom, which holds the 10 newest git tags of any
10501050
# kind, so a burst of other tags hides every nightly. The `update-feed` release is the fixed URL
1051-
# newer installs also read. Every scheduled tick and every nightly repairs it, then fails when
1051+
# newer installs also read. Every unpaused scheduled tick and every nightly repairs it, then fails when
10521052
# the feed's first nightly is not the newest one. See docs/operations/release.md#update-feed.
10531053
update_feed:
10541054
name: Check the update feed
@@ -1091,19 +1091,22 @@ jobs:
10911091
--notes "The desktop updater reads this release to find the newest nightly. Do not delete it. See docs/operations/release.md."
10921092
gh release upload update-feed nightly.json --clobber
10931093
# A draft's files are not public, so a release someone drafted would hide the pointer.
1094-
gh release edit update-feed --draft=false
1094+
# It must never become "latest", which is the release stable installs update to.
1095+
gh release edit update-feed --draft=false --prerelease --latest=false
10951096
1097+
# An unreadable feed says nothing about its tags and the next tick reads it again, so only a
1098+
# feed that was read and names another nightly first fails the run.
10961099
- name: Fail when the feed hides the newest nightly
10971100
if: steps.feed.outputs.tag != '' && steps.feed.outputs.feed != 'ok'
10981101
env:
10991102
RELEASE_TAG: ${{ steps.feed.outputs.tag }}
11001103
FEED: ${{ steps.feed.outputs.feed }}
11011104
run: |
11021105
if [[ "$FEED" == "unreadable" ]]; then
1103-
echo "::error::releases.atom could not be read, so this run could not check it. No tag cleanup is needed unless a later run reports a hidden nightly."
1104-
else
1105-
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. A preview from a branch not rebased onto main is the usual cause. See docs/operations/release.md#update-feed."
1106+
echo "::warning::releases.atom could not be read, so this run did not check it."
1107+
exit 0
11061108
fi
1109+
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. A preview from a branch not rebased onto main is the usual cause. See docs/operations/release.md#update-feed."
11071110
exit 1
11081111
11091112
# The `t3` npm package is a launcher that downloads this version's CLI

‎apps/desktop/src/updates/githubUpdateFeed.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ const offeredRelease = async (
6666
const crowdedFeed = Array.from({ length: 10 }, (_, i) => `v0.1.10-preview.20261112.${4550 + i}`);
6767

6868
describe("GitHubProvider nightly lookup", () => {
69-
it("finds the newest nightly at the fixed pointer when other tags fill the feed", async () => {
70-
expect(await offeredRelease(crowdedFeed, nightly(4606))).toEqual({
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({
7174
tag: nightly(4606),
7275
releaseNotes: "pointer notes",
7376
apiScans: 0,

‎docs/operations/release.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,13 @@ A nightly install finds the newest nightly in up to three places.
483483

484484
The release workflow's `Check the update feed` job runs on every scheduled tick, unless
485485
`PAUSE_NIGHTLY` is set, and after every nightly. It waits in the same queue as releases and
486-
previews. It rewrites a missing or outdated pointer. Its last step fails when the feed cannot be
487-
read, or when the first nightly in the feed is not the newest one.
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.
488489

489-
When that step fails, installs that read only the feed cannot reach the newest nightly. The job
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
490493
log lists the tags in the feed. The usual cause is a preview dispatched from a branch that was not
491494
rebased onto `main`. Delete the tags nothing needs with `git push origin :refs/tags/<tag>`.
492495
Converting a release to a draft keeps its tag, so it does not help. To keep this from happening,

0 commit comments

Comments
 (0)