fix(pi-workflow): suppress verification bytecode
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFile } from "node:child_process";
|
||||
import {
|
||||
access,
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
@@ -267,6 +268,16 @@ test("Git probe and approved host commands enforce identity and ownership", asyn
|
||||
'require("node:fs").writeFileSync(process.argv[2], "after\\n")',
|
||||
"utf8",
|
||||
);
|
||||
await writeFile(
|
||||
path.join(directory, "src", "bytecode_module.py"),
|
||||
"VALUE = 1\n",
|
||||
"utf8",
|
||||
);
|
||||
await writeFile(
|
||||
path.join(directory, "src", "check_bytecode.py"),
|
||||
"import bytecode_module\nassert bytecode_module.VALUE == 1\n",
|
||||
"utf8",
|
||||
);
|
||||
await execFileAsync("git", ["-C", directory, "add", "."]);
|
||||
await execFileAsync("git", ["-C", directory, "commit", "-qm", "initial"]);
|
||||
const probe = new GitStateProbe();
|
||||
@@ -281,6 +292,17 @@ test("Git probe and approved host commands enforce identity and ownership", asyn
|
||||
});
|
||||
assert.equal(allowed.result.code, 0);
|
||||
assert.deepEqual(allowed.after.changedPaths, ["src/file.ts"]);
|
||||
const bytecodeDisabled = await executor.run({
|
||||
worktreeRoot: directory,
|
||||
ownedPaths: ["src"],
|
||||
executable: "python3",
|
||||
args: ["src/check_bytecode.py"],
|
||||
});
|
||||
assert.equal(bytecodeDisabled.result.code, 0);
|
||||
await assert.rejects(
|
||||
access(path.join(directory, "src", "__pycache__")),
|
||||
/ENOENT/,
|
||||
);
|
||||
await assert.rejects(
|
||||
executor.run({
|
||||
worktreeRoot: directory,
|
||||
|
||||
Reference in New Issue
Block a user