Bound native hook permission fingerprints (#71758)

* fix: bound native hook permission fingerprints

* fix: address native hook fingerprint review

* test: isolate native jiti runtime assertions
This commit is contained in:
pashpashpash
2026-04-25 14:08:56 -07:00
committed by GitHub
parent 4a72e1b990
commit bf7d156bb0
4 changed files with 218 additions and 9 deletions

View File

@@ -19,6 +19,24 @@ const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR;
const FACADE_LOADER_GLOBAL = "__openclawTestLoadBundledPluginPublicSurfaceModuleSync";
type FacadeLoaderJitiFactory = NonNullable<Parameters<typeof setFacadeLoaderJitiFactoryForTest>[0]>;
function forceNodeRuntimeVersionsForTest(): () => void {
const originalVersions = process.versions;
const nodeVersions = { ...originalVersions } as NodeJS.ProcessVersions & {
bun?: string | undefined;
};
delete nodeVersions.bun;
Object.defineProperty(process, "versions", {
configurable: true,
value: nodeVersions,
});
return () => {
Object.defineProperty(process, "versions", {
configurable: true,
value: originalVersions,
});
};
}
function createBundledPluginDir(prefix: string, marker: string): string {
return createBundledPluginPublicSurfaceFixture({ createTempDirSync, marker, prefix });
}
@@ -127,6 +145,7 @@ describe("plugin-sdk facade loader", () => {
})) as unknown as ReturnType<FacadeLoaderJitiFactory>;
}) as FacadeLoaderJitiFactory);
const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32");
const restoreVersions = forceNodeRuntimeVersionsForTest();
try {
expect(
@@ -143,6 +162,7 @@ describe("plugin-sdk facade loader", () => {
}),
);
} finally {
restoreVersions();
platformSpy.mockRestore();
}
});