Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

fix(sdk): pin packed-install fixtures to optionalDependency versions

Rach1a3043d81ece
diff --git a/sdk/ts/scripts/test-packed-install.mjs b/sdk/ts/scripts/test-packed-install.mjs
index 0492458a..0145493f 100644
--- a/sdk/ts/scripts/test-packed-install.mjs
+++ b/sdk/ts/scripts/test-packed-install.mjs
@@ -66,13 +66,19 @@ try {
await chmod(sourceBinary, 0o755);
}
+ const sdkManifest = JSON.parse(await readFile(join(SDK_ROOT, "package.json"), "utf8"));
const nativeTarballs = {};
for (const [target, packageName] of ALL_TARGETS) {
+ // #834: fixtures must use the SDK's optionalDependency pin, not the
+ // SDK package version. A mismatch lets npm resolve a released binary.
+ const version = sdkManifest.optionalDependencies?.[packageName];
+ if (!version) throw new Error(`#834: SDK optionalDependencies missing ${packageName}`);
const output = run(process.execPath, [
join(HERE, "package-platform.mjs"),
"--target", target,
"--binary", sourceBinary,
"--out", packages,
+ "--version", version,
], SDK_ROOT);
const { packageDir } = JSON.parse(output);
nativeTarballs[packageName] = pack(packageDir, tarballs);
@@ -88,7 +94,8 @@ try {
),
};
await writeFile(join(consumer, "package.json"), `${JSON.stringify(manifest, null, 2)}\n`);
- npmRun(["install", "--ignore-scripts", "--no-audit", "--no-fund"], consumer);
+ // --offline: a version miss must fail, not pull a released native package.
+ npmRun(["install", "--offline", "--ignore-scripts", "--no-audit", "--no-fund"], consumer);
const smoke = `
import { Harness } from "@codegraff/sdk";