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 <noreply@anthropic.com>
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user