fix(app): stop reading plugin readiness from plugin.list (#64527)

This commit is contained in:
Aiden Cline
2026-11-17 15:55:10 -06:00
committed by GitHub
Unverified
parent 64630cfd65
commit ea79f69bcf
3 changed files with 7 additions and 14 deletions
@@ -164,11 +164,7 @@ export const SettingsExtensions: Component<{
() => plugins.view(),
(current) => {
if (current.status !== "ready") return
dispatchUpdate({
type: "list.loaded",
ready: current.value.ready !== false,
outdated: packageFlags(current.value.data),
})
dispatchUpdate({ type: "list.loaded", outdated: packageFlags(current.value.data) })
},
{ defer: true },
),
@@ -81,20 +81,19 @@ test("an update runs once per package, then refreshes the list and hides the but
// The server reloads its plugins after the update returns, so the refresh can read the old flag. Before, any list load
// cleared what the update learned and the Update button came back until the next reload.
test("a list read before the server reloaded keeps an update's finding until a settled list agrees", () => {
test("a list read before the server reloaded keeps an update's finding until a list agrees", () => {
const run = harness()
run.dispatch({ type: "update.requested", target: a })
run.dispatch({ type: "update.succeeded", id: 0 })
const updated = run.machine.state
run.dispatch({ type: "list.loaded", ready: false, outdated: { [a]: true } })
run.dispatch({ type: "list.loaded", ready: true, outdated: { [a]: true } })
run.dispatch({ type: "list.loaded", outdated: { [a]: true } })
expect(run.machine.state).toBe(updated)
expect(pluginUpdateView(run.machine.state, listed(a, true)).outdated).toBe(false)
run.dispatch({ type: "list.loaded", ready: true, outdated: { [a]: false } })
run.dispatch({ type: "list.loaded", outdated: { [a]: false } })
expect(run.machine.state).not.toBe(updated)
expect(pluginUpdateView(run.machine.state, listed(a, true)).outdated).toBe(true)
@@ -34,10 +34,10 @@ export type PluginUpdateEvent =
| { readonly type: "update.succeeded"; readonly id: number }
| { readonly type: "update.failed"; readonly id: number; readonly message: string }
/**
* The plugin list loaded again. `ready` is false while the server is still reloading its plugins, when the list's
* flags may predate the latest check or update; `outdated` maps each listed package to its flag.
* The plugin list loaded again; `outdated` maps each listed package to its flag. A list read while the server still
* reloads its plugins can predate the latest check or update, so a finding is only dropped once a list agrees with it.
*/
| { readonly type: "list.loaded"; readonly ready: boolean; readonly outdated: Readonly<Record<string, boolean>> }
| { readonly type: "list.loaded"; readonly outdated: Readonly<Record<string, boolean>> }
/** Another server: forget what this one's checks and updates learned. */
| { readonly type: "server.changed" }
| { readonly type: "disposed" }
@@ -69,8 +69,6 @@ export function transitionPluginUpdate(state: PluginUpdateState, event: PluginUp
if (event.type === "server.changed") return step({ status: "idle", nextId: state.nextId, findings: {}, updating: [] })
if (event.type === "list.loaded") {
if (!event.ready) return step(state)
const settled = Object.keys(state.findings).filter(
(target) => !(target in event.outdated) || event.outdated[target] === state.findings[target]?.outdated,
)