Skip to content

Commit ebba0e9

Browse files
fix(server): t3 uninstall names another home's service it leaves installed
t3 uninstall reduced the installed service's recorded home to a single 'serves this home' flag, so a service belonging to another T3 home was skipped silently while the command reported 'Nothing to remove' or 't3 is uninstalled'. Keep that home in the plan and print the same notice t3 service uninstall prints, with the --base-dir to pass. Fixes #35674 AI-assisted; verified with the tests and tools listed above.
1 parent 0545fc3 commit ebba0e9

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎apps/server/src/cli/uninstall.ts‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class CliUninstallError extends Schema.TaggedError<CliUninstallError>()(
3333

3434
export interface UninstallPlan {
3535
readonly service: boolean;
36+
readonly otherHomeService: string | undefined;
3637
readonly versionsDir: string;
3738
readonly launchers: ReadonlyArray<string>;
3839
readonly runtimeDir: string | undefined;
@@ -147,15 +148,18 @@ const planUninstall = Effect.fn("cli.uninstall.plan")(function* (input: {
147148
const path = yield* Path.Path;
148149
const service = yield* BootService.BootService;
149150
const status = yield* service.status;
151+
const installedBaseDir =
152+
status.supported && status.installed ? status.installedBaseDir : undefined;
150153
const servesThisHome =
151-
status.installedBaseDir !== undefined &&
152-
path.resolve(status.installedBaseDir) === path.resolve(input.baseDir);
154+
installedBaseDir !== undefined &&
155+
path.resolve(installedBaseDir) === path.resolve(input.baseDir);
153156
const versionsDir = pinnedRuntimeVersionsDir(path, input.baseDir);
154157
const runtimeDir = path.dirname(versionsDir);
155158
const launchedAs = (yield* HostProcess.IsExecutable) ? yield* resolveLauncherPath : undefined;
156159
const launchedFrom = yield* findOwnedLauncher({ launchedAs, versionsDir });
157160
const plan: UninstallPlan = {
158-
service: status.supported && status.installed && servesThisHome,
161+
service: servesThisHome,
162+
otherHomeService: servesThisHome ? undefined : installedBaseDir,
159163
versionsDir,
160164
launchers: [
161165
...new Set([
@@ -195,6 +199,13 @@ export const uninstallCommand = Command.make("uninstall", {
195199
),
196200
);
197201

202+
const logOtherHomeService = (plan: UninstallPlan) =>
203+
plan.otherHomeService === undefined
204+
? Effect.void
205+
: Console.log(
206+
`The T3 Code service serves ${plan.otherHomeService}, so it was not removed. Pass \`${BootService.formatBootServiceBaseDirOption(plan.otherHomeService)}\` to remove it.`,
207+
);
208+
198209
const runUninstall = Effect.fn("cli.uninstall.run")(function* (input: {
199210
readonly baseDir: string;
200211
readonly assumeYes: boolean;
@@ -212,6 +223,7 @@ const runUninstall = Effect.fn("cli.uninstall.run")(function* (input: {
212223
" This t3 runs from a Node script, so it was installed by npm or built from source. Remove it the same way (`npm uninstall -g t3`, or delete the checkout).",
213224
);
214225
}
226+
yield* logOtherHomeService(plan);
215227
return;
216228
}
217229

@@ -286,4 +298,5 @@ const runUninstall = Effect.fn("cli.uninstall.run")(function* (input: {
286298
}
287299
yield* Console.log("");
288300
yield* Console.log("t3 is uninstalled. Thanks for trying T3 Code.");
301+
yield* logOtherHomeService(plan);
289302
});

0 commit comments

Comments
 (0)