Skip to content

Commit 8215799

Browse files
committed
fix(server): tell users how to update an install T3 cannot update
A provider install that T3 Code cannot update (a mise install, an executable inside a project's node_modules) gets no Update button or command, but its popover said "Install the update now or review provider settings." and the launch notice said it "can be updated from provider settings." The popover now names the version and the executable T3 Code runs, and the launch notice says to update it with the app or tool that installed it. Installs T3 Code can update keep the old wording.
1 parent b4542c5 commit 8215799

6 files changed

Lines changed: 140 additions & 25 deletions

File tree

‎apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,45 @@ describe("provider update launch notification logic", () => {
294294
it("describes settings-only updates without one-click support", () => {
295295
const view = getProviderUpdateInitialToastView({
296296
updateProviders: [
297-
updateCandidate({ driver: driver("codex"), canUpdate: false }),
298-
updateCandidate({ driver: driver("cursor"), canUpdate: false }),
297+
updateCandidate({ driver: driver("codex") }),
298+
updateCandidate({ driver: driver("cursor") }),
299299
],
300300
oneClickProviders: [],
301301
});
302302

303303
expect(view.description).toBe("Codex and Cursor can be updated from provider settings.");
304304
});
305305

306+
it("sends installs the server cannot update to the tool that installed them", () => {
307+
const manual = { canUpdate: false, updateCommand: null };
308+
expect(
309+
getProviderUpdateInitialToastView({
310+
updateProviders: [updateCandidate({ driver: driver("codex"), ...manual })],
311+
oneClickProviders: [],
312+
}).description,
313+
).toBe("Update Codex with the app or tool that installed it.");
314+
expect(
315+
getProviderUpdateInitialToastView({
316+
updateProviders: [
317+
updateCandidate({ driver: driver("codex"), ...manual }),
318+
updateCandidate({ driver: driver("cursor") }),
319+
],
320+
oneClickProviders: [],
321+
}).description,
322+
).toBe(
323+
"Cursor can be updated from provider settings. Update Codex with the app or tool that installed it.",
324+
);
325+
const oneClick = updateCandidate({ driver: driver("claudeAgent") });
326+
expect(
327+
getProviderUpdateInitialToastView({
328+
updateProviders: [oneClick, updateCandidate({ driver: driver("codex"), ...manual })],
329+
oneClickProviders: [oneClick],
330+
}).description,
331+
).toBe(
332+
"Install the update now or review provider settings. Update Codex with the app or tool that installed it.",
333+
);
334+
});
335+
306336
it("uses server update state for running progress", () => {
307337
const view = getProviderUpdateProgressToastView({
308338
providers: [

‎apps/web/src/components/ProviderUpdateLaunchNotification.logic.ts‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,33 @@ function formatProviderList(providers: ReadonlyArray<Pick<ServerProvider, "drive
235235
return `${names.slice(0, -1).join(", ")}, and ${names[names.length - 1]}`;
236236
}
237237

238+
/**
239+
* Install and provider settings reach only installs the server can update.
240+
* The rest are updated by the app or tool that installed them, so they get
241+
* their own sentence whatever else the notice offers.
242+
*/
243+
function describeInitialUpdates(input: {
244+
readonly updateProviders: ReadonlyArray<ProviderUpdateCandidate>;
245+
readonly oneClickProviders: ReadonlyArray<ProviderUpdateCandidate>;
246+
}): string {
247+
const fromSettings = input.updateProviders.filter(
248+
(provider) => provider.versionAdvisory.canUpdate,
249+
);
250+
const manual = input.updateProviders.filter((provider) => !provider.versionAdvisory.canUpdate);
251+
return [
252+
input.oneClickProviders.length > 0
253+
? "Install the update now or review provider settings."
254+
: fromSettings.length > 0
255+
? `${formatProviderList(fromSettings)} can be updated from provider settings.`
256+
: null,
257+
manual.length > 0
258+
? `Update ${formatProviderList(manual)} with the app or tool that installed ${manual.length === 1 ? "it" : "them"}.`
259+
: null,
260+
]
261+
.filter((sentence) => sentence !== null)
262+
.join(" ");
263+
}
264+
238265
export function getProviderUpdateInitialToastView(input: {
239266
readonly updateProviders: ReadonlyArray<ProviderUpdateCandidate>;
240267
readonly oneClickProviders: ReadonlyArray<ProviderUpdateCandidate>;
@@ -243,10 +270,7 @@ export function getProviderUpdateInitialToastView(input: {
243270
phase: "initial",
244271
type: "warning",
245272
title: getProviderUpdateInitialToastTitle(input.updateProviders),
246-
description:
247-
input.oneClickProviders.length > 0
248-
? "Install the update now or review provider settings."
249-
: `${formatProviderList(input.updateProviders)} can be updated from provider settings.`,
273+
description: describeInitialUpdates(input),
250274
};
251275
}
252276

‎apps/web/src/components/settings/ProviderInstanceCard.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ export function ProviderInstanceCard({
835835
</p>
836836
<p
837837
className={cn(
838-
"text-xs leading-snug",
838+
"text-xs leading-snug [overflow-wrap:anywhere]",
839839
versionAdvisory.emphasis === "strong" ? "text-warning" : "text-muted-foreground",
840840
)}
841841
>

‎packages/provider-core/src/server/maintenance.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ export interface ProviderMaintenanceCapabilities {
1313
readonly latestVersion?: string | null;
1414
/** Compare native release revisions when the provider does not use plain semver. */
1515
readonly compareVersions?: (current: string, latest: string) => number;
16+
/**
17+
* The executable T3 Code runs, symlinks followed, when no update command is
18+
* proven for it. The version advisory names it so the user knows which
19+
* install to update.
20+
*/
21+
readonly installPath?: string;
1622
}
1723

1824
export interface ProviderMaintenanceCommandAction {

‎packages/provider-core/src/server/maintenanceResolver.test.ts‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,44 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
208208
});
209209
});
210210

211-
it("keeps the manual update hint when the install is behind but unowned", () => {
211+
it("names the install to update when it is behind but unowned", () => {
212212
expect(
213213
createProviderVersionAdvisory({
214214
driver: driver("packageTool"),
215215
currentVersion: "2.1.110",
216216
latestVersion: "2.1.117",
217-
maintenanceCapabilities: manualPackageTool,
217+
maintenanceCapabilities: {
218+
...manualPackageTool,
219+
installPath: "/Applications/Tool.app/Contents/Resources/bin/package-tool",
220+
},
218221
}),
219222
).toMatchObject({
220223
status: "behind_latest",
221224
latestVersion: "2.1.117",
222225
updateCommand: null,
223226
canUpdate: false,
227+
message:
228+
"Version 2.1.117 is out. T3 Code runs /Applications/Tool.app/Contents/Resources/bin/package-tool; update it with the app or tool that installed it.",
229+
});
230+
});
231+
232+
it("offers the update when an owned install is behind", () => {
233+
expect(
234+
createProviderVersionAdvisory({
235+
driver: driver("packageTool"),
236+
currentVersion: "2.1.110",
237+
latestVersion: "2.1.117",
238+
maintenanceCapabilities: makeProviderMaintenanceCapabilities({
239+
provider: driver("packageTool"),
240+
packageName: "@example/package-tool",
241+
updateExecutable: "npm",
242+
updateArgs: ["install", "-g", "@example/package-tool@latest"],
243+
updateLockKey: "npm-global:/usr/local",
244+
}),
245+
}),
246+
).toMatchObject({
247+
status: "behind_latest",
248+
canUpdate: true,
224249
message: "Install the update now or review provider settings.",
225250
});
226251
});
@@ -732,7 +757,10 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
732757
),
733758
);
734759

735-
expect(capabilities).toEqual(manualPackageTool);
760+
expect(capabilities).toEqual({
761+
...manualPackageTool,
762+
installPath: NodeFS.realpathSync(kegBinary),
763+
});
736764
}),
737765
);
738766

@@ -759,7 +787,10 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
759787
},
760788
).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn));
761789

762-
expect(capabilities).toEqual(manualPackageTool);
790+
expect(capabilities).toEqual({
791+
...manualPackageTool,
792+
installPath: NodeFS.realpathSync(customPath),
793+
});
763794
}),
764795
);
765796

‎packages/provider-core/src/server/maintenanceResolver.ts‎

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,18 @@ export function makeTargetedProviderUpdateAction(
199199
export function makeManualOnlyProviderMaintenanceCapabilities(input: {
200200
readonly provider: ProviderDriverKind;
201201
readonly packageName: string | null;
202+
readonly installPath?: string;
202203
}): ProviderMaintenanceCapabilities {
203-
return makeProviderMaintenanceCapabilities({
204-
provider: input.provider,
205-
packageName: input.packageName,
206-
updateExecutable: null,
207-
updateArgs: [],
208-
updateLockKey: null,
209-
});
204+
return {
205+
...makeProviderMaintenanceCapabilities({
206+
provider: input.provider,
207+
packageName: input.packageName,
208+
updateExecutable: null,
209+
updateArgs: [],
210+
updateLockKey: null,
211+
}),
212+
...(input.installPath ? { installPath: input.installPath } : {}),
213+
};
210214
}
211215

212216
export function normalizeCommandPath(commandPath: string): string {
@@ -376,13 +380,17 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
376380
definition: PackageManagedProviderMaintenanceDefinition,
377381
context: ProviderMaintenanceResolutionContext | null,
378382
) {
383+
if (!context) {
384+
return makeManualOnlyProviderMaintenanceCapabilities({
385+
provider: definition.provider,
386+
packageName: definition.npmPackageName,
387+
});
388+
}
379389
const manual = makeManualOnlyProviderMaintenanceCapabilities({
380390
provider: definition.provider,
381391
packageName: definition.npmPackageName,
392+
installPath: context.realCommandPath,
382393
});
383-
if (!context) {
384-
return manual;
385-
}
386394
const commandPaths = [context.resolvedCommandPath, context.realCommandPath];
387395
const packageName = definition.npmPackageName;
388396

@@ -690,10 +698,20 @@ export const makeCachedProviderMaintenanceResolution = Effect.fn(
690698
options?.fresh ? Cache.invalidate(cache, undefined).pipe(Effect.andThen(cached)) : cached;
691699
});
692700

701+
/**
702+
* An install T3 Code cannot update gets no Update button or command, so its
703+
* message names the version and the executable instead.
704+
*/
705+
function manualUpdateMessage(latestVersion: string, installPath: string | undefined): string {
706+
return installPath
707+
? `Version ${latestVersion} is out. T3 Code runs ${installPath}; update it with the app or tool that installed it.`
708+
: `Version ${latestVersion} is out. Update it with the app or tool that installed it.`;
709+
}
710+
693711
function deriveVersionAdvisory(input: {
694712
readonly currentVersion: string | null;
695713
readonly latestVersion: string | null;
696-
readonly compareVersions?: (current: string, latest: string) => number;
714+
readonly capabilities: ProviderMaintenanceCapabilities;
697715
}): Pick<ServerProviderVersionAdvisory, "status" | "message"> {
698716
if (!input.currentVersion) {
699717
return { status: "unknown", message: null };
@@ -702,11 +720,17 @@ function deriveVersionAdvisory(input: {
702720
return { status: "unknown", message: null };
703721
}
704722
if (
705-
(input.compareVersions ?? compareSemverVersions)(input.currentVersion, input.latestVersion) < 0
723+
(input.capabilities.compareVersions ?? compareSemverVersions)(
724+
input.currentVersion,
725+
input.latestVersion,
726+
) < 0
706727
) {
707728
return {
708729
status: "behind_latest",
709-
message: PROVIDER_UPDATE_ACTION_TOAST_MESSAGE,
730+
message:
731+
input.capabilities.update === null
732+
? manualUpdateMessage(input.latestVersion, input.capabilities.installPath)
733+
: PROVIDER_UPDATE_ACTION_TOAST_MESSAGE,
710734
};
711735
}
712736
return { status: "current", message: null };
@@ -725,7 +749,7 @@ export function createProviderVersionAdvisory(input: {
725749
const advisory = deriveVersionAdvisory({
726750
currentVersion: input.currentVersion,
727751
latestVersion,
728-
...(capabilities.compareVersions ? { compareVersions: capabilities.compareVersions } : {}),
752+
capabilities,
729753
});
730754

731755
return {

0 commit comments

Comments
 (0)