Files
scriptc/scripts/sandbox-platform.mjs
Malte UblandClaude Opus 5.5 f5a677f086 Forward a configured libnode pack into test:sandbox lanes
The lanes run with CI=1, so the Node island tests require a libnode pack and
fail rather than skip without one. A lane Sandbox prepared from a snapshot
that carries a pack had no way to be told where it is, because the lane
environment pinned only CI, SCRIPTC_SAN and the shard variables. Forward an
explicitly configured SCRIPTC_LIBNODE — a directory inside the Sandbox, never
the host — through sandboxLaneEnv, which every remote lane command already
uses, and document it in the runner's help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:22:56 -07:00

39 lines
1.5 KiB
JavaScript

/**
* Choose where tests that exercise the native host toolchain run.
*
* Darwin and Linux have supported native clang paths, so those files should
* test the contributor's actual host. Other hosts keep the coverage in the
* Linux Sandboxes. Darwin alone adds the compact kqueue/Mach-O contracts.
*/
export function sandboxHostSchedule(platform, invariantFiles) {
const runsNative = platform === "darwin" || platform === "linux";
return {
darwinContracts: platform === "darwin",
localArtifactContracts: runsNative,
localInvariantFiles: runsNative ? invariantFiles : [],
remoteArtifactContracts: !runsNative,
remoteInvariantFiles: runsNative ? [] : invariantFiles,
};
}
/**
* Pin lane and scheduler identity even when the parent shell, .env.local, or
* Sandbox image already defines these variables. Empty values restore the
* unsharded, platform-native defaults; intentional remote and local shards
* override them at their call sites.
*
* An explicitly configured SCRIPTC_LIBNODE is forwarded as is. It names a pack
* inside the Sandbox, never on the host, and the Node island tests fail rather
* than skip in a CI lane without one, so a lane started from a snapshot that
* carries a pack must be told where it is.
*/
export function sandboxLaneEnv(lane, env = process.env) {
return {
CI: "1",
SCRIPTC_PORTABLE_ONLY: "",
SCRIPTC_SAN: lane === "san" ? "1" : "",
SCRIPTC_TEST_SHARD: "",
SCRIPTC_LIBNODE: env.SCRIPTC_LIBNODE ?? "",
};
}