ci(tests): run the Oh My Pi compatibility suite as a required check

tests/test-omp-compat.mjs skipped whenever omp was not on PATH, which
was always the case in CI, so 0.6.1 shipped an import that pi's compat
entrypoint provides but OMP's bundled pi-ai does not (#74).

Add an omp-compat job that installs @oh-my-pi/pi-coding-agent with Bun
and runs the suite with OMP_COMPAT_REQUIRED=1, which turns the skip into
a failure. Add a first phase that loads the extension through
`omp models -e`, the same loader `omp plugin install` validates with;
it fails on the 0.6.1 index.ts and passes with the runtime resolution.
This commit is contained in:
Patrick Wozniak
2026-09-02 10:14:59 +02:00
parent 9b91e5468e
commit caa4e8e274
4 changed files with 57 additions and 0 deletions
+18
View File
@@ -40,6 +40,10 @@ function findOmpBinary() {
const OMP_BIN = findOmpBinary()
if (!OMP_BIN) {
if (process.env.OMP_COMPAT_REQUIRED === "1") {
console.error("[omp-compat] FAIL - omp is required but not on PATH and OMP_BIN is unset")
process.exit(1)
}
console.log("[omp-compat] SKIP - omp is not on PATH")
process.exit(0)
}
@@ -211,6 +215,20 @@ function runOmp(args, timeoutMs = 30_000) {
}
try {
console.log("[omp-compat] extension loads against the host's pi packages")
// OMP remaps `@earendil-works/pi-ai/compat` onto its own pi-ai and rejects
// any named import that module does not export, both in `omp plugin
// install` validation and when loading the extension. 0.6.1 shipped such an
// import and could not be installed on omp 18 (#74). `omp models -e EXT`
// runs the same loader, so it reproduces that failure without a registry.
const load = await runOmp(["models", "-e", EXT_PATH])
assert.equal(load.code, 0, load.stderr)
assert.doesNotMatch(
load.stdout + load.stderr,
/Failed to load extension|not found in module/,
"the extension must only import what OMP's bundled pi packages export",
)
console.log("[omp-compat] list models through real extension")
modelListRequestCount = 0
// Prefer the flag form `omp -e EXT --list-models`; Homebrew's `omp`