Skip to content

Commit 460b88b

Browse files
t3dotggclaude
andauthored
feat(release): update notes lead with up to 7 highlights (#28593)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 70f475f commit 460b88b

8 files changed

Lines changed: 221 additions & 118 deletions

File tree

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {
9292
]);
9393
});
9494

95+
it.each([
96+
"**v1.2.4** · 3 changes from 2 contributors\n- **One-time tasks.** Pick a date.\n\n### Plus 2 more bug fixes and performance improvements.",
97+
"<p><strong>v1.2.4</strong> · 3 changes from 2 contributors</p><ul><li><strong>One-time tasks.</strong> Pick a date.</li></ul><h3>Plus 2 more bug fixes and performance improvements.</h3>",
98+
])("keeps highlight labels and the remaining change count from the feed", (summary) => {
99+
const { releaseNotes } = normalizeDesktopUpdateReleaseNotes(
100+
summary + "\n<details><summary>Full changelog</summary>raw list</details>",
101+
"1.2.4",
102+
"latest",
103+
);
104+
expect(releaseNotes).toEqual([
105+
{
106+
version: "1.2.4",
107+
stats: "3 changes from 2 contributors",
108+
items: ["**One-time tasks.** Pick a date."],
109+
totalItems: 1,
110+
footer: "Plus 2 more bug fixes and performance improvements.",
111+
},
112+
]);
113+
});
114+
95115
it("does not count Markdown or HTML section headings as changes", () => {
96116
const changes = Array.from({ length: 8 }, (_, index) => `Change ${index + 1}`);
97117
const result = normalizeDesktopUpdateReleaseNotes(

‎apps/desktop/src/updates/releaseNotes.ts‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,18 @@ function decodeHtmlEntities(input: string): string {
5454
);
5555
}
5656

57-
function stripMarkup(input: string): string {
58-
return decodeHtmlEntities(
57+
function stripMarkup(input: string, keepBold = false): string {
58+
const markdown = decodeHtmlEntities(
5959
input
6060
.replace(/<br\s*\/?>/gi, "\n")
6161
.replace(/<li\b[^>]*>/gi, "\n- ")
6262
.replace(/<h([1-6])\b[^>]*>/gi, (_, level: string) => `\n${"#".repeat(Number(level))} `)
6363
.replace(/<\/(?:p|div|li|h[1-6]|ul|ol|blockquote)>/gi, "\n")
64+
.replace(/<\/?(?:strong|b)\b[^>]*>/gi, "**")
6465
.replace(/<[^>]*>/g, "")
65-
.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")
66-
.replace(/\*\*([^*]+)\*\*/g, "$1"),
66+
.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1"),
6767
);
68+
return keepBold ? markdown : markdown.replace(/\*\*([^*]+)\*\*/g, "$1");
6869
}
6970

7071
function truncateReleaseNoteItem(item: string): string {
@@ -92,40 +93,42 @@ function isIgnoredReleaseNoteLine(line: string): boolean {
9293
);
9394
}
9495

95-
interface ExtractedReleaseNoteItems {
96-
readonly items: ReadonlyArray<string>;
97-
readonly totalItems: number;
98-
readonly intro?: string;
99-
readonly stats?: string;
100-
}
96+
type ExtractedReleaseNoteItems = Omit<DesktopUpdateReleaseNote, "version" | "releasedAt">;
10197

102-
/**
103-
* Reads a generated summary (`scripts/generate-release-notes.ts`): a `v1.2.3 · N changes…`
104-
* header, a highlights paragraph, and fix bullets. PR numbers are left to the GitHub page.
105-
*/
98+
/** Older generated notes have a highlights paragraph followed by a separate list of fixes. */
10699
function extractReleaseNoteSummary(summary: string): ExtractedReleaseNoteItems {
107100
let stats: string | undefined;
101+
let footer: string | undefined;
108102
const intro: string[] = [];
109103
const items: string[] = [];
110-
for (const rawLine of stripMarkup(summary).split("\n")) {
111-
const line = rawLine.trim().replace(/\s+/g, " ");
112-
if (line === "" || /^#{1,6}\s+/.test(line)) continue;
113-
if (stats === undefined && /^v\S+ · /.test(line)) {
114-
stats = line.slice(line.indexOf(" · ") + 3);
115-
continue;
116-
}
117-
const text = line
118-
.replace(/^[-*]\s+/, "")
104+
for (const rawLine of stripMarkup(summary, true).split("\n")) {
105+
const line = rawLine
106+
.trim()
107+
.replace(/\s+/g, " ")
119108
.replace(/\s*\((?:#\d+(?:,\s*)?)+\)\.?$/, "")
120109
.trim();
121-
if (/^[-*]\s+/.test(line)) items.push(text);
122-
else intro.push(text);
110+
const plain = line.replace(/\*\*([^*]+)\*\*/g, "$1");
111+
if (/^### Plus \d+ more /.test(plain)) {
112+
footer = plain.slice(4);
113+
continue;
114+
}
115+
if (plain === "" || /^#{1,6}\s+/.test(plain)) continue;
116+
if (stats === undefined && /^v\S+ · /.test(plain)) {
117+
stats = plain.slice(plain.indexOf(" · ") + 3);
118+
continue;
119+
}
120+
if (/^[-*]\s+/.test(line)) {
121+
items.push(line.replace(/^[-*]\s+/, ""));
122+
} else {
123+
intro.push(plain);
124+
}
123125
}
124126
return {
125127
items,
126128
totalItems: items.length + intro.length,
127129
...(intro.length > 0 ? { intro: intro.join(" ") } : {}),
128130
...(stats ? { stats } : {}),
131+
...(footer ? { footer } : {}),
129132
};
130133
}
131134

@@ -184,16 +187,13 @@ export function normalizeDesktopUpdateReleaseNotes(
184187
).filter((entry) => desktopUpdateChannelOf(entry.version) === channel);
185188

186189
const normalizedNotes = rawNotes.flatMap((entry) => {
187-
const { items, totalItems, intro, stats } = extractReleaseNoteItems(entry.note);
188-
if (totalItems === 0) return [];
190+
const note = extractReleaseNoteItems(entry.note);
191+
if (note.totalItems === 0 && !note.stats) return [];
189192
const releasedAt = resolveReleasedAt(entry.version, fallbackVersion, releaseDate);
190193
return [
191194
{
192195
version: entry.version,
193-
items,
194-
totalItems,
195-
...(intro ? { intro } : {}),
196-
...(stats ? { stats } : {}),
196+
...note,
197197
...(releasedAt ? { releasedAt } : {}),
198198
},
199199
];

‎apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,19 @@ describe("SidebarUpdatePill release notes", () => {
100100
await userEvent.tab();
101101
expect(releaseNotes()).toBeNull();
102102

103-
await publish(nightlyUpdate(RELEASE_NOTES));
104-
await vi.waitFor(() => expect(releaseNotes()).not.toBeNull());
103+
await publish(
104+
nightlyUpdate([
105+
{
106+
version: "0.0.50-nightly.2",
107+
items: ["**One-time tasks.** Pick a date."],
108+
totalItems: 1,
109+
stats: "3 changes from 2 contributors",
110+
footer: "Plus 2 more bug fixes.",
111+
},
112+
]),
113+
);
114+
await expect.element(page.getByText("One-time tasks.", { exact: true })).toBeVisible();
115+
await expect.element(page.getByText("Plus 2 more bug fixes.")).toBeVisible();
105116
});
106117
});
107118

‎apps/web/src/components/sidebar/SidebarUpdateReleaseNotes.tsx‎

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -101,48 +101,53 @@ export function SidebarUpdateReleaseNotes({
101101
? "View release on GitHub"
102102
: `${omittedItemCount} more ${omittedItemCount === 1 ? "change" : "changes"} on GitHub`);
103103

104-
if (releaseNote.intro !== undefined) {
105-
return (
106-
<section className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
107-
{releaseNote.version !== state.availableVersion ? (
104+
const generated = releaseNote.stats !== undefined || releaseNote.intro !== undefined;
105+
return (
106+
<section className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
107+
{generated ? (
108+
releaseNote.version !== state.availableVersion && (
108109
<h3 className="mb-1 text-xs leading-4 font-medium text-muted-foreground">
109110
{releaseNote.releasedAt
110111
? `${releaseNote.version} · ${formatReleaseAge(releaseNote.releasedAt)}`
111112
: releaseNote.version}
112113
</h3>
113-
) : null}
114+
)
115+
) : (
116+
<h3 className="mb-2 text-foreground text-xs leading-4 font-semibold">
117+
{index === 0 ? "What's changed" : `Changes in ${releaseNote.version}`}
118+
</h3>
119+
)}
120+
{releaseNote.intro ? (
114121
<p className="break-words text-xs leading-5 text-popover-foreground">
115122
{releaseNote.intro}
116123
</p>
117-
{releaseUrl ? (
118-
<ReleaseLink releaseUrl={releaseUrl} shell={shell}>
119-
{releaseNote.stats ?? "View release on GitHub"}
120-
</ReleaseLink>
121-
) : null}
122-
</section>
123-
);
124-
}
125-
126-
return (
127-
<div className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
128-
<section>
129-
<h3 className="text-foreground text-xs leading-4 font-semibold">
130-
{index === 0 ? "What's changed" : `Changes in ${releaseNote.version}`}
131-
</h3>
132-
<ul className="mt-2 space-y-1.5 pl-4 text-xs leading-5 text-popover-foreground/90">
133-
{keyReleaseNoteItems(releaseNote.items).map(({ item, key }) => (
134-
<li className="list-disc break-words" key={key}>
135-
{item}
136-
</li>
137-
))}
124+
) : releaseNote.items.length > 0 ? (
125+
<ul className="space-y-1.5 pl-4 text-xs leading-5 text-popover-foreground/90">
126+
{keyReleaseNoteItems(releaseNote.items).map(({ item, key }) => {
127+
const highlight = /^\*\*([^*]+)\*\* (.+)$/.exec(item);
128+
return (
129+
<li className="list-disc break-words" key={key}>
130+
{highlight ? (
131+
<>
132+
<strong>{highlight[1]}</strong> {highlight[2]}
133+
</>
134+
) : (
135+
item
136+
)}
137+
</li>
138+
);
139+
})}
138140
</ul>
139-
{releaseUrl ? (
140-
<ReleaseLink releaseUrl={releaseUrl} shell={shell}>
141-
{linkLabel}
142-
</ReleaseLink>
143-
) : null}
144-
</section>
145-
</div>
141+
) : null}
142+
{releaseNote.footer && (
143+
<p className="mt-2 text-xs leading-5 font-semibold">{releaseNote.footer}</p>
144+
)}
145+
{releaseUrl && (
146+
<ReleaseLink releaseUrl={releaseUrl} shell={shell}>
147+
{linkLabel}
148+
</ReleaseLink>
149+
)}
150+
</section>
146151
);
147152
})}
148153
{state.omittedReleaseCount > 0 ? (

‎docs/operations/release.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ the version.
4242
- Only plain stable `X.Y.Z` releases are marked as the repository's latest release.
4343
- Nightly runs are always GitHub prereleases and never marked latest.
4444
- Automatically generated release notes are pinned to the previous tag in the same channel, so stable compares to the previous stable tag and nightly compares to the previous nightly tag.
45-
- The release job's **Write release notes** step (`scripts/generate-release-notes.ts`) builds the body: a computed header line, a short summary from `gpt-6.1-terra`, and GitHub's generated list folded under `<details>`. It needs the `OPENAI_API_KEY` secret. The summary leaves out commits whose scopes are all mobile; the header counts every commit. The desktop update popover, on every channel, shows the highlights paragraph and the header counts as a short note per release, with the offered release's age from the update feed's `releaseDate`. The nightly Discord post shows the part above `<details>`. If the step fails or there is nothing to summarize, it writes no file and the release uses GitHub's generated notes as before.
45+
- The release job's **Write release notes** step (`scripts/generate-release-notes.ts`) builds the body: a computed header line, a short summary from `gpt-6.1-terra`, and GitHub's generated list folded under `<details>`. It needs the `OPENAI_API_KEY` secret. The desktop update popover shows up to seven highlights and the number of other fixes and performance improvements. Mobile-only commits count toward release totals but cannot be highlights. The offered release's age comes from the update feed's `releaseDate`. The nightly Discord post shows the part above `<details>`. If summary generation fails, the release uses GitHub's generated notes.
4646
- Includes Electron auto-update metadata (for example `latest*.yml`, `nightly*.yml`, and `*.blockmap`) in release assets.
4747
- Builds a self-contained CLI archive per platform (`t3-<version>-<platform>-<arch>.tar.gz`, `.zip` on Windows) in the same job as that target's desktop artifact and attaches them to the GitHub Release with a `SHA256SUMS` file, on every channel, for five targets: macOS arm64, Linux x64 and arm64, Windows x64 and arm64. Every archive is smoke-tested on hardware of its own architecture, and every one but the Windows archives is also built and signed there. There is no macOS x64 archive: Node single-executables are unsupported on x64 macOS (the SEA docs list macOS as arm64 only) and the binary segfaults on start; the x64 desktop app is Electron and unaffected.
4848
- The archive holds the server as a Node single-executable (`scripts/build-cli-archive.ts`), so unpacking it needs neither Node, npm, nor a compiler. It is the only form in which T3 Code manages a runtime: the desktop's SSH environments, the boot service, `t3 update`, and the install scripts all download and verify this archive against `SHA256SUMS`. The `t3` npm package exists for people who run `npx t3` or `npm install -g t3` themselves, and it downloads this same archive too; nothing in the product installs from npm. The `curl | sh` installers are `scripts/install.sh` and `scripts/install.ps1`; the marketing site copies them into its `public/` at build time (`apps/marketing/scripts/stage-install-scripts.mjs`) and serves them at `t3.codes/install.sh` and `/install.ps1`.

‎packages/contracts/src/ipc.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,11 @@ export interface DesktopUpdateReleaseNote {
290290
totalItems: number;
291291
/** ISO time from the update feed for the offered version, else `YYYY-MM-DD` from a prerelease version. */
292292
releasedAt?: string;
293-
/** Generated summaries only: the highlights paragraph. `items` then holds the fixes. */
293+
/** Paragraph-style summaries from older releases keep their fixes in `items`. */
294294
intro?: string;
295295
/** Generated summaries only, for example "275 changes from 22 contributors". */
296296
stats?: string;
297+
footer?: string;
297298
}
298299

299300
export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
@@ -303,6 +304,7 @@ export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
303304
releasedAt: Schema.optionalKey(Schema.String),
304305
intro: Schema.optionalKey(Schema.String),
305306
stats: Schema.optionalKey(Schema.String),
307+
footer: Schema.optionalKey(Schema.String),
306308
});
307309

308310
export const DesktopUpdateStateSchema = Schema.Struct({

‎scripts/generate-release-notes.test.ts‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import * as Option from "effect/Option";
44

55
import {
66
countContributors,
7+
formatReleaseSummary,
78
isReleaseNoteCommit,
8-
summaryText,
9+
readReleaseHighlights,
910
type PullRequest,
1011
} from "./generate-release-notes.ts";
1112

@@ -53,13 +54,54 @@ it("leaves mobile-only scopes out and keeps shared ones", () => {
5354
}
5455
});
5556

56-
it("uses model text only from a completed response", () => {
57+
it("reads highlights only from a completed JSON response", () => {
5758
const output = [
58-
{ type: "message", content: [{ type: "output_text", text: " ## Highlights\nX " }] },
59+
{ type: "message", content: [{ type: "output_text", text: ' {"highlights":[]} ' }] },
5960
];
61+
assert.deepStrictEqual(readReleaseHighlights({ status: "completed", output }), Option.some([]));
62+
assert.deepStrictEqual(readReleaseHighlights({ status: "incomplete", output }), Option.none());
63+
});
64+
65+
it("counts fixes and performance changes once, outside the selected highlights", () => {
66+
const commits = [
67+
"feat: schedule a task once",
68+
"fix: use the selected time",
69+
"perf(server): read less history",
70+
"fix(mobile): restore the chat position",
71+
"docs: update instructions",
72+
].map((subject) => ({ subject, authorName: "" }));
73+
const selected = [
74+
{ label: "One-time tasks", detail: "Schedule a task for a specific time.", commits: [1, 2] },
75+
] as const;
76+
assert.deepStrictEqual(
77+
formatReleaseSummary(commits, selected),
78+
Option.some(
79+
"- **One-time tasks.** Schedule a task for a specific time.\n\n### Plus 2 more bug fixes and performance improvements.",
80+
),
81+
);
6082
assert.deepStrictEqual(
61-
summaryText({ status: "completed", output }),
62-
Option.some("## Highlights\nX"),
83+
formatReleaseSummary(commits.slice(0, 2), selected),
84+
Option.some("- **One-time tasks.** Schedule a task for a specific time."),
6385
);
64-
assert.deepStrictEqual(summaryText({ status: "incomplete", output }), Option.none());
86+
assert.deepStrictEqual(formatReleaseSummary(commits.slice(2), selected), Option.none());
87+
assert.deepStrictEqual(
88+
formatReleaseSummary(commits, []),
89+
Option.some("**3 bug fixes and performance improvements.**"),
90+
);
91+
assert.deepStrictEqual(formatReleaseSummary(commits.slice(-1), []), Option.some(""));
92+
});
93+
94+
it("counts fixes beyond the seven displayed highlights in the footer", () => {
95+
const commits = Array.from({ length: 8 }, (_, i) => ({
96+
subject: `fix: change ${i + 1}`,
97+
authorName: "",
98+
}));
99+
const highlights = commits.map((_, i) => ({
100+
label: `Fix ${i + 1}`,
101+
detail: "A fix.",
102+
commits: [i + 1] as const,
103+
}));
104+
const summary = Option.getOrThrow(formatReleaseSummary(commits, highlights));
105+
assert.lengthOf(summary.match(/^- /gm) ?? [], 7);
106+
assert.include(summary, "Plus 1 more bug fix.");
65107
});

0 commit comments

Comments
 (0)