From e5fbba281cba0d239ee111e0d7a7d26c0d85f27c Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 22:36:45 +0200 Subject: [PATCH] Releases: a title made of issue numbers reads its line from the notes "Horizon 2026.10.22.07: #1255, mob pushes, fix, #1222" now shows "Single player runs in the frame again until server players have vehicles and 3 more". Co-Authored-By: Claude Opus 5.5 --- website/src/estimate.test.mjs | 7 +++++++ website/src/releases.js | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/website/src/estimate.test.mjs b/website/src/estimate.test.mjs index 913bc2fea..3666b7fa1 100644 --- a/website/src/estimate.test.mjs +++ b/website/src/estimate.test.mjs @@ -55,3 +55,10 @@ test("a base held to its display's refresh rate gives only a floor for the avera // The lows sit under the cap: still a range. assert.ok(e.low_1pct_fps.high > e.low_1pct_fps.low); }); + +test("a release title of issue numbers falls back to its notes", async () => { + const { parts } = await import("./releases.js"); + const r = { tag_name: "v2026.10.22.07", name: "Horizon 2026.10.22.07: #1255, mob pushes, fix, #1222", body: "### Fixed\n- Fix #1222: single player runs in the frame again (#1257, fixes #1222)\n- Mob pushes: one list per mob (#1205)\n" }; + assert.equal(parts(r).line, "Single player runs in the frame again and 1 more"); + assert.equal(parts({ ...r, name: "Horizon 2026.10.22.05: Hoppers, mob tick, server tick" }).line, "Hoppers, mob tick, server tick"); +}); diff --git a/website/src/releases.js b/website/src/releases.js index 845cc8903..2e6a2e524 100644 --- a/website/src/releases.js +++ b/website/src/releases.js @@ -15,9 +15,26 @@ export function parts(r) { const version = launcherVersion(r.tag_name) ?? r.tag_name.replace(/^v/, ""); const name = (r.name || "").trim(); let line = name.includes(": ") ? name.slice(name.indexOf(": ") + 2) : name.replace(/^Horizon( launcher)?\s*/i, "").replace(version, "").trim(); + if (junk(line)) line = fromNotes(r.body) || line; return { version, line: line.charAt(0).toUpperCase() + line.slice(1), date: (r.published_at || "").slice(0, 10) }; } +// A title made of issue numbers and "fix" ("#1255, mob pushes, fix, #1222") says nothing. +const junk = (line) => { + const bits = line.split(",").map((b) => b.trim()).filter(Boolean); + return bits.length > 1 && bits.filter((b) => /^(#\d+|fix(es)?|fixed)$/i.test(b)).length * 2 >= bits.length; +}; + +// The first item that isn't a bare "Fix #123:" prefix, as the line: "Mob pushes: one list per mob… and 3 more fixes". +function fromNotes(body) { + const s = sections(body); + const items = [...s.filter((x) => /^new|what's new/i.test(x.title)), ...s.filter((x) => /^fixed/i.test(x.title))].flatMap((x) => x.items).map(plainItem); + const clean = items.map((i) => i.replace(/^(fix|fixes)\s+#\d+:\s*/i, "").replace(/^\w+\([^)]*\):\s*/, "")).filter(Boolean); + if (!clean.length) return ""; + const first = clean[0].replace(/[.]$/, ""); + return clean.length > 1 ? `${first} and ${clean.length - 1} more` : first; +} + // The notes' "### Heading" sections and their top-level items, in order. export function sections(body) { const out = [];