Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions packages/provider-core/src/server/maintenanceResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,43 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
}),
);

it.effect.each(["wrapper", "symlink"])(
"keeps a mise-owned %s in a native install location manual-only",
(launcher, { skip }) => {
if (windowsHost || (launcher === "symlink" && !symlinksSupported)) skip();
return Effect.gen(function* () {
const tempDir = yield* makeTempDir("t3-native-mise");
const nativePath = NodePath.join(tempDir, ".local", "bin", "native-package-tool");
if (launcher === "wrapper") {
writeExecutable(nativePath);
NodeFS.writeFileSync(
nativePath,
'#!/bin/sh\nexec mise x native-package-tool -- native-package-tool "$@"\n',
);
} else {
const target = NodePath.join(
tempDir,
"mise",
"installs",
"native-package-tool",
"1.0.0",
"native-package-tool",
);
writeExecutable(target);
NodeFS.mkdirSync(NodePath.dirname(nativePath), { recursive: true });
NodeFS.symlinkSync(target, nativePath);
}

const capabilities = yield* resolveProviderMaintenanceCapabilitiesEffect(
nativePackageToolUpdate,
{ binaryPath: nativePath, env: { PATH: "" } },
).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn));

expect(capabilities.update).toBeNull();
});
},
);

it.effect.skipIf(windowsHost)("runs an explicit native updater outside PATH", () =>
Effect.gen(function* () {
const tempDir = yield* makeTempDir("t3-native-update");
Expand Down
8 changes: 7 additions & 1 deletion packages/provider-core/src/server/maintenanceResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,13 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
...(nativeUpdate.env ? { env: nativeUpdate.env } : {}),
})
: manual;
if (nativeUpdate?.isCommandPath && commandPaths.some(nativeUpdate.isCommandPath)) {
// A native-looking launcher can still delegate to a mise-owned install.
if (
nativeUpdate?.isCommandPath &&
commandPaths.some(nativeUpdate.isCommandPath) &&
!commandPaths.some(isMiseCommandPath) &&
!(yield* isMiseWrapperScript(context))
) {
return native;
}
// A `node_modules` path not proven below belongs to another package or a
Expand Down
Loading