authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:29:36-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:29:36-07:00
logc9b76e6f5d382fb83caafe419f75ead87a3dbabb
treed65dfc5cb3438a154121c628c7c34b2b4555eade
parent93d4dfa2064dc4a598a3e66543c3b90ffb138609
signature Signed by PGP key B5690EEEBB952194

refactor(web): remove obsolete provider update helpers (#10015)


2 files changed, 0 insertions(+), 162 deletions(-)

apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts-91
......@@ -18,17 +18,14 @@ import {
1818 environmentGroupsWithUpdates,
1919 firstFailedProviderUpdateMessage,
2020 firstRejectedProviderUpdateMessage,
21 firstUnsuccessfulSecondaryProviderOutcome,
2221 getProviderUpdateInitialToastView,
2322 getProviderUpdateProgressToastView,
2423 getProviderUpdateRejectedToastView,
2524 getProviderUpdateSidebarPillView,
26 getSingleProviderUpdateProgressToastView,
2725 hasOneClickUpdateProviderCandidate,
2826 isProviderUpdateCandidate,
2927 isTerminalProviderUpdatePhase,
3028 localEnvironmentUpdateNotificationKey,
31 parseWslDistroFromInstanceId,
3229 providerUpdateNotificationKey,
3330 resolveEnvironmentUpdateRowStatus,
3431 shouldShowPrimaryProviderUpdateToast,
......@@ -368,28 +365,6 @@ describe("provider update launch notification logic", () => {
368365 });
369366 });
370367
371 it("resolves a single-provider completion view from the returned provider snapshot", () => {
372 const view = getSingleProviderUpdateProgressToastView(
373 provider({
374 driver: driver("codex"),
375 updateState: {
376 status: "failed",
377 startedAt: checkedAt,
378 finishedAt: checkedAt,
379 message: "command failed",
380 output: "stderr",
381 },
382 }),
383 );
384
385 expect(view).toMatchObject({
386 phase: "failed",
387 type: "error",
388 title: "Codex v1.1.0 update failed",
389 description: "command failed",
390 });
391 });
392
393368 it("keeps unchanged providers actionable from settings", () => {
394369 const view = getProviderUpdateProgressToastView({
395370 providers: [
......@@ -444,31 +419,6 @@ describe("provider update launch notification logic", () => {
444419 });
445420 });
446421
447 it("uses the updated version in the single-provider success toast title", () => {
448 const view = getSingleProviderUpdateProgressToastView(
449 provider({
450 driver: driver("codex"),
451 version: "1.1.0",
452 latestVersion: "1.1.0",
453 advisoryStatus: "current",
454 updateState: {
455 status: "succeeded",
456 startedAt: checkedAt,
457 finishedAt: checkedAt,
458 message: "Provider updated.",
459 output: null,
460 },
461 }),
462 );
463
464 expect(view).toMatchObject({
465 phase: "succeeded",
466 type: "success",
467 title: "Codex updated: v1.1.0",
468 description: "New sessions will use the updated provider.",
469 });
470 });
471
472422 it("falls back to a rejected RPC message for transport-level failures", () => {
473423 const results = [AsyncResult.failure(Cause.die(new Error("WebSocket closed")))];
474424
......@@ -814,39 +764,6 @@ describe("provider update launch notification logic", () => {
814764 expect(snapshots).toEqual([primary]);
815765 });
816766
817 it("flags the first unsuccessful secondary outcome, skipping the primary and successes", () => {
818 const primaryFailed = provider({
819 driver: driver("codex"),
820 updateState: terminalState("failed", "primary boom"),
821 });
822
823 expect(
824 firstUnsuccessfulSecondaryProviderOutcome([
825 fulfilledOutcome(true, primaryFailed),
826 fulfilledOutcome(
827 false,
828 provider({
829 driver: driver("codex"),
830 updateState: terminalState("succeeded", "ok"),
831 }),
832 ),
833 ]),
834 ).toBeNull();
835
836 expect(
837 firstUnsuccessfulSecondaryProviderOutcome([
838 fulfilledOutcome(true, primaryFailed),
839 fulfilledOutcome(
840 false,
841 provider({
842 driver: driver("codex"),
843 updateState: terminalState("failed", "wsl boom"),
844 }),
845 ),
846 ]),
847 ).toMatchObject({ status: "failed", provider: { updateState: { message: "wsl boom" } } });
848 });
849
850767 it("treats a rejected dispatch as not contributing a snapshot", () => {
851768 const primary = provider({
852769 driver: driver("codex"),
......@@ -995,14 +912,6 @@ describe("provider update launch notification logic", () => {
995912 }),
996913 ).toBe("My Device");
997914 });
998
999 it("parses the WSL distro from the backend instance id", () => {
1000 expect(parseWslDistroFromInstanceId("wsl:ubuntu")).toBe("ubuntu");
1001 expect(parseWslDistroFromInstanceId("wsl:default")).toBeNull();
1002 expect(parseWslDistroFromInstanceId("wsl:")).toBeNull();
1003 expect(parseWslDistroFromInstanceId("ssh:host")).toBeNull();
1004 expect(parseWslDistroFromInstanceId(undefined)).toBeNull();
1005 });
1006915 });
1007916
1008917 describe("isTerminalProviderUpdatePhase", () => {
apps/web/src/components/ProviderUpdateLaunchNotification.logic.ts-71
......@@ -326,41 +326,6 @@ export function getProviderUpdateProgressToastView(input: {
326326 return getProviderUpdateRunningToastView(input.providerCount);
327327}
328328
329export function getSingleProviderUpdateProgressToastView(
330 provider: ServerProvider,
331): ProviderUpdateToastView {
332 const view = getProviderUpdateProgressToastView({
333 providers: [provider],
334 providerCount: 1,
335 });
336 const providerName = PROVIDER_DISPLAY_NAMES[provider.driver] ?? provider.driver;
337
338 switch (view.phase) {
339 case "running":
340 return {
341 ...view,
342 title: `Updating ${providerName}`,
343 };
344 case "failed":
345 return {
346 ...view,
347 title: getProviderFailedUpdateTitle(provider),
348 };
349 case "unchanged":
350 return {
351 ...view,
352 title: `${providerName} still needs an update`,
353 };
354 case "succeeded":
355 return {
356 ...view,
357 title: getProviderUpdatedTitle(provider),
358 };
359 default:
360 return view;
361 }
362}
363
364329export function collectUpdatedProviderSnapshots(input: {
365330 readonly results: ReadonlyArray<
366331 AtomCommandResult<{ readonly providers: ReadonlyArray<ServerProvider> }, unknown>
......@@ -649,42 +614,6 @@ export function collectProviderUpdateOutcomeSnapshots(
649614 return [...worstByDriver.values()];
650615}
651616
652/**
653 * The first secondary (non-primary) backend whose update resolved without
654 * succeeding. The primary's own failed/unchanged state is already surfaced
655 * inline in settings, so only secondaries (which have no inline row) need an
656 * explicit callout.
657 */
658export function firstUnsuccessfulSecondaryProviderOutcome(
659 results: ReadonlyArray<PromiseSettledResult<LocalProviderUpdateOutcome>>,
660): { readonly provider: ServerProvider; readonly status: "failed" | "unchanged" } | null {
661 for (const result of results) {
662 if (result.status !== "fulfilled") {
663 continue;
664 }
665 const outcome = result.value;
666 if (outcome.isPrimary || outcome.provider === null) {
667 continue;
668 }
669 const status = outcome.provider.updateState?.status;
670 if (status === "failed" || status === "unchanged") {
671 return { provider: outcome.provider, status };
672 }
673 }
674 return null;
675}
676
677const WSL_INSTANCE_ID_PREFIX = "wsl:";
678
679/** The distro name from a WSL backend instance id ("wsl:ubuntu" -> "ubuntu"), or null for the default. */
680export function parseWslDistroFromInstanceId(instanceId: string | undefined): string | null {
681 if (!instanceId || !instanceId.startsWith(WSL_INSTANCE_ID_PREFIX)) {
682 return null;
683 }
684 const distro = instanceId.slice(WSL_INSTANCE_ID_PREFIX.length).trim();
685 return distro.length === 0 || distro === "default" ? null : distro;
686}
687
688617/**
689618 * A human label that distinguishes local environments by platform (so the
690619 * popover shows "Windows" / "WSL" rather than the account name twice). WSL is