Skip to content

Commit 8210380

Browse files
author
chenbo
committed
Guard OpenCode sidecar evidence recording
1 parent 5febd3e commit 8210380

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/opencode-launcher.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,21 @@ test("OpenCode sidecar runtime extracts commands, paths, output, and hashes", ()
110110
assert.deepEqual(pathsFromTool({ path: "src/a.ts", filePath: "src/b.ts", files: ["test/a.test.ts", 1] }), ["src/a.ts", "src/b.ts", "test/a.test.ts"]);
111111
assert.equal(exitCodeFromOutput({ properties: { status: "2" } }), 2);
112112
assert.equal(exitCodeFromOutput({ exitCode: 0 }), 0);
113+
assert.equal(exitCodeFromOutput({ properties: { stdout: "ok" } }), null);
113114
assert.equal(outputText({ properties: { stdout: "ok" } }, ["stdout"]), "ok");
114115
assert.match(hashText("ok"), /^[a-f0-9]{64}$/);
115116
});
116117

118+
test("OpenCode sidecar runtime records after-tool evidence through input JSON", () => {
119+
const runtimeSource = readFileSync(path.join(import.meta.dirname, "..", "src", "integrations", "opencode", "plugin-runtime", "index.ts"), "utf8");
120+
121+
assert.match(runtimeSource, /"--input-json", inputJson/);
122+
assert.doesNotMatch(runtimeSource, /"--stdout"/);
123+
assert.doesNotMatch(runtimeSource, /"--stderr"/);
124+
assert.doesNotMatch(runtimeSource, /exitCodeFromOutput\(output\)\s*\?\?\s*0/);
125+
assert.doesNotMatch(runtimeSource, /String\(exitCodeFromOutput\(output\)\s*\?\?\s*0\)/);
126+
});
127+
117128
test("OpenCode sidecar plugin uses the OpenCode++ path", () => {
118129
const root = mkdtempSync(path.join(tmpdir(), "opencode-plusplus-sidecar-path-"));
119130
try {

0 commit comments

Comments
 (0)