opencode-agent-orchestration-kit 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/check.yml +48 -3
- package/.github/workflows/compatibility-canary.yml +28 -0
- package/README.md +9 -6
- package/compatibility.json +19 -0
- package/docs/compatibility.md +84 -0
- package/docs/installation.md +5 -1
- package/docs/quickstart.md +1 -1
- package/docs/releases/v1.0.28.md +71 -0
- package/docs/superpowers/plans/2026-07-21-compatibility-matrix.md +1286 -0
- package/docs/superpowers/specs/2026-07-21-compatibility-matrix-design.md +452 -0
- package/opencode/package-lock.json +6 -3
- package/opencode/package.json +3 -0
- package/package.json +5 -1
- package/scripts/check-compatibility.mjs +623 -0
- package/scripts/check-compatibility.test.mjs +1271 -0
- package/scripts/check.sh +7 -1
- package/scripts/opencode-compat-smoke.sh +174 -0
- package/scripts/version.mjs +18 -5
- package/scripts/version.test.mjs +53 -3
|
@@ -0,0 +1,1271 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
import { checkCompatibility } from "./check-compatibility.mjs";
|
|
10
|
+
|
|
11
|
+
const REPOSITORY_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
12
|
+
|
|
13
|
+
const VALID_COMPATIBILITY = {
|
|
14
|
+
schema_version: 1,
|
|
15
|
+
node: {
|
|
16
|
+
engines: "^22.9.0 || ^24.0.0",
|
|
17
|
+
blocking_majors: [22, 24],
|
|
18
|
+
canary_major: 26,
|
|
19
|
+
},
|
|
20
|
+
opencode: {
|
|
21
|
+
supported_range: ">=1.14.41 <2.0.0",
|
|
22
|
+
minimum_tested: "1.14.41",
|
|
23
|
+
stable_tested: "1.18.4",
|
|
24
|
+
canary: "latest",
|
|
25
|
+
},
|
|
26
|
+
sdk: {
|
|
27
|
+
opencode_plugin: "1.14.41",
|
|
28
|
+
opentui_core: "0.2.5",
|
|
29
|
+
opentui_solid: "0.2.5",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const REVISED_COMPATIBILITY = {
|
|
34
|
+
schema_version: 1,
|
|
35
|
+
node: {
|
|
36
|
+
engines: "^22.10.0 || ^25.0.0",
|
|
37
|
+
blocking_majors: [22, 25],
|
|
38
|
+
canary_major: 27,
|
|
39
|
+
},
|
|
40
|
+
opencode: {
|
|
41
|
+
supported_range: ">=1.15.0 <2.0.0",
|
|
42
|
+
minimum_tested: "1.15.0",
|
|
43
|
+
stable_tested: "1.19.0",
|
|
44
|
+
canary: "latest",
|
|
45
|
+
},
|
|
46
|
+
sdk: {
|
|
47
|
+
opencode_plugin: "1.15.0",
|
|
48
|
+
opentui_core: "0.3.0",
|
|
49
|
+
opentui_solid: "0.3.0",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const ROOT_PACKAGE = {
|
|
54
|
+
name: "opencode-agent-orchestration-kit",
|
|
55
|
+
engines: { node: VALID_COMPATIBILITY.node.engines },
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const PACKAGED_PACKAGE = {
|
|
59
|
+
engines: { node: VALID_COMPATIBILITY.node.engines },
|
|
60
|
+
dependencies: {
|
|
61
|
+
"@opencode-ai/plugin": VALID_COMPATIBILITY.sdk.opencode_plugin,
|
|
62
|
+
"@opentui/core": VALID_COMPATIBILITY.sdk.opentui_core,
|
|
63
|
+
"@opentui/solid": VALID_COMPATIBILITY.sdk.opentui_solid,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const PACKAGED_LOCK = {
|
|
68
|
+
lockfileVersion: 3,
|
|
69
|
+
packages: {
|
|
70
|
+
"": {
|
|
71
|
+
engines: { node: VALID_COMPATIBILITY.node.engines },
|
|
72
|
+
dependencies: { ...PACKAGED_PACKAGE.dependencies },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const COMPATIBILITY_MATRIX = `# Compatibility
|
|
78
|
+
|
|
79
|
+
Canonical Node engine: \`${VALID_COMPATIBILITY.node.engines}\`.
|
|
80
|
+
|
|
81
|
+
<!-- compatibility-matrix:start -->
|
|
82
|
+
| Surface | Status | Contract |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| Node.js 22 | supported | 22.9.0 or newer within major 22; blocking CI |
|
|
85
|
+
| Node.js 24 | supported | major 24; blocking CI |
|
|
86
|
+
| Node.js 26 | experimental | non-blocking canary only |
|
|
87
|
+
| Node.js 20 and EOL/odd lines | unsupported | no release guarantee |
|
|
88
|
+
| OpenCode 1.14.41 | tested | minimum boundary in the blocking core smoke |
|
|
89
|
+
| OpenCode 1.18.4 | tested | pinned stable boundary in the blocking core smoke |
|
|
90
|
+
| OpenCode >=1.14.41 <2.0.0 | supported | boundary-tested compatibility promise |
|
|
91
|
+
| OpenCode <1.14.41 or >=2.0.0 | unsupported | requires a reviewed policy change |
|
|
92
|
+
| \`@opencode-ai/plugin\` 1.14.41 | tested | exact pin with install, import, and typecheck evidence |
|
|
93
|
+
| OpenTUI core/solid 0.2.5 | tested | exact pins with install, import, and typecheck evidence |
|
|
94
|
+
| Ubuntu GitHub runner | tested | blocking Node 22 and 24 jobs |
|
|
95
|
+
| macOS GitHub runner | tested | blocking Node 24 job; runner details recorded |
|
|
96
|
+
| Other mainstream Linux/macOS environments | supported | Bash, Node, and OpenCode must support the host |
|
|
97
|
+
| WSL2 | experimental | recommended upstream path, no kit-owned runner |
|
|
98
|
+
| Native Windows | unsupported | Bash lifecycle wrappers have no native contract |
|
|
99
|
+
| Token usage plugin | experimental | compile/import is tested; runtime session-tree behavior is not stable API evidence |
|
|
100
|
+
| Open Design Docker adapter | experimental | optional pinned image inputs, no blocking integration smoke |
|
|
101
|
+
| Superpowers | experimental | optional upstream Git plugin, not part of core smoke |
|
|
102
|
+
| Impeccable | experimental | optional externally installed skill |
|
|
103
|
+
<!-- compatibility-matrix:end -->
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const README = "See [compatibility details](docs/compatibility.md).\n";
|
|
107
|
+
const INSTALLATION = `- Node.js \`${VALID_COMPATIBILITY.node.engines}\` and npm\n`;
|
|
108
|
+
const PROVIDER_SECRET = ["OPEN", "AI_API_KEY"].join("");
|
|
109
|
+
|
|
110
|
+
const OPENCODE_BOUNDARY_JOB = `
|
|
111
|
+
# opencode-boundaries:start
|
|
112
|
+
opencode-compatibility:
|
|
113
|
+
runs-on: ubuntu-latest
|
|
114
|
+
strategy:
|
|
115
|
+
fail-fast: false
|
|
116
|
+
matrix:
|
|
117
|
+
opencode:
|
|
118
|
+
- "1.14.41"
|
|
119
|
+
- "1.18.4"
|
|
120
|
+
steps:
|
|
121
|
+
- name: Checkout
|
|
122
|
+
uses: actions/checkout@v4
|
|
123
|
+
|
|
124
|
+
- name: Setup Node
|
|
125
|
+
uses: actions/setup-node@v4
|
|
126
|
+
with:
|
|
127
|
+
node-version: 24
|
|
128
|
+
|
|
129
|
+
- name: Smoke OpenCode boundary
|
|
130
|
+
run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.opencode }}"
|
|
131
|
+
# opencode-boundaries:end
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
const VALID_WORKFLOW = `name: Check
|
|
135
|
+
|
|
136
|
+
on:
|
|
137
|
+
pull_request:
|
|
138
|
+
push:
|
|
139
|
+
branches:
|
|
140
|
+
- master
|
|
141
|
+
tags:
|
|
142
|
+
- "v*"
|
|
143
|
+
|
|
144
|
+
permissions:
|
|
145
|
+
contents: read
|
|
146
|
+
|
|
147
|
+
jobs:
|
|
148
|
+
check:
|
|
149
|
+
# compatibility-blocking:start
|
|
150
|
+
strategy:
|
|
151
|
+
fail-fast: false
|
|
152
|
+
matrix:
|
|
153
|
+
include:
|
|
154
|
+
- os: ubuntu-latest
|
|
155
|
+
node: 22
|
|
156
|
+
canonical: false
|
|
157
|
+
- os: ubuntu-latest
|
|
158
|
+
node: 24
|
|
159
|
+
canonical: true
|
|
160
|
+
- os: macos-latest
|
|
161
|
+
node: 24
|
|
162
|
+
canonical: false
|
|
163
|
+
# compatibility-blocking:end
|
|
164
|
+
runs-on: \${{ matrix.os }}
|
|
165
|
+
steps:
|
|
166
|
+
- name: Checkout
|
|
167
|
+
uses: actions/checkout@v4
|
|
168
|
+
|
|
169
|
+
- name: Setup Node
|
|
170
|
+
uses: actions/setup-node@v4
|
|
171
|
+
with:
|
|
172
|
+
node-version: \${{ matrix.node }}
|
|
173
|
+
|
|
174
|
+
- name: Record runner evidence
|
|
175
|
+
run: |
|
|
176
|
+
uname -a || true
|
|
177
|
+
node --version
|
|
178
|
+
npm --version
|
|
179
|
+
node -e 'const p=require("./opencode/package.json"); console.log(JSON.stringify({arch:process.arch,platform:process.platform,plugin:p.dependencies["@opencode-ai/plugin"],opentuiCore:p.dependencies["@opentui/core"],opentuiSolid:p.dependencies["@opentui/solid"]}))'
|
|
180
|
+
|
|
181
|
+
- name: Validate release tag
|
|
182
|
+
if: matrix.canonical && startsWith(github.ref, 'refs/tags/')
|
|
183
|
+
run: node scripts/version.mjs --check-tag "$GITHUB_REF_NAME"
|
|
184
|
+
|
|
185
|
+
- name: Contract check
|
|
186
|
+
run: npm run contract-check
|
|
187
|
+
|
|
188
|
+
- name: Unit and script tests
|
|
189
|
+
run: npm run unit-and-script-tests
|
|
190
|
+
|
|
191
|
+
- name: Install OpenCode tool dependencies
|
|
192
|
+
working-directory: opencode
|
|
193
|
+
run: npm ci
|
|
194
|
+
|
|
195
|
+
- name: Audit OpenCode tool dependencies
|
|
196
|
+
if: matrix.canonical
|
|
197
|
+
run: npm run dependency-audit
|
|
198
|
+
|
|
199
|
+
- name: Typecheck TUI token plugin
|
|
200
|
+
run: npm run typecheck
|
|
201
|
+
|
|
202
|
+
- name: Installation smoke
|
|
203
|
+
run: npm run installation-smoke
|
|
204
|
+
${OPENCODE_BOUNDARY_JOB}`;
|
|
205
|
+
|
|
206
|
+
const VALID_CANARY_WORKFLOW = `name: Compatibility Canary
|
|
207
|
+
|
|
208
|
+
on:
|
|
209
|
+
workflow_dispatch:
|
|
210
|
+
schedule:
|
|
211
|
+
- cron: "17 6 * * 1"
|
|
212
|
+
|
|
213
|
+
permissions:
|
|
214
|
+
contents: read
|
|
215
|
+
|
|
216
|
+
jobs:
|
|
217
|
+
# compatibility-canary:start
|
|
218
|
+
latest:
|
|
219
|
+
runs-on: ubuntu-latest
|
|
220
|
+
steps:
|
|
221
|
+
- name: Checkout
|
|
222
|
+
uses: actions/checkout@v4
|
|
223
|
+
with:
|
|
224
|
+
persist-credentials: false
|
|
225
|
+
|
|
226
|
+
- name: Setup Node
|
|
227
|
+
uses: actions/setup-node@v4
|
|
228
|
+
with:
|
|
229
|
+
node-version: 26
|
|
230
|
+
|
|
231
|
+
- name: Smoke latest OpenCode
|
|
232
|
+
run: bash scripts/opencode-compat-smoke.sh latest
|
|
233
|
+
# compatibility-canary:end
|
|
234
|
+
`;
|
|
235
|
+
|
|
236
|
+
const SINGLE_JOB_WORKFLOW = `name: Check
|
|
237
|
+
permissions:
|
|
238
|
+
contents: read
|
|
239
|
+
jobs:
|
|
240
|
+
check:
|
|
241
|
+
runs-on: ubuntu-latest
|
|
242
|
+
steps:
|
|
243
|
+
- name: Setup Node
|
|
244
|
+
uses: actions/setup-node@v4
|
|
245
|
+
with:
|
|
246
|
+
node-version: 24
|
|
247
|
+
- name: Validate release tag
|
|
248
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
249
|
+
run: node scripts/version.mjs --check-tag "$GITHUB_REF_NAME"
|
|
250
|
+
- name: Contract check
|
|
251
|
+
run: npm run contract-check
|
|
252
|
+
- name: Unit and script tests
|
|
253
|
+
run: npm run unit-and-script-tests
|
|
254
|
+
- name: Install OpenCode tool dependencies
|
|
255
|
+
working-directory: opencode
|
|
256
|
+
run: npm ci
|
|
257
|
+
- name: Audit OpenCode tool dependencies
|
|
258
|
+
run: npm run dependency-audit
|
|
259
|
+
- name: Typecheck TUI token plugin
|
|
260
|
+
run: npm run typecheck
|
|
261
|
+
- name: Installation smoke
|
|
262
|
+
run: npm run installation-smoke
|
|
263
|
+
`;
|
|
264
|
+
|
|
265
|
+
function writeJson(root, relative, value) {
|
|
266
|
+
const full = path.join(root, relative);
|
|
267
|
+
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
268
|
+
fs.writeFileSync(full, `${JSON.stringify(value, null, 2)}\n`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function writeText(root, relative, value) {
|
|
272
|
+
const full = path.join(root, relative);
|
|
273
|
+
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
274
|
+
fs.writeFileSync(full, value);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function makeFixture(t, compatibility = VALID_COMPATIBILITY) {
|
|
278
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-test-"));
|
|
279
|
+
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
280
|
+
writeJson(root, "compatibility.json", compatibility);
|
|
281
|
+
writeJson(root, "package.json", ROOT_PACKAGE);
|
|
282
|
+
writeJson(root, "opencode/package.json", PACKAGED_PACKAGE);
|
|
283
|
+
writeJson(root, "opencode/package-lock.json", PACKAGED_LOCK);
|
|
284
|
+
writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX);
|
|
285
|
+
writeText(root, "README.md", README);
|
|
286
|
+
writeText(root, "docs/installation.md", INSTALLATION);
|
|
287
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW);
|
|
288
|
+
writeText(root, ".github/workflows/compatibility-canary.yml", VALID_CANARY_WORKFLOW);
|
|
289
|
+
return root;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function assertInvalidCompatibility(action, message) {
|
|
293
|
+
assert.throws(action, (error) => {
|
|
294
|
+
assert.equal(error.code, "INVALID_COMPATIBILITY");
|
|
295
|
+
assert.match(error.message, message);
|
|
296
|
+
return true;
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
test("valid canonical compatibility schema is accepted", (t) => {
|
|
301
|
+
const root = makeFixture(t);
|
|
302
|
+
assert.equal(checkCompatibility(root, { surfaces: false }).schema_version, 1);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
test("a coherent revised compatibility contract is accepted without surfaces", (t) => {
|
|
306
|
+
const root = makeFixture(t, REVISED_COMPATIBILITY);
|
|
307
|
+
assert.deepEqual(checkCompatibility(root, { surfaces: false }), REVISED_COMPATIBILITY);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
test("unknown compatibility schema versions are rejected", (t) => {
|
|
311
|
+
const root = makeFixture(t, { ...VALID_COMPATIBILITY, schema_version: 2 });
|
|
312
|
+
assert.throws(
|
|
313
|
+
() => checkCompatibility(root, { surfaces: false }),
|
|
314
|
+
/schema_version must be 1/,
|
|
315
|
+
);
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
test("non-canonical OpenCode boundaries are rejected", (t) => {
|
|
319
|
+
const root = makeFixture(t, {
|
|
320
|
+
...VALID_COMPATIBILITY,
|
|
321
|
+
opencode: { ...VALID_COMPATIBILITY.opencode, minimum_tested: "v1.14.41" },
|
|
322
|
+
});
|
|
323
|
+
assert.throws(
|
|
324
|
+
() => checkCompatibility(root, { surfaces: false }),
|
|
325
|
+
/minimum_tested must use MAJOR.MINOR.PATCH/,
|
|
326
|
+
);
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
test("alternative supported OpenCode range is rejected", (t) => {
|
|
330
|
+
const root = makeFixture(t, {
|
|
331
|
+
...VALID_COMPATIBILITY,
|
|
332
|
+
opencode: { ...VALID_COMPATIBILITY.opencode, supported_range: ">=1.14.41 <3.0.0" },
|
|
333
|
+
});
|
|
334
|
+
assert.throws(
|
|
335
|
+
() => checkCompatibility(root, { surfaces: false }),
|
|
336
|
+
/supported_range must begin at minimum_tested and end before 2.0.0/,
|
|
337
|
+
);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
for (const [label, node, message] of [
|
|
341
|
+
["non-caret engine", { engines: ">=22", blocking_majors: [22], canary_major: 26 }, /node\.engines/],
|
|
342
|
+
["engine major drift", { engines: "^22.10.0 || ^25.0.0", blocking_majors: [22, 24], canary_major: 27 }, /blocking_majors/],
|
|
343
|
+
["duplicate blocking major", { engines: "^22.10.0 || ^22.11.0", blocking_majors: [22, 22], canary_major: 27 }, /blocking_majors/],
|
|
344
|
+
["blocking canary major", { engines: "^22.10.0 || ^25.0.0", blocking_majors: [22, 25], canary_major: 25 }, /canary_major/],
|
|
345
|
+
]) {
|
|
346
|
+
test(`Node compatibility rejects ${label}`, (t) => {
|
|
347
|
+
const root = makeFixture(t, {
|
|
348
|
+
...VALID_COMPATIBILITY,
|
|
349
|
+
node,
|
|
350
|
+
});
|
|
351
|
+
assertInvalidCompatibility(
|
|
352
|
+
() => checkCompatibility(root, { surfaces: false }),
|
|
353
|
+
message,
|
|
354
|
+
);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
test("root Node engine drift names the root package surface", (t) => {
|
|
359
|
+
const root = makeFixture(t);
|
|
360
|
+
writeJson(root, "package.json", {
|
|
361
|
+
...ROOT_PACKAGE,
|
|
362
|
+
engines: { node: ">=22" },
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
assertInvalidCompatibility(
|
|
366
|
+
() => checkCompatibility(root),
|
|
367
|
+
/package\.json engines\.node must match compatibility\.json node\.engines/,
|
|
368
|
+
);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
test("packaged Node engine drift names the packaged surface", (t) => {
|
|
372
|
+
const root = makeFixture(t);
|
|
373
|
+
writeJson(root, "opencode/package.json", {
|
|
374
|
+
...PACKAGED_PACKAGE,
|
|
375
|
+
engines: { node: ">=22" },
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
assertInvalidCompatibility(
|
|
379
|
+
() => checkCompatibility(root),
|
|
380
|
+
/opencode\/package\.json engines\.node must match compatibility\.json node\.engines/,
|
|
381
|
+
);
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
test("packaged SDK plugin pin drift names the plugin dependency surface", (t) => {
|
|
385
|
+
const root = makeFixture(t);
|
|
386
|
+
writeJson(root, "opencode/package.json", {
|
|
387
|
+
...PACKAGED_PACKAGE,
|
|
388
|
+
dependencies: {
|
|
389
|
+
...PACKAGED_PACKAGE.dependencies,
|
|
390
|
+
"@opencode-ai/plugin": "1.14.42",
|
|
391
|
+
},
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
assertInvalidCompatibility(
|
|
395
|
+
() => checkCompatibility(root),
|
|
396
|
+
/opencode\/package\.json dependency @opencode-ai\/plugin must match compatibility\.json sdk\.opencode_plugin/,
|
|
397
|
+
);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
test("packaged OpenTUI core pin drift names the core dependency surface", (t) => {
|
|
401
|
+
const root = makeFixture(t);
|
|
402
|
+
writeJson(root, "opencode/package.json", {
|
|
403
|
+
...PACKAGED_PACKAGE,
|
|
404
|
+
dependencies: {
|
|
405
|
+
...PACKAGED_PACKAGE.dependencies,
|
|
406
|
+
"@opentui/core": "0.2.6",
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
assertInvalidCompatibility(
|
|
411
|
+
() => checkCompatibility(root),
|
|
412
|
+
/opencode\/package\.json dependency @opentui\/core must match compatibility\.json sdk\.opentui_core/,
|
|
413
|
+
);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test("packaged OpenTUI solid pin drift names the solid dependency surface", (t) => {
|
|
417
|
+
const root = makeFixture(t);
|
|
418
|
+
writeJson(root, "opencode/package.json", {
|
|
419
|
+
...PACKAGED_PACKAGE,
|
|
420
|
+
dependencies: {
|
|
421
|
+
...PACKAGED_PACKAGE.dependencies,
|
|
422
|
+
"@opentui/solid": "0.2.6",
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
assertInvalidCompatibility(
|
|
427
|
+
() => checkCompatibility(root),
|
|
428
|
+
/opencode\/package\.json dependency @opentui\/solid must match compatibility\.json sdk\.opentui_solid/,
|
|
429
|
+
);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
test("lockfile Node engine drift names the lock surface", (t) => {
|
|
433
|
+
const root = makeFixture(t);
|
|
434
|
+
writeJson(root, "opencode/package-lock.json", {
|
|
435
|
+
...PACKAGED_LOCK,
|
|
436
|
+
packages: {
|
|
437
|
+
"": { ...PACKAGED_LOCK.packages[""], engines: { node: ">=22" } },
|
|
438
|
+
},
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
assertInvalidCompatibility(
|
|
442
|
+
() => checkCompatibility(root),
|
|
443
|
+
/opencode\/package-lock\.json engines\.node must match compatibility\.json node\.engines/,
|
|
444
|
+
);
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
for (const [dependency, sdkField, driftedVersion] of [
|
|
448
|
+
["@opencode-ai/plugin", "opencode_plugin", "1.14.42"],
|
|
449
|
+
["@opentui/core", "opentui_core", "0.2.6"],
|
|
450
|
+
["@opentui/solid", "opentui_solid", "0.2.6"],
|
|
451
|
+
]) {
|
|
452
|
+
test(`lockfile drift names the ${dependency} dependency surface`, (t) => {
|
|
453
|
+
const root = makeFixture(t);
|
|
454
|
+
writeJson(root, "opencode/package-lock.json", {
|
|
455
|
+
...PACKAGED_LOCK,
|
|
456
|
+
packages: {
|
|
457
|
+
"": {
|
|
458
|
+
...PACKAGED_LOCK.packages[""],
|
|
459
|
+
dependencies: {
|
|
460
|
+
...PACKAGED_LOCK.packages[""].dependencies,
|
|
461
|
+
[dependency]: driftedVersion,
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
assertInvalidCompatibility(
|
|
468
|
+
() => checkCompatibility(root),
|
|
469
|
+
new RegExp(`opencode/package-lock\\.json dependency ${dependency.replaceAll("/", "\\/")} must match compatibility\\.json sdk\\.${sdkField}`),
|
|
470
|
+
);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
test("documentation rejects an unknown matrix status", (t) => {
|
|
475
|
+
const root = makeFixture(t);
|
|
476
|
+
writeText(
|
|
477
|
+
root,
|
|
478
|
+
"docs/compatibility.md",
|
|
479
|
+
COMPATIBILITY_MATRIX.replace("| Node.js 22 | supported |", "| Node.js 22 | supported boundary |"),
|
|
480
|
+
);
|
|
481
|
+
|
|
482
|
+
assertInvalidCompatibility(
|
|
483
|
+
() => checkCompatibility(root),
|
|
484
|
+
/unknown compatibility status: supported boundary/,
|
|
485
|
+
);
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
test("documentation and boundary workflow follow a promoted stable OpenCode version", (t) => {
|
|
489
|
+
const compatibility = {
|
|
490
|
+
...VALID_COMPATIBILITY,
|
|
491
|
+
opencode: { ...VALID_COMPATIBILITY.opencode, stable_tested: "1.19.0" },
|
|
492
|
+
};
|
|
493
|
+
const root = makeFixture(t, compatibility);
|
|
494
|
+
writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX.replaceAll("1.18.4", "1.19.0"));
|
|
495
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replaceAll("1.18.4", "1.19.0"));
|
|
496
|
+
|
|
497
|
+
assert.equal(checkCompatibility(root).opencode.stable_tested, "1.19.0");
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
for (const [surface, currentStatus, replacement, expectedStatus] of [
|
|
501
|
+
["Node.js 26", "experimental", "tested", "experimental"],
|
|
502
|
+
["Native Windows", "unsupported", "supported", "unsupported"],
|
|
503
|
+
["WSL2", "experimental", "supported", "experimental"],
|
|
504
|
+
["Token usage plugin", "experimental", "supported", "experimental"],
|
|
505
|
+
["Open Design Docker adapter", "experimental", "supported", "experimental"],
|
|
506
|
+
["Superpowers", "experimental", "supported", "experimental"],
|
|
507
|
+
["Impeccable", "experimental", "supported", "experimental"],
|
|
508
|
+
]) {
|
|
509
|
+
test(`documentation rejects the wrong status for ${surface}`, (t) => {
|
|
510
|
+
const root = makeFixture(t);
|
|
511
|
+
writeText(
|
|
512
|
+
root,
|
|
513
|
+
"docs/compatibility.md",
|
|
514
|
+
COMPATIBILITY_MATRIX.replace(
|
|
515
|
+
`| ${surface} | ${currentStatus} |`,
|
|
516
|
+
`| ${surface} | ${replacement} |`,
|
|
517
|
+
),
|
|
518
|
+
);
|
|
519
|
+
|
|
520
|
+
assertInvalidCompatibility(
|
|
521
|
+
() => checkCompatibility(root),
|
|
522
|
+
new RegExp(`docs/compatibility\\.md must classify ${surface.replaceAll(".", "\\.")} as ${expectedStatus}`),
|
|
523
|
+
);
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
for (const surface of [
|
|
528
|
+
"OpenCode >=1.14.41 <2.0.0",
|
|
529
|
+
"Node.js 22",
|
|
530
|
+
"Node.js 24",
|
|
531
|
+
"WSL2",
|
|
532
|
+
"Native Windows",
|
|
533
|
+
"Token usage plugin",
|
|
534
|
+
"Open Design Docker adapter",
|
|
535
|
+
"Superpowers",
|
|
536
|
+
"Impeccable",
|
|
537
|
+
]) {
|
|
538
|
+
test(`documentation requires the ${surface} boundary`, (t) => {
|
|
539
|
+
const root = makeFixture(t);
|
|
540
|
+
const line = COMPATIBILITY_MATRIX.split("\n").find((candidate) =>
|
|
541
|
+
candidate.startsWith(`| ${surface} |`),
|
|
542
|
+
);
|
|
543
|
+
assert.ok(line);
|
|
544
|
+
writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX.replace(`${line}\n`, ""));
|
|
545
|
+
|
|
546
|
+
assertInvalidCompatibility(
|
|
547
|
+
() => checkCompatibility(root),
|
|
548
|
+
new RegExp(`docs/compatibility\\.md must classify ${surface.replaceAll(".", "\\.")} as`),
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
test("README must link the compatibility documentation", (t) => {
|
|
554
|
+
const root = makeFixture(t);
|
|
555
|
+
writeText(root, "README.md", "Compatibility details are available.\n");
|
|
556
|
+
|
|
557
|
+
assertInvalidCompatibility(
|
|
558
|
+
() => checkCompatibility(root),
|
|
559
|
+
/README\.md must link docs\/compatibility\.md/,
|
|
560
|
+
);
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
test("installation must declare the canonical Node engine", (t) => {
|
|
564
|
+
const root = makeFixture(t);
|
|
565
|
+
writeText(root, "docs/installation.md", "- Node.js and npm\n");
|
|
566
|
+
|
|
567
|
+
assertInvalidCompatibility(
|
|
568
|
+
() => checkCompatibility(root),
|
|
569
|
+
/docs\/installation\.md must declare the canonical Node engine/,
|
|
570
|
+
);
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
test("documentation cannot escape the repository through a symlinked directory", (t) => {
|
|
574
|
+
const root = makeFixture(t);
|
|
575
|
+
const external = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-external-"));
|
|
576
|
+
t.after(() => fs.rmSync(external, { recursive: true, force: true }));
|
|
577
|
+
writeText(external, "compatibility.md", COMPATIBILITY_MATRIX);
|
|
578
|
+
writeText(external, "installation.md", INSTALLATION);
|
|
579
|
+
fs.rmSync(path.join(root, "docs"), { recursive: true });
|
|
580
|
+
fs.symlinkSync(external, path.join(root, "docs"), "dir");
|
|
581
|
+
|
|
582
|
+
assertInvalidCompatibility(
|
|
583
|
+
() => checkCompatibility(root),
|
|
584
|
+
/docs\/compatibility\.md must be a safe regular file|escape/,
|
|
585
|
+
);
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
test("documentation requires exactly one start marker", (t) => {
|
|
589
|
+
const root = makeFixture(t);
|
|
590
|
+
writeText(
|
|
591
|
+
root,
|
|
592
|
+
"docs/compatibility.md",
|
|
593
|
+
COMPATIBILITY_MATRIX.replace(
|
|
594
|
+
"<!-- compatibility-matrix:start -->",
|
|
595
|
+
"<!-- compatibility-matrix:start -->\n<!-- compatibility-matrix:start -->",
|
|
596
|
+
),
|
|
597
|
+
);
|
|
598
|
+
|
|
599
|
+
assertInvalidCompatibility(
|
|
600
|
+
() => checkCompatibility(root),
|
|
601
|
+
/docs\/compatibility\.md must contain exactly one start and one end marker/,
|
|
602
|
+
);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
test("documentation rejects a duplicated surface before status resolution", (t) => {
|
|
606
|
+
const root = makeFixture(t);
|
|
607
|
+
writeText(
|
|
608
|
+
root,
|
|
609
|
+
"docs/compatibility.md",
|
|
610
|
+
COMPATIBILITY_MATRIX.replace(
|
|
611
|
+
"| Node.js 22 | supported |",
|
|
612
|
+
"| Node.js 22 | unsupported | duplicate |\n| Node.js 22 | supported |",
|
|
613
|
+
),
|
|
614
|
+
);
|
|
615
|
+
|
|
616
|
+
assertInvalidCompatibility(
|
|
617
|
+
() => checkCompatibility(root),
|
|
618
|
+
/docs\/compatibility\.md must not duplicate surface Node\.js 22/,
|
|
619
|
+
);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
test("blocking workflow accepts exactly the supported Node and OS matrix", (t) => {
|
|
623
|
+
const root = makeFixture(t);
|
|
624
|
+
assert.equal(checkCompatibility(root).schema_version, 1);
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
test("the previous single Ubuntu Node 24 job is rejected", (t) => {
|
|
628
|
+
const root = makeFixture(t);
|
|
629
|
+
writeText(root, ".github/workflows/check.yml", SINGLE_JOB_WORKFLOW);
|
|
630
|
+
|
|
631
|
+
assertInvalidCompatibility(
|
|
632
|
+
() => checkCompatibility(root),
|
|
633
|
+
/workflow must contain exactly one compatibility blocking marker pair/,
|
|
634
|
+
);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
for (const [label, mutate] of [
|
|
638
|
+
["missing Ubuntu Node 22 entry", (workflow) => workflow.replace(" - os: ubuntu-latest\n node: 22\n canonical: false\n", "")],
|
|
639
|
+
["missing Ubuntu Node 24 entry", (workflow) => workflow.replace(" - os: ubuntu-latest\n node: 24\n canonical: true\n", "")],
|
|
640
|
+
["missing macOS Node 24 entry", (workflow) => workflow.replace(" - os: macos-latest\n node: 24\n canonical: false\n", "")],
|
|
641
|
+
["extra entry", (workflow) => workflow.replace(" # compatibility-blocking:end", " - os: ubuntu-latest\n node: 26\n canonical: false\n # compatibility-blocking:end")],
|
|
642
|
+
["duplicated entry", (workflow) => workflow.replace(" # compatibility-blocking:end", " - os: ubuntu-latest\n node: 24\n canonical: true\n # compatibility-blocking:end")],
|
|
643
|
+
]) {
|
|
644
|
+
test(`blocking workflow rejects a ${label}`, (t) => {
|
|
645
|
+
const root = makeFixture(t);
|
|
646
|
+
writeText(root, ".github/workflows/check.yml", mutate(VALID_WORKFLOW));
|
|
647
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /workflow blocking matrix must be exactly/);
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
test("blocking workflow requires fail-fast false", (t) => {
|
|
652
|
+
const root = makeFixture(t);
|
|
653
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace("fail-fast: false", "fail-fast: true"));
|
|
654
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /workflow strategy must set fail-fast to false/);
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
for (const [label, current, replacement, message] of [
|
|
658
|
+
["tag validation", "if: matrix.canonical && startsWith(github.ref, 'refs/tags/')", "if: startsWith(github.ref, 'refs/tags/')", /tag validation guard/],
|
|
659
|
+
["dependency audit", "if: matrix.canonical\n run: npm run dependency-audit", "if: success()\n run: npm run dependency-audit", /dependency audit guard/],
|
|
660
|
+
]) {
|
|
661
|
+
test(`blocking workflow requires the exact ${label} guard`, (t) => {
|
|
662
|
+
const root = makeFixture(t);
|
|
663
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace(current, replacement));
|
|
664
|
+
assertInvalidCompatibility(() => checkCompatibility(root), message);
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
for (const [label, current, message] of [
|
|
669
|
+
["matrix runner", "runs-on: ${{ matrix.os }}", /matrix\.os/],
|
|
670
|
+
["matrix Node setup", "node-version: ${{ matrix.node }}", /matrix\.node/],
|
|
671
|
+
["dependency installation", "working-directory: opencode\n run: npm ci", /install OpenCode tool dependencies/],
|
|
672
|
+
["contract check", "run: npm run contract-check", /contract check/],
|
|
673
|
+
["unit and script tests", "run: npm run unit-and-script-tests", /unit and script tests/],
|
|
674
|
+
["token plugin typecheck", "run: npm run typecheck", /token plugin typecheck/],
|
|
675
|
+
["installation smoke", "run: npm run installation-smoke", /installation smoke/],
|
|
676
|
+
]) {
|
|
677
|
+
test(`every blocking matrix job retains ${label}`, (t) => {
|
|
678
|
+
const root = makeFixture(t);
|
|
679
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace(current, "# removed by test"));
|
|
680
|
+
assertInvalidCompatibility(() => checkCompatibility(root), message);
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
test("a sidecar job cannot satisfy a required blocking check step", (t) => {
|
|
685
|
+
const root = makeFixture(t);
|
|
686
|
+
const workflow = VALID_WORKFLOW
|
|
687
|
+
.replace(" run: npm run typecheck", " run: echo skipped-typecheck")
|
|
688
|
+
.concat(`
|
|
689
|
+
sidecar:
|
|
690
|
+
runs-on: ubuntu-latest
|
|
691
|
+
steps:
|
|
692
|
+
- name: Typecheck TUI token plugin
|
|
693
|
+
run: npm run typecheck
|
|
694
|
+
`);
|
|
695
|
+
writeText(root, ".github/workflows/check.yml", workflow);
|
|
696
|
+
|
|
697
|
+
assertInvalidCompatibility(
|
|
698
|
+
() => checkCompatibility(root),
|
|
699
|
+
/workflow blocking job must retain token plugin typecheck/,
|
|
700
|
+
);
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
for (const [label, workflow] of [
|
|
704
|
+
["missing", VALID_WORKFLOW.replace(" check:\n", " renamed:\n")],
|
|
705
|
+
["duplicated", `${VALID_WORKFLOW}\n check:\n runs-on: ubuntu-latest\n`],
|
|
706
|
+
["ambiguous", `${VALID_WORKFLOW}\njobs:\n sidecar:\n runs-on: ubuntu-latest\n`],
|
|
707
|
+
]) {
|
|
708
|
+
test(`workflow rejects a ${label} jobs.check body`, (t) => {
|
|
709
|
+
const root = makeFixture(t);
|
|
710
|
+
writeText(root, ".github/workflows/check.yml", workflow);
|
|
711
|
+
assertInvalidCompatibility(
|
|
712
|
+
() => checkCompatibility(root),
|
|
713
|
+
/workflow must contain exactly one unambiguous jobs\.check body/,
|
|
714
|
+
);
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
for (const command of [
|
|
719
|
+
"uname -a || true",
|
|
720
|
+
"node --version",
|
|
721
|
+
"npm --version",
|
|
722
|
+
"arch:process.arch",
|
|
723
|
+
"platform:process.platform",
|
|
724
|
+
'p.dependencies["@opencode-ai/plugin"]',
|
|
725
|
+
'p.dependencies["@opentui/core"]',
|
|
726
|
+
'p.dependencies["@opentui/solid"]',
|
|
727
|
+
]) {
|
|
728
|
+
test(`runner evidence requires ${command}`, (t) => {
|
|
729
|
+
const root = makeFixture(t);
|
|
730
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace(command, "removed-by-test"));
|
|
731
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /runner evidence/);
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
test("workflow rejects write permissions", (t) => {
|
|
736
|
+
const root = makeFixture(t);
|
|
737
|
+
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW.replace("contents: read", "contents: write"));
|
|
738
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /read-only permissions/);
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
for (const [job, workflow] of [
|
|
742
|
+
[
|
|
743
|
+
"check",
|
|
744
|
+
VALID_WORKFLOW.replace(
|
|
745
|
+
" check:\n",
|
|
746
|
+
" check:\n permissions:\n contents: read\n",
|
|
747
|
+
),
|
|
748
|
+
],
|
|
749
|
+
[
|
|
750
|
+
"opencode-compatibility",
|
|
751
|
+
VALID_WORKFLOW.replace(
|
|
752
|
+
" opencode-compatibility:\n",
|
|
753
|
+
" opencode-compatibility:\n permissions:\n contents: read\n",
|
|
754
|
+
),
|
|
755
|
+
],
|
|
756
|
+
]) {
|
|
757
|
+
test(`workflow requires jobs.${job} to inherit top-level permissions`, (t) => {
|
|
758
|
+
const root = makeFixture(t);
|
|
759
|
+
writeText(root, ".github/workflows/check.yml", workflow);
|
|
760
|
+
assertInvalidCompatibility(
|
|
761
|
+
() => checkCompatibility(root),
|
|
762
|
+
/job-level permissions are forbidden/,
|
|
763
|
+
);
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
test("workflow rejects publish commands", (t) => {
|
|
768
|
+
const root = makeFixture(t);
|
|
769
|
+
writeText(root, ".github/workflows/check.yml", `${VALID_WORKFLOW} - run: npm publish\n`);
|
|
770
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /must not publish/);
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
test("workflow requires exactly one ordered blocking marker pair", (t) => {
|
|
774
|
+
const root = makeFixture(t);
|
|
775
|
+
writeText(
|
|
776
|
+
root,
|
|
777
|
+
".github/workflows/check.yml",
|
|
778
|
+
VALID_WORKFLOW.replace("# compatibility-blocking:start", "# compatibility-blocking:start\n # compatibility-blocking:start"),
|
|
779
|
+
);
|
|
780
|
+
assertInvalidCompatibility(
|
|
781
|
+
() => checkCompatibility(root),
|
|
782
|
+
/workflow must contain exactly one compatibility blocking marker pair/,
|
|
783
|
+
);
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
test("workflow requires blocking markers in order", (t) => {
|
|
787
|
+
const root = makeFixture(t);
|
|
788
|
+
writeText(
|
|
789
|
+
root,
|
|
790
|
+
".github/workflows/check.yml",
|
|
791
|
+
VALID_WORKFLOW
|
|
792
|
+
.replace("# compatibility-blocking:start", "# compatibility-blocking:temporary")
|
|
793
|
+
.replace("# compatibility-blocking:end", "# compatibility-blocking:start")
|
|
794
|
+
.replace("# compatibility-blocking:temporary", "# compatibility-blocking:end"),
|
|
795
|
+
);
|
|
796
|
+
assertInvalidCompatibility(
|
|
797
|
+
() => checkCompatibility(root),
|
|
798
|
+
/workflow compatibility blocking markers must be in order/,
|
|
799
|
+
);
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
test("OpenCode boundary job accepts the exact blocking matrix", (t) => {
|
|
803
|
+
const root = makeFixture(t);
|
|
804
|
+
assert.equal(checkCompatibility(root).schema_version, 1);
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
for (const [label, mutate] of [
|
|
808
|
+
["minimum tested version", (workflow) => workflow.replace(' - "1.14.41"\n', "")],
|
|
809
|
+
["stable tested version", (workflow) => workflow.replace(' - "1.18.4"\n', "")],
|
|
810
|
+
["Node 24 setup", (workflow) => workflow.replace(" node-version: 24", " node-version: 22")],
|
|
811
|
+
[
|
|
812
|
+
"matrix-version wrapper invocation",
|
|
813
|
+
(workflow) => workflow.replace(
|
|
814
|
+
'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"',
|
|
815
|
+
"run: bash scripts/opencode-compat-smoke.sh 1.18.4",
|
|
816
|
+
),
|
|
817
|
+
],
|
|
818
|
+
[
|
|
819
|
+
"isolated wrapper instead of the operator binary",
|
|
820
|
+
(workflow) => workflow.replace(
|
|
821
|
+
'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"',
|
|
822
|
+
"run: opencode --version",
|
|
823
|
+
),
|
|
824
|
+
],
|
|
825
|
+
[
|
|
826
|
+
"blocking failure behavior",
|
|
827
|
+
(workflow) => workflow.replace(
|
|
828
|
+
" opencode-compatibility:\n",
|
|
829
|
+
" opencode-compatibility:\n continue-on-error: true\n",
|
|
830
|
+
),
|
|
831
|
+
],
|
|
832
|
+
[
|
|
833
|
+
"non-publishing behavior",
|
|
834
|
+
(workflow) => workflow.replace(
|
|
835
|
+
" # opencode-boundaries:end",
|
|
836
|
+
" - name: Publish\n run: npm publish\n # opencode-boundaries:end",
|
|
837
|
+
),
|
|
838
|
+
],
|
|
839
|
+
[
|
|
840
|
+
"credential-free behavior",
|
|
841
|
+
(workflow) => workflow.replace(
|
|
842
|
+
" runs-on: ubuntu-latest\n strategy:",
|
|
843
|
+
' runs-on: ubuntu-latest\n env:\n GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n strategy:',
|
|
844
|
+
),
|
|
845
|
+
],
|
|
846
|
+
[
|
|
847
|
+
"provider-secret-free behavior",
|
|
848
|
+
(workflow) => workflow.replace(
|
|
849
|
+
" runs-on: ubuntu-latest\n strategy:",
|
|
850
|
+
` runs-on: ubuntu-latest\n env:\n ${PROVIDER_SECRET}: \${{ secrets.${PROVIDER_SECRET} }}\n strategy:`,
|
|
851
|
+
),
|
|
852
|
+
],
|
|
853
|
+
[
|
|
854
|
+
"checkout-level dependency install",
|
|
855
|
+
(workflow) => workflow.replace(
|
|
856
|
+
OPENCODE_BOUNDARY_JOB,
|
|
857
|
+
OPENCODE_BOUNDARY_JOB.replace(
|
|
858
|
+
" - name: Setup Node\n uses: actions/setup-node@v4",
|
|
859
|
+
" - name: Install dependencies\n run: npm ci\n\n - name: Setup Node\n uses: actions/setup-node@v4",
|
|
860
|
+
),
|
|
861
|
+
),
|
|
862
|
+
],
|
|
863
|
+
]) {
|
|
864
|
+
test(`OpenCode boundary job requires ${label}`, (t) => {
|
|
865
|
+
const root = makeFixture(t);
|
|
866
|
+
writeText(root, ".github/workflows/check.yml", mutate(VALID_WORKFLOW));
|
|
867
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
test("OpenCode boundary job cannot borrow its smoke from another job", (t) => {
|
|
872
|
+
const root = makeFixture(t);
|
|
873
|
+
const workflow = VALID_WORKFLOW
|
|
874
|
+
.replace(
|
|
875
|
+
' run: bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"',
|
|
876
|
+
" run: echo skipped-boundary-smoke",
|
|
877
|
+
)
|
|
878
|
+
.concat(`
|
|
879
|
+
sidecar-smoke:
|
|
880
|
+
runs-on: ubuntu-latest
|
|
881
|
+
steps:
|
|
882
|
+
- run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.opencode }}"
|
|
883
|
+
`);
|
|
884
|
+
writeText(root, ".github/workflows/check.yml", workflow);
|
|
885
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
test("OpenCode boundary job markers must wrap the job inside jobs", (t) => {
|
|
889
|
+
const root = makeFixture(t);
|
|
890
|
+
const workflow = VALID_WORKFLOW
|
|
891
|
+
.replace(OPENCODE_BOUNDARY_JOB, " opencode-compatibility:\n runs-on: macos-latest\n")
|
|
892
|
+
.concat(`
|
|
893
|
+
outside:
|
|
894
|
+
${OPENCODE_BOUNDARY_JOB}`);
|
|
895
|
+
writeText(root, ".github/workflows/check.yml", workflow);
|
|
896
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
|
|
897
|
+
});
|
|
898
|
+
|
|
899
|
+
for (const [label, trailingYaml] of [
|
|
900
|
+
["trailing continue-on-error", " continue-on-error: true\n"],
|
|
901
|
+
[
|
|
902
|
+
"trailing provider secret",
|
|
903
|
+
' env:\n TEST_TOKEN: ${{ secrets.TEST_TOKEN }}\n',
|
|
904
|
+
],
|
|
905
|
+
["trailing job key", " timeout-minutes: 5\n"],
|
|
906
|
+
[
|
|
907
|
+
"trailing steps key",
|
|
908
|
+
" steps:\n - name: Bypass\n run: echo bypass\n",
|
|
909
|
+
],
|
|
910
|
+
]) {
|
|
911
|
+
test(`OpenCode boundary job rejects ${label} after its end marker`, (t) => {
|
|
912
|
+
const root = makeFixture(t);
|
|
913
|
+
writeText(
|
|
914
|
+
root,
|
|
915
|
+
".github/workflows/check.yml",
|
|
916
|
+
VALID_WORKFLOW.replace(
|
|
917
|
+
" # opencode-boundaries:end\n",
|
|
918
|
+
` # opencode-boundaries:end\n${trailingYaml}`,
|
|
919
|
+
),
|
|
920
|
+
);
|
|
921
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
test("OpenCode boundary job requires exactly one marker pair", (t) => {
|
|
926
|
+
const root = makeFixture(t);
|
|
927
|
+
writeText(
|
|
928
|
+
root,
|
|
929
|
+
".github/workflows/check.yml",
|
|
930
|
+
VALID_WORKFLOW.replace(
|
|
931
|
+
" # opencode-boundaries:start",
|
|
932
|
+
" # opencode-boundaries:start\n # opencode-boundaries:start",
|
|
933
|
+
),
|
|
934
|
+
);
|
|
935
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
test("OpenCode boundary job requires markers in order", (t) => {
|
|
939
|
+
const root = makeFixture(t);
|
|
940
|
+
writeText(
|
|
941
|
+
root,
|
|
942
|
+
".github/workflows/check.yml",
|
|
943
|
+
VALID_WORKFLOW
|
|
944
|
+
.replace("# opencode-boundaries:start", "# opencode-boundaries:temporary")
|
|
945
|
+
.replace("# opencode-boundaries:end", "# opencode-boundaries:start")
|
|
946
|
+
.replace("# opencode-boundaries:temporary", "# opencode-boundaries:end"),
|
|
947
|
+
);
|
|
948
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
test("compatibility canary accepts the exact scheduled and manual latest smoke", (t) => {
|
|
952
|
+
const root = makeFixture(t);
|
|
953
|
+
assert.equal(checkCompatibility(root).schema_version, 1);
|
|
954
|
+
});
|
|
955
|
+
|
|
956
|
+
for (const [label, mutate] of [
|
|
957
|
+
["schedule trigger", (workflow) => workflow.replace(' schedule:\n - cron: "17 6 * * 1"\n', "")],
|
|
958
|
+
["workflow_dispatch trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", "")],
|
|
959
|
+
["push trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", " workflow_dispatch:\n push:\n")],
|
|
960
|
+
["pull_request trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", " workflow_dispatch:\n pull_request:\n")],
|
|
961
|
+
["canonical canary Node", (workflow) => workflow.replace(" node-version: 26", " node-version: 24")],
|
|
962
|
+
["canonical latest argument", (workflow) => workflow.replace("opencode-compat-smoke.sh latest", "opencode-compat-smoke.sh 1.18.4")],
|
|
963
|
+
["read-only permissions", (workflow) => workflow.replace("contents: read", "contents: write")],
|
|
964
|
+
["blocking failure behavior", (workflow) => workflow.replace(" runs-on: ubuntu-latest", " continue-on-error: true\n runs-on: ubuntu-latest")],
|
|
965
|
+
["credential-free behavior", (workflow) => workflow.replace(" runs-on: ubuntu-latest", ' env:\n GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n runs-on: ubuntu-latest')],
|
|
966
|
+
["npm publish ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm publish\n\n - name: Smoke latest OpenCode")],
|
|
967
|
+
["tag creation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: git tag canary\n\n - name: Smoke latest OpenCode")],
|
|
968
|
+
["issue creation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: gh issue create --title canary\n\n - name: Smoke latest OpenCode")],
|
|
969
|
+
["dependency update ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm update\n\n - name: Smoke latest OpenCode")],
|
|
970
|
+
["npm ci ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm ci\n\n - name: Smoke latest OpenCode")],
|
|
971
|
+
["checkout cache ban", (workflow) => workflow.replace(" uses: actions/checkout@v4", " uses: actions/checkout@v4\n with:\n cache: npm")],
|
|
972
|
+
["cache action ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - uses: actions/cache@v4\n\n - name: Smoke latest OpenCode")],
|
|
973
|
+
["artifact action ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - uses: actions/upload-artifact@v4\n\n - name: Smoke latest OpenCode")],
|
|
974
|
+
["repository mutation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: git push origin HEAD\n\n - name: Smoke latest OpenCode")],
|
|
975
|
+
]) {
|
|
976
|
+
test(`compatibility canary requires ${label}`, (t) => {
|
|
977
|
+
const root = makeFixture(t);
|
|
978
|
+
writeText(root, ".github/workflows/compatibility-canary.yml", mutate(VALID_CANARY_WORKFLOW));
|
|
979
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
for (const [label, mutate] of [
|
|
984
|
+
[
|
|
985
|
+
"missing persist-credentials",
|
|
986
|
+
(workflow) => workflow.replace(" with:\n persist-credentials: false\n", ""),
|
|
987
|
+
],
|
|
988
|
+
[
|
|
989
|
+
"persist-credentials true",
|
|
990
|
+
(workflow) => workflow.replace("persist-credentials: false", "persist-credentials: true"),
|
|
991
|
+
],
|
|
992
|
+
[
|
|
993
|
+
"duplicate persist-credentials",
|
|
994
|
+
(workflow) => workflow.replace(
|
|
995
|
+
" persist-credentials: false",
|
|
996
|
+
" persist-credentials: false\n persist-credentials: false",
|
|
997
|
+
),
|
|
998
|
+
],
|
|
999
|
+
]) {
|
|
1000
|
+
test(`compatibility canary rejects ${label}`, (t) => {
|
|
1001
|
+
const root = makeFixture(t);
|
|
1002
|
+
writeText(root, ".github/workflows/compatibility-canary.yml", mutate(VALID_CANARY_WORKFLOW));
|
|
1003
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
test("compatibility canary latest job must inherit top-level permissions", (t) => {
|
|
1008
|
+
const root = makeFixture(t);
|
|
1009
|
+
writeText(
|
|
1010
|
+
root,
|
|
1011
|
+
".github/workflows/compatibility-canary.yml",
|
|
1012
|
+
VALID_CANARY_WORKFLOW.replace(
|
|
1013
|
+
" latest:\n",
|
|
1014
|
+
" latest:\n permissions:\n contents: read\n",
|
|
1015
|
+
),
|
|
1016
|
+
);
|
|
1017
|
+
|
|
1018
|
+
assertInvalidCompatibility(
|
|
1019
|
+
() => checkCompatibility(root),
|
|
1020
|
+
/compatibility canary job-level permissions are forbidden/,
|
|
1021
|
+
);
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
for (const [label, workflow] of [
|
|
1025
|
+
["missing latest job", VALID_CANARY_WORKFLOW.replace(" latest:\n", " renamed:\n")],
|
|
1026
|
+
["duplicate latest job", `${VALID_CANARY_WORKFLOW}\n latest:\n runs-on: ubuntu-latest\n`],
|
|
1027
|
+
["duplicate jobs mapping", `${VALID_CANARY_WORKFLOW}\njobs:\n sidecar:\n runs-on: ubuntu-latest\n`],
|
|
1028
|
+
["duplicate start marker", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:start", " # compatibility-canary:start\n # compatibility-canary:start")],
|
|
1029
|
+
["duplicate end marker", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:end", " # compatibility-canary:end\n # compatibility-canary:end")],
|
|
1030
|
+
[
|
|
1031
|
+
"reversed markers",
|
|
1032
|
+
VALID_CANARY_WORKFLOW
|
|
1033
|
+
.replace("# compatibility-canary:start", "# compatibility-canary:temporary")
|
|
1034
|
+
.replace("# compatibility-canary:end", "# compatibility-canary:start")
|
|
1035
|
+
.replace("# compatibility-canary:temporary", "# compatibility-canary:end"),
|
|
1036
|
+
],
|
|
1037
|
+
["trailing job key", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:end", " # compatibility-canary:end\n timeout-minutes: 5")],
|
|
1038
|
+
["trailing steps key", VALID_CANARY_WORKFLOW.replace(" # compatibility-canary:end", " # compatibility-canary:end\n steps:\n - run: echo bypass")],
|
|
1039
|
+
]) {
|
|
1040
|
+
test(`compatibility canary rejects ${label}`, (t) => {
|
|
1041
|
+
const root = makeFixture(t);
|
|
1042
|
+
writeText(root, ".github/workflows/compatibility-canary.yml", workflow);
|
|
1043
|
+
assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
function shellQuote(value) {
|
|
1048
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
function writeExecutable(root, relative, contents) {
|
|
1052
|
+
writeText(root, relative, contents);
|
|
1053
|
+
fs.chmodSync(path.join(root, relative), 0o755);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
function makeCompatibilitySmokeFixture(t, options = {}) {
|
|
1057
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-compat-smoke-test-"));
|
|
1058
|
+
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
1059
|
+
|
|
1060
|
+
const sourceScript = path.join(REPOSITORY_ROOT, "scripts/opencode-compat-smoke.sh");
|
|
1061
|
+
if (fs.existsSync(sourceScript)) {
|
|
1062
|
+
fs.mkdirSync(path.join(root, "scripts"), { recursive: true });
|
|
1063
|
+
fs.copyFileSync(sourceScript, path.join(root, "scripts/opencode-compat-smoke.sh"));
|
|
1064
|
+
fs.chmodSync(path.join(root, "scripts/opencode-compat-smoke.sh"), 0o755);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
writeText(root, "agents/lead.md", "---\nmode: all\n---\n");
|
|
1068
|
+
if (options.packagedLead !== "missing") {
|
|
1069
|
+
writeText(
|
|
1070
|
+
root,
|
|
1071
|
+
"opencode/agents/lead.md",
|
|
1072
|
+
`---\nmode: ${options.packagedLead ?? "primary"}\n---\n`,
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
writeJson(root, "opencode/package.json", { name: "fixture", private: true });
|
|
1076
|
+
writeJson(root, "opencode/package-lock.json", {
|
|
1077
|
+
name: "fixture",
|
|
1078
|
+
lockfileVersion: 3,
|
|
1079
|
+
packages: { "": { name: "fixture" } },
|
|
1080
|
+
});
|
|
1081
|
+
writeText(root, "opencode/node_modules/excluded", "must not be copied\n");
|
|
1082
|
+
writeText(root, "opencode/.oak/excluded", "must not be copied\n");
|
|
1083
|
+
|
|
1084
|
+
const quotedRoot = shellQuote(root);
|
|
1085
|
+
writeExecutable(root, "fake-bin/npm", `#!/bin/sh
|
|
1086
|
+
set -eu
|
|
1087
|
+
touch ${shellQuote(path.join(root, "npm-called"))}
|
|
1088
|
+
smoke_root=\${HOME%/home}
|
|
1089
|
+
smoke_home="$(CDPATH= cd "$HOME" && pwd -P)"
|
|
1090
|
+
test "$(pwd -P)" = "$smoke_home"
|
|
1091
|
+
test "\${PWD-}" = "$smoke_home"
|
|
1092
|
+
test "$#" -eq 4
|
|
1093
|
+
test "$1" = --prefix
|
|
1094
|
+
test "$2" = "$smoke_root/config/opencode"
|
|
1095
|
+
test "$3" = ci
|
|
1096
|
+
test "$4" = --ignore-scripts
|
|
1097
|
+
test "$HOME" = "$smoke_root/home"
|
|
1098
|
+
test "$XDG_CONFIG_HOME" = "$smoke_root/config"
|
|
1099
|
+
test "$XDG_DATA_HOME" = "$smoke_root/data"
|
|
1100
|
+
test "$XDG_CACHE_HOME" = "$smoke_root/cache"
|
|
1101
|
+
test "$XDG_STATE_HOME" = "$smoke_root/state"
|
|
1102
|
+
test "$npm_config_cache" = "$smoke_root/npm"
|
|
1103
|
+
test "$OPENCODE_CONFIG_DIR" = "$smoke_root/config/opencode"
|
|
1104
|
+
case "$2" in ${quotedRoot}|${quotedRoot}/*) exit 31;; esac
|
|
1105
|
+
case "$OPENCODE_CONFIG_DIR" in ${quotedRoot}|${quotedRoot}/*) exit 32;; esac
|
|
1106
|
+
test -f "$2/agents/lead.md"
|
|
1107
|
+
test ! -e "$2/opencode"
|
|
1108
|
+
test ! -e "$2/node_modules"
|
|
1109
|
+
test ! -e "$2/.oak"
|
|
1110
|
+
`);
|
|
1111
|
+
|
|
1112
|
+
const request = options.request ?? "1.14.41";
|
|
1113
|
+
const version = options.resolvedVersion ?? (options.wrongVersion ? "9.9.9" : request);
|
|
1114
|
+
const stdoutLeakPath = options.stdoutLeak === "root" ? root : options.stdoutLeak;
|
|
1115
|
+
const leak = stdoutLeakPath ? `,\"source\":${JSON.stringify(stdoutLeakPath)}` : "";
|
|
1116
|
+
const stderrLeakPath = options.stderrLeak === "root" ? root : options.stderrLeak;
|
|
1117
|
+
let stderrLeak = ":";
|
|
1118
|
+
if (stderrLeakPath === "smoke") {
|
|
1119
|
+
stderrLeak = `printf '%s\\n' "$smoke_root/SMOKE_TEMP_MARKER" >&2`;
|
|
1120
|
+
} else if (stderrLeakPath) {
|
|
1121
|
+
stderrLeak = `printf '%s\\n' ${shellQuote(stderrLeakPath)} >&2`;
|
|
1122
|
+
}
|
|
1123
|
+
writeExecutable(root, "fake-bin/npx", `#!/bin/sh
|
|
1124
|
+
set -eu
|
|
1125
|
+
touch ${shellQuote(path.join(root, "npx-called"))}
|
|
1126
|
+
if env | grep -q '^FAKE_PROVIDER_TOKEN='; then exit 41; fi
|
|
1127
|
+
smoke_root=\${HOME%/home}
|
|
1128
|
+
smoke_home="$(CDPATH= cd "$HOME" && pwd -P)"
|
|
1129
|
+
test "$(pwd -P)" = "$smoke_home"
|
|
1130
|
+
test "\${PWD-}" = "$smoke_home"
|
|
1131
|
+
test "$HOME" = "$smoke_root/home"
|
|
1132
|
+
test "$XDG_CONFIG_HOME" = "$smoke_root/config"
|
|
1133
|
+
test "$XDG_DATA_HOME" = "$smoke_root/data"
|
|
1134
|
+
test "$XDG_CACHE_HOME" = "$smoke_root/cache"
|
|
1135
|
+
test "$XDG_STATE_HOME" = "$smoke_root/state"
|
|
1136
|
+
test "$npm_config_cache" = "$smoke_root/npm"
|
|
1137
|
+
test "$OPENCODE_CONFIG_DIR" = "$smoke_root/config/opencode"
|
|
1138
|
+
case "$OPENCODE_CONFIG_DIR" in ${quotedRoot}|${quotedRoot}/*) exit 42;; esac
|
|
1139
|
+
test "$1" = --yes
|
|
1140
|
+
test "$2" = --package
|
|
1141
|
+
test "$3" = opencode-ai@${request}
|
|
1142
|
+
test "$4" = opencode
|
|
1143
|
+
shift 4
|
|
1144
|
+
case "$1" in
|
|
1145
|
+
--version)
|
|
1146
|
+
test "$#" -eq 1
|
|
1147
|
+
${stderrLeak}
|
|
1148
|
+
printf '%s\\n' '${version}'
|
|
1149
|
+
;;
|
|
1150
|
+
debug)
|
|
1151
|
+
test "$#" -eq 4
|
|
1152
|
+
test "$2" = agent
|
|
1153
|
+
test "$3" = lead
|
|
1154
|
+
test "$4" = --pure
|
|
1155
|
+
grep -q '^mode: primary$' "$OPENCODE_CONFIG_DIR/agents/lead.md"
|
|
1156
|
+
printf '{\"name\":\"lead\",\"mode\":\"primary\",\"config\":\"%s\"${leak}}\\n' "$OPENCODE_CONFIG_DIR"
|
|
1157
|
+
;;
|
|
1158
|
+
*) exit 43;;
|
|
1159
|
+
esac
|
|
1160
|
+
`);
|
|
1161
|
+
return root;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
function runCompatibilitySmoke(root, args = ["1.14.41"]) {
|
|
1165
|
+
return spawnSync(
|
|
1166
|
+
"bash",
|
|
1167
|
+
[path.join(root, "scripts/opencode-compat-smoke.sh"), ...args],
|
|
1168
|
+
{
|
|
1169
|
+
cwd: root,
|
|
1170
|
+
env: {
|
|
1171
|
+
...process.env,
|
|
1172
|
+
PATH: `${path.join(root, "fake-bin")}:${process.env.PATH}`,
|
|
1173
|
+
FAKE_PROVIDER_TOKEN: "must-not-reach-opencode",
|
|
1174
|
+
},
|
|
1175
|
+
encoding: "utf8",
|
|
1176
|
+
},
|
|
1177
|
+
);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
test("OpenCode compatibility smoke uses only the packaged isolated config", (t) => {
|
|
1181
|
+
const root = makeCompatibilitySmokeFixture(t);
|
|
1182
|
+
const result = runCompatibilitySmoke(root);
|
|
1183
|
+
|
|
1184
|
+
assert.equal(result.status, 0, result.stderr || result.error?.message);
|
|
1185
|
+
assert.equal(
|
|
1186
|
+
result.stdout,
|
|
1187
|
+
"opencode compatibility smoke ok: requested=1.14.41 resolved=1.14.41\n",
|
|
1188
|
+
);
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
test("OpenCode compatibility smoke suppresses temporary stderr paths without failing", (t) => {
|
|
1192
|
+
const root = makeCompatibilitySmokeFixture(t, { stderrLeak: "smoke" });
|
|
1193
|
+
const result = runCompatibilitySmoke(root);
|
|
1194
|
+
|
|
1195
|
+
assert.equal(result.status, 0, result.stderr || result.error?.message);
|
|
1196
|
+
assert.equal(
|
|
1197
|
+
result.stdout,
|
|
1198
|
+
"opencode compatibility smoke ok: requested=1.14.41 resolved=1.14.41\n",
|
|
1199
|
+
);
|
|
1200
|
+
assert.equal(result.stderr.includes("SMOKE_TEMP_MARKER"), false);
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
test("OpenCode compatibility smoke rejects a non-canonical explicit version before tools run", (t) => {
|
|
1204
|
+
const root = makeCompatibilitySmokeFixture(t, { request: "01.14.41" });
|
|
1205
|
+
const result = runCompatibilitySmoke(root, ["01.14.41"]);
|
|
1206
|
+
|
|
1207
|
+
assert.equal(result.status, 2);
|
|
1208
|
+
assert.equal(result.stdout, "");
|
|
1209
|
+
assert.equal(fs.existsSync(path.join(root, "npm-called")), false);
|
|
1210
|
+
assert.equal(fs.existsSync(path.join(root, "npx-called")), false);
|
|
1211
|
+
});
|
|
1212
|
+
|
|
1213
|
+
test("OpenCode compatibility smoke rejects a non-canonical latest resolution", (t) => {
|
|
1214
|
+
const root = makeCompatibilitySmokeFixture(t, {
|
|
1215
|
+
request: "latest",
|
|
1216
|
+
resolvedVersion: "01.18.4",
|
|
1217
|
+
});
|
|
1218
|
+
const result = runCompatibilitySmoke(root, ["latest"]);
|
|
1219
|
+
|
|
1220
|
+
assert.notEqual(result.status, 0);
|
|
1221
|
+
assert.equal(result.stdout, "");
|
|
1222
|
+
assert.equal(fs.existsSync(path.join(root, "npx-called")), true);
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1225
|
+
for (const [label, leakPath] of [
|
|
1226
|
+
["original repository", "root"],
|
|
1227
|
+
["original home", process.env.HOME],
|
|
1228
|
+
]) {
|
|
1229
|
+
if (!leakPath && label === "original home") continue;
|
|
1230
|
+
|
|
1231
|
+
test(`OpenCode compatibility smoke suppresses an ${label} path leaked on stderr`, (t) => {
|
|
1232
|
+
const root = makeCompatibilitySmokeFixture(t, {
|
|
1233
|
+
stderrLeak: leakPath,
|
|
1234
|
+
});
|
|
1235
|
+
const forbiddenPath = leakPath === "root" ? root : leakPath;
|
|
1236
|
+
const result = runCompatibilitySmoke(root);
|
|
1237
|
+
|
|
1238
|
+
assert.notEqual(result.status, 0);
|
|
1239
|
+
assert.equal(result.stdout, "");
|
|
1240
|
+
assert.equal(result.stderr.includes(forbiddenPath), false);
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
for (const [label, leakPath] of [
|
|
1245
|
+
["original repository", "root"],
|
|
1246
|
+
["original home", process.env.HOME],
|
|
1247
|
+
]) {
|
|
1248
|
+
if (!leakPath && label === "original home") continue;
|
|
1249
|
+
|
|
1250
|
+
test(`OpenCode compatibility smoke rejects an ${label} path leaked on stdout`, (t) => {
|
|
1251
|
+
const root = makeCompatibilitySmokeFixture(t, { stdoutLeak: leakPath });
|
|
1252
|
+
const result = runCompatibilitySmoke(root);
|
|
1253
|
+
|
|
1254
|
+
assert.notEqual(result.status, 0);
|
|
1255
|
+
assert.equal(result.stdout, "");
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
for (const [name, options] of [
|
|
1260
|
+
["a mismatched resolved version", { wrongVersion: true }],
|
|
1261
|
+
["a missing packaged lead", { packagedLead: "missing" }],
|
|
1262
|
+
["an incorrect packaged lead mode", { packagedLead: "all" }],
|
|
1263
|
+
]) {
|
|
1264
|
+
test(`OpenCode compatibility smoke rejects ${name}`, (t) => {
|
|
1265
|
+
const root = makeCompatibilitySmokeFixture(t, options);
|
|
1266
|
+
const result = runCompatibilitySmoke(root);
|
|
1267
|
+
|
|
1268
|
+
assert.notEqual(result.status, 0);
|
|
1269
|
+
assert.equal(result.stdout, "");
|
|
1270
|
+
});
|
|
1271
|
+
}
|