Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(ok): quote changeset prose in point-release notes (PRD-7722) (#3094)
Andrew Mikofalvya7293b529b7d
diff --git a/.github/scripts/point-release-plan.mjs b/.github/scripts/point-release-plan.mjsindex 015c92cd5..4a6a63151 100644--- a/.github/scripts/point-release-plan.mjs+++ b/.github/scripts/point-release-plan.mjs@@ -27,6 +27,7 @@ import {realGit,runGit,} from '../../scripts/compute-stable-version.mjs';+import { parseChangeset } from './write-back.mjs';function refuse(code, message) {return { ok: false, code, message };@@ -400,6 +401,22 @@ export function runPointRelease(opts, io) {const mainReset = decideMainReset({ anchorDeltaIds, addedIds: version.addedIds, bridgeConfigured, guards, warnings });+ // The Release body is what every announcement channel renders verbatim+ // (Slack/Discord inline it), so it quotes each added changeset's prose the+ // way a stable's aggregated notes do, rather than listing ids. Reads are+ // best-effort per entry: notes are cosmetic and must never refuse a release,+ // so a failed read degrades that entry to its id. Composed at plan time so a+ // dry run previews the exact announcement.+ const changesetEntries = version.addedIds.map((id) => {+ let body = null;+ try {+ body = parseChangeset(io.git.changesetContent(syntheticSha, id))?.body ?? null;+ } catch {+ body = null;+ }+ return { id, body };+ });+const plan = {mode,dryRun,@@ -419,10 +436,12 @@ export function runPointRelease(opts, io) {bump: version.bump,addedIds: version.addedIds,removedIds: version.removedIds,+ changesetEntries,mainReset,guards,warnings,};+ plan.releaseNotes = formatReleaseNotes(plan);if (dryRun) return plan;@@ -449,7 +468,7 @@ export function runPointRelease(opts, io) {targetSha: syntheticSha,title: plan.tag,draft: true,- notes: formatReleaseNotes(plan),+ notes: plan.releaseNotes,});// The ONLY cascade dispatch for the release itself, matching what@@ -574,7 +593,7 @@ function decideMainReset({ anchorDeltaIds, addedIds, bridgeConfigured, guards, wreturn { dispatch: true, deltaIds, skipReason: null };}-function formatReleaseNotes(plan) {+export function formatReleaseNotes(plan) {const lines = [`Point release over ${plan.latestStableTag}: the current stable plus ${plan.fixRefs.length} applied ` +`commit(s), isolated from the changes still soaking on main.`,@@ -582,7 +601,22 @@ function formatReleaseNotes(plan) {`Mode: ${plan.mode}`,`Applied: ${plan.fixRefs.map((r) => `${r.ref} (${r.sha})`).join(', ')}`,];- if (plan.addedIds.length > 0) lines.push(`Changesets added: ${plan.addedIds.join(', ')}`);+ // Quote each added changeset's prose under the same level heading a stable's+ // aggregated notes use, so the announcement channels render both release+ // kinds identically. The bump is guarded patch-only, so the heading is+ // always `Patch Changes`. Entries whose content could not be read fall back+ // to the old id list so the body never claims less than the ids conveyed.+ const entries = plan.changesetEntries ?? [];+ const quoted = entries.filter((e) => e.body);+ const unquoted = entries.filter((e) => !e.body);+ if (quoted.length > 0) {+ lines.push('', '### Patch Changes', '');+ for (const e of quoted) {+ lines.push(`- ${e.body.split('\n').join('\n ')}`);+ }+ }+ const unquotedIds = entries.length > 0 ? unquoted.map((e) => e.id) : plan.addedIds;+ if (unquotedIds.length > 0) lines.push('', `Changesets added: ${unquotedIds.join(', ')}`);if (plan.removedIds.length > 0) lines.push(`Changesets removed: ${plan.removedIds.join(', ')}`);return `${lines.join('\n')}\n`;}@@ -613,6 +647,9 @@ function realIo() {`git rev-parse --verify refs/tags/${tag} failed (exit ${res.status}): ${res.error?.message ?? String(res.stderr || '').trim()}`,);},+ // Raw changeset contents from the synthetic commit, for the release+ // notes. runGit fails loud on a bad read; the caller degrades per entry.+ changesetContent: (sha, id) => runGit(['show', `${sha}:.changeset/${id}.md`]),checkoutDetached: (sha) => void runGit(['checkout', '--detach', sha]),cherryPick: (ref) => void runGit(['cherry-pick', ref]),// --no-edit only suppresses the message editor; the pick is otherwisediff --git a/.github/scripts/point-release-plan.test.mjs b/.github/scripts/point-release-plan.test.mjsindex fe68e4d41..4d1f47ef8 100644--- a/.github/scripts/point-release-plan.test.mjs+++ b/.github/scripts/point-release-plan.test.mjs@@ -256,6 +256,7 @@ function makeIo(overrides = {}) {existingTags = ['v0.32.0'],changesets = { 'stable-sha': ['keep-a'], 'synthetic-sha': ['keep-a'] },bumpTypes = {},+ changesetContents = {},prebuildHeadSha = 'prebuild-sha',ancestries = [['prebuild-sha', 'synthetic-sha']],cherryPick,@@ -283,6 +284,11 @@ function makeIo(overrides = {}) {isAncestor: (a, b) => ancestries.some(([x, y]) => x === a && y === b),changesetIds: (sha) => changesets[sha] ?? [],bumpTypeOf: (_sha, id) => bumpTypes[id] ?? 'patch',+ changesetContent: (_sha, id) => {+ const content = changesetContents[id];+ if (content === undefined) throw new Error(`no changeset content for ${id}`);+ return content;+ },checkoutDetached: (sha) => checkedOut.push(sha),cherryPick: cherryPick ?? ((ref) => applied.push(['cherry-pick', ref])),revert: revert ?? ((ref) => applied.push(['revert', ref])),@@ -427,6 +433,59 @@ describe('runPointRelease cascade', () => {expect(io.releases[0]).toMatchObject({ tag: 'v0.32.1', targetSha: 'synthetic-sha', draft: true });});+ test('the release notes quote each added changeset the way a stable body does', () => {+ const io = makeIo({+ changesets: {+ 'stable-sha': ['keep-a'],+ 'synthetic-sha': ['keep-a', 'shiny-fix'],+ fix1: ['keep-a', 'shiny-fix'],+ 'fix1^': ['keep-a'],+ },+ changesetContents: {+ 'shiny-fix':+ '---\n"@inkeep/open-knowledge": patch\n---\n\nChips no longer balloon into ovals.\nSecond line of the note.\n',+ },+ });+ runPointRelease({ mode: 'cherry-pick', fixRefs: ['fix1'], dryRun: false }, io);+ const notes = io.releases[0].notes;+ expect(notes).toContain('### Patch Changes');+ expect(notes).toContain('- Chips no longer balloon into ovals.\n Second line of the note.');+ expect(notes).not.toContain('Changesets added:');+ });++ test('an unreadable changeset degrades its notes entry to the id rather than refusing', () => {+ const io = makeIo({+ changesets: {+ 'stable-sha': ['keep-a'],+ 'synthetic-sha': ['keep-a', 'shiny-fix'],+ fix1: ['keep-a', 'shiny-fix'],+ 'fix1^': ['keep-a'],+ },+ });+ runPointRelease({ mode: 'cherry-pick', fixRefs: ['fix1'], dryRun: false }, io);+ expect(io.calls.createRelease).toBe(1);+ expect(io.releases[0].notes).toContain('Changesets added: shiny-fix');+ expect(io.releases[0].notes).not.toContain('### Patch Changes');+ });++ test('a dry run previews the exact release notes without touching anything remote', () => {+ const io = makeIo({+ changesets: {+ 'stable-sha': ['keep-a'],+ 'synthetic-sha': ['keep-a', 'shiny-fix'],+ fix1: ['keep-a', 'shiny-fix'],+ 'fix1^': ['keep-a'],+ },+ changesetContents: {+ 'shiny-fix': '---\n"@inkeep/open-knowledge": patch\n---\n\nChips no longer balloon into ovals.\n',+ },+ });+ const plan = runPointRelease({ mode: 'cherry-pick', fixRefs: ['fix1'], dryRun: true }, io);+ expect(plan.releaseNotes).toContain('### Patch Changes');+ expect(plan.releaseNotes).toContain('- Chips no longer balloon into ovals.');+ expect(io.calls).toEqual({ tag: 0, pushTag: 0, createRelease: 0, dispatch: 0 });+ });+test('revert with no named delta skips main-reset and names both follow-ups', () => {const io = makeIo();const plan = runPointRelease({ mode: 'revert', fixRefs: ['bad1'], dryRun: false }, io);