Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
whatsnew: Settings lists every release up to the waiting update, not its notes alone
yetone8c6270244296
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.jsindex cd613752d..9d3553b65 100644--- a/internal/gui/assets/app.js+++ b/internal/gui/assets/app.js@@ -4294,20 +4294,17 @@ async function whatsNewOnce() {}// openWhatsNew is Settings' way back to the notes: the current version's (or-// those since the last update), after the waiting update's when u has one.-// The notes that couldn't be had (the site failing, #661) say so, with a-// retry and the release page, apart from a version that has none.-async function openWhatsNew(u, b) {+// those since the last update), after those of every release up to the+// waiting update (pending), which the app puts first. The notes that+// couldn't be had (the site failing, #661) say so, with a retry and the+// release page, apart from a version that has none.+async function openWhatsNew(b) {if (b) { b.disabled = true; b.classList.add("busy"); }const w = await api(updatePath("whatsnew?all=1")).catch(() => null);if (b) { b.disabled = false; b.classList.remove("busy"); }- const list = [...(w?.releases || [])];- if (u?.notes && u.latest && ["ready", "available", "downloading", "found"].includes(u.state) && !list.some((r) => r.version === u.latest)) {- list.unshift({ version: u.latest, notes: u.notes, url: u.url, pending: true });- }- const failed = !w || !!w.error;+ const list = w?.releases || [];if (!list.length && !w?.current) return status(t("Couldn't load the release notes"), "err");- showWhatsNew(list, false, { failed, current: w?.current, url: w?.url, retry: () => openWhatsNew(u) });+ showWhatsNew(list, false, { failed: !w || !!w.error, current: w?.current, url: w?.url, retry: () => openWhatsNew() });}// auto: shown by itself after an update, with "Don't show again today"@@ -19611,7 +19608,7 @@ function renderSettings() {// has no notesif (/^v?\d+\.\d+\.\d+$/.test(s.version || "")) {const notes = el("button", "text", t("Open"));- notes.onclick = async () => openWhatsNew(await api(updatePath("update")).catch(() => null), notes);+ notes.onclick = () => openWhatsNew(notes);row(t("What's new"), t("The release notes since the last update"), "", notes).classList.add("whatsnew-row");}// the header's Update pill, kept away for good or for one version; thediff --git a/internal/gui/tests/whats-new.test.cjs b/internal/gui/tests/whats-new.test.cjsindex 227047f5a..b0fe2fdd4 100644--- a/internal/gui/tests/whats-new.test.cjs+++ b/internal/gui/tests/whats-new.test.cjs@@ -74,7 +74,10 @@ function serve(lang, ctl) {const all = url.searchParams.has("all");ctl.asked.push(all ? "all" : "start");const show = ctl.upgraded && !ctl.seen && !all;- return json({ show, current: "0.1.604", releases: show || (all && ctl.upgraded) ? RELEASES : all ? [RELEASES[0]] : [] });+ const releases = show || (all && ctl.upgraded) ? RELEASES : all ? [RELEASES[0]] : [];+ // Settings' ask: the app puts every release up to the waiting update+ // first, marked pending (小八: 0.1.1399 to 0.1.1408 were missing)+ return json({ show, current: "0.1.604", releases: all && ctl.ahead ? [...ctl.ahead, ...releases] : releases });}if (url.pathname === "/api/whatsnew/seen") { ctl.seen++; return route.fulfill({ status: 204 }); }if (url.pathname === "/api/whatsnew/today") { (ctl.today ||= []).push(req.postDataJSON().on); return route.fulfill({ status: 204 }); }@@ -87,8 +90,8 @@ function serve(lang, ctl) {}const words = {- en: { heads: ["Bug Fixes", "Improvements"], heads603: ["Bug Fixes", "Bug Fixes", "Thanks"], headPending: "Features", quiet: "Don't show again today", title: "What's new in v0.1.604", pendingTitle: "What's new in v0.1.605", close: "Close", again: "What's new", open: "Open", pending: "Not installed yet" },- zh: { heads: ["错误修复", "改进"], heads603: ["错误修复", "错误修复", "Thanks"], headPending: "新功能", quiet: "今天不再弹出", title: "v0.1.604 更新内容", pendingTitle: "v0.1.605 更新内容", close: "关闭", again: "更新内容", open: "打开", pending: "尚未安装" },+ en: { heads: ["Bug Fixes", "Improvements"], heads603: ["Bug Fixes", "Bug Fixes", "Thanks"], headPending: "Features", quiet: "Don't show again today", title: "What's new in v0.1.604", pendingTitle: "What's new in v0.1.607", close: "Close", again: "What's new", open: "Open", pending: "Not installed yet" },+ zh: { heads: ["错误修复", "改进"], heads603: ["错误修复", "错误修复", "Thanks"], headPending: "新功能", quiet: "今天不再弹出", title: "v0.1.604 更新内容", pendingTitle: "v0.1.607 更新内容", close: "关闭", again: "更新内容", open: "打开", pending: "尚未安装" },};for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {@@ -216,7 +219,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",assert.equal(await dialog(page).count(), 0, "shown once");// Settings → What's new → Open opens them again, the waiting update's first- ctl.update = { state: "ready", current: "0.1.604", latest: "0.1.605", notes: "## New Features\n\n- A new thing. (#470)", url: "https://github.com/yetone/magpie-releases/releases/tag/v0.1.605" };+ ctl.update = { state: "ready", current: "0.1.604", latest: "0.1.607", notes: "## New Features\n\n- A new thing. (#470)", url: "https://github.com/yetone/magpie-releases/releases/tag/v0.1.607" };+ ctl.ahead = [+ { version: "0.1.607", notes: ctl.update.notes, url: ctl.update.url, pending: true },+ { version: "0.1.606", notes: "- Six.", pending: true },+ { version: "0.1.605", notes: "- Five.", pending: true },+ ];await watchSettingsReads(page);await page.goto("http://magpie.test/?view=settings&tab=about");await settingsDrawn(page); // rows found are the ones that stay (#1659)@@ -240,8 +248,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",await dialog(page).waitFor();assert.equal(await view.evaluate((v) => v.scrollTop), at, "the click moved the page");assert.equal(await dialog(page).locator(".ehead b").textContent(), w.pendingTitle);- assert.deepEqual(await dialog(page).locator(".wn-ver b").allTextContents(), ["v0.1.605", "v0.1.604", "v0.1.603"]);- assert.equal(await dialog(page).locator(".wn-rel").first().locator(".badge").textContent(), w.pending);+ assert.deepEqual(await dialog(page).locator(".wn-ver b").allTextContents(), ["v0.1.607", "v0.1.606", "v0.1.605", "v0.1.604", "v0.1.603"]);+ assert.deepEqual(await dialog(page).locator(".wn-rel .badge").allTextContents(), [w.pending, w.pending, w.pending], "every release up to the update is not installed yet");assert.deepEqual(await dialog(page).locator(".wn-rel").first().locator(".wn-h").allTextContents(), [w.headPending]);assert.equal(ctl.asked.at(-1), "all");assert.equal(ctl.seen, 1, "asking again isn't a first showing");diff --git a/internal/gui/whatsnew.go b/internal/gui/whatsnew.goindex 4d6f7fe43..f2ca70973 100644--- a/internal/gui/whatsnew.go+++ b/internal/gui/whatsnew.go@@ -7,6 +7,7 @@ import ("net/http""os""path/filepath"+ "slices""strings""sync""time"@@ -184,6 +185,39 @@ func (n *whatsNew) get(ctx context.Context, all bool, lang string) whatsNewJSONreturn j}+// withWaiting puts first, in Settings' What's new while an update waits,+// the notes of every release after this one up to it, marked not installed+// yet. Only the update's own notes were (小八 on Discord: on 0.1.1398 with+// 0.1.1409 waiting, 0.1.1399 to 0.1.1408 were missing), so they come from+// the site as the restart's dialog has them (update/notes), with the+// update's own when the site can't say.+func withWaiting(ctx context.Context, list []update.Note, u updateJSON, lang string) []update.Note {+ switch u.State {+ case "ready", "available", "downloading", "found":+ default:+ return list+ }+ if !update.Released(Version) || u.Latest == "" || !update.Newer(u.Latest, Version) {+ return list+ }+ ahead, _ := fetchNotes(ctx, Version, u.Latest, lang)+ if len(ahead) == 0 && strings.TrimSpace(u.Notes) != "" {+ ahead = []update.Note{{Version: u.Latest, Notes: u.Notes, URL: u.URL}}+ }+ out := make([]update.Note, 0, len(ahead)+len(list))+ for _, r := range ahead {+ if !slices.ContainsFunc(list, func(o update.Note) bool { return o.Version == r.Version }) {+ r.Pending = true+ out = append(out, r)+ }+ }+ out = append(out, list...)+ if len(out) > update.MaxNotes {+ out = out[:update.MaxNotes]+ }+ return out+}+func (n *whatsNew) seen() {n.mu.Lock()n.shown = true@@ -240,7 +274,12 @@ func askedLang(r *http.Request) string {func whatsNewRoutes(mux *http.ServeMux) {mux.HandleFunc("GET /api/whatsnew", func(rw http.ResponseWriter, r *http.Request) {- writeJSON(rw, news.get(r.Context(), r.URL.Query().Get("all") != "", pageLang(r)))+ all, lang := r.URL.Query().Get("all") != "", pageLang(r)+ j := news.get(r.Context(), all, lang)+ if all {+ j.Releases = withWaiting(r.Context(), j.Releases, updates.jsonIn(askedLang(r)), lang)+ }+ writeJSON(rw, j)})mux.HandleFunc("POST /api/whatsnew/seen", func(rw http.ResponseWriter, r *http.Request) {news.seen()diff --git a/internal/gui/whatsnew_test.go b/internal/gui/whatsnew_test.goindex ebadfa464..177ecaa79 100644--- a/internal/gui/whatsnew_test.go+++ b/internal/gui/whatsnew_test.go@@ -7,6 +7,8 @@ import ("net/http/httptest""os""path/filepath"+ "slices"+ "strconv""strings""testing""time"@@ -245,3 +247,79 @@ func TestWhatsNewTodayRoute(t *testing.T) {t.Fatalf("bad body: %d", c)}}++// Settings' What's new with an update waiting lists every release after+// the one running up to it, not the update's alone (小八 on Discord: on+// 0.1.1398 with 0.1.1409 waiting, it showed 0.1.1409 and then 0.1.1398 and+// older). The site's list is the shape magpie-releases had that day, with+// 0.1.1407 never released and each note's Install section.+func TestWhatsNewListsEveryReleaseUpToTheWaitingUpdate(t *testing.T) {+ home := t.TempDir()+ t.Setenv("XDG_CONFIG_HOME", home)+ var list []update.Note+ for v := 1411; v >= 1396; v-- {+ if v == 1407 {+ continue+ }+ s := strconv.Itoa(v)+ list = append(list, update.Note{+ Version: "0.1." + s,+ Notes: "## Bug Fixes\n\n- fix " + s + "\n\n## Install\n\n- macOS: [magpie-0.1." + s + "-mac-arm64.dmg](https://github.com/yetone/magpie-releases/releases/download/v0.1." + s + "/magpie-0.1." + s + "-mac-arm64.dmg)",+ URL: "https://github.com/yetone/magpie-releases/releases/tag/v0.1." + s,+ })+ }+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ json.NewEncoder(w).Encode(map[string]any{"releases": list})+ }))+ defer srv.Close()+ t.Setenv("MAGPIE_NOTES_FEED", srv.URL)+ t.Setenv("MAGPIE_UPDATE_FEED", "http://127.0.0.1:1/")+ oldV, oldNews, oldUp := Version, news, updates+ t.Cleanup(func() { Version, news, updates = oldV, oldNews, oldUp })+ Version = "0.1.1398"+ // upgraded to 0.1.1398 from 0.1.1395 earlier: those since are kept too+ news = &whatsNew{after: "0.1.1395", pending: true, shown: true}+ mux := http.NewServeMux()+ whatsNewRoutes(mux)+ ask := func() whatsNewJSON {+ rec := httptest.NewRecorder()+ mux.ServeHTTP(rec, httptest.NewRequest("GET", "/api/whatsnew?all=1&lang=en", nil))+ var j whatsNewJSON+ if err := json.Unmarshal(rec.Body.Bytes(), &j); err != nil {+ t.Fatal(rec.Code, rec.Body.String(), err)+ }+ return j+ }+ got := func(j whatsNewJSON) (vs []string, pending []string) {+ for _, r := range j.Releases {+ vs = append(vs, r.Version)+ if r.Pending {+ pending = append(pending, r.Version)+ }+ }+ return+ }+ for _, state := range []string{"ready", "available", "downloading", "found"} {+ updates = &updater{state: state, notesIn: "en", latest: &update.Release{Version: "0.1.1409", Notes: "## Bug Fixes\n\n- fix 1409"}}+ vs, pending := got(ask())+ want := []string{"0.1.1409", "0.1.1408", "0.1.1406", "0.1.1405", "0.1.1404", "0.1.1403", "0.1.1402", "0.1.1401", "0.1.1400", "0.1.1399"}+ if !slices.Equal(pending, want) {+ t.Fatalf("%s: pending %v, want %v", state, pending, want)+ }+ if want = append(want, "0.1.1398", "0.1.1397", "0.1.1396"); !slices.Equal(vs, want) {+ t.Fatalf("%s: listed %v, want %v", state, vs, want)+ }+ }+ // the site out of reach: the update's own notes, then the kept ones+ news.notes = map[string][]update.Note{"en": {{Version: "0.1.1398", Notes: "- fix 1398"}}}+ srv.Close()+ updates = &updater{state: "ready", notesIn: "en", latest: &update.Release{Version: "0.1.1409", Notes: "## Bug Fixes\n\n- fix 1409", URL: "u"}}+ if vs, pending := got(ask()); !slices.Equal(vs, []string{"0.1.1409", "0.1.1398"}) || !slices.Equal(pending, []string{"0.1.1409"}) {+ t.Fatalf("offline: %v pending %v", vs, pending)+ }+ // nothing waiting: the version's own, none pending+ updates = &updater{state: "latest", notesIn: "en"}+ if vs, pending := got(ask()); !slices.Equal(vs, []string{"0.1.1398"}) || pending != nil {+ t.Fatalf("latest: %v pending %v", vs, pending)+ }+}diff --git a/internal/update/notes.go b/internal/update/notes.goindex f77c8e7b6..26084e48c 100644--- a/internal/update/notes.go+++ b/internal/update/notes.go@@ -18,6 +18,8 @@ type Note struct {Version string `json:"version"` // no vNotes string `json:"notes"` // markdown, its Install section taken outURL string `json:"url,omitempty"`+ // Pending: a release after the one running, up to the update waiting+ Pending bool `json:"pending,omitempty"`}// NotesFeed is where the notes of past releases are listed: beside the