build(plugin): use pnpm for MCP app dependencies (#725)

* build(plugin): use pnpm for MCP app dependencies

* test: fix CI reports and Windows subprocess checks

---------

Co-authored-by: Michael D'Angelo <269034524+mldangelo-oai@users.noreply.github.com>
This commit is contained in:
mldangelo-oai
2026-08-28 18:58:30 -07:00
committed by GitHub
co-authored by Michael D'Angelo
parent 956fd89b2f
commit def641eef6
23 changed files with 1230 additions and 1875 deletions
+8 -11
View File
@@ -100,8 +100,6 @@ jobs:
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: "22.13.0"
cache: npm
cache-dependency-path: sdk/typescript/pnpm-lock.yaml
- name: Install dependencies
if: steps.scope.outputs.check-markdown == 'true'
@@ -154,14 +152,14 @@ jobs:
with:
package_json_file: sdk/typescript/package.json
cache: true
cache_dependency_path: sdk/typescript/pnpm-lock.yaml
cache_dependency_path: |
sdk/typescript/pnpm-lock.yaml
plugins/codex-security/mcp-app/pnpm-lock.yaml
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: plugins/codex-security/mcp-app/package-lock.json
- name: Check plugin source boundary
if: matrix.os == 'ubuntu-latest' && matrix.node == '22.13.0'
@@ -175,7 +173,7 @@ jobs:
- name: Install dependencies
run: |
pnpm --dir sdk/typescript install --frozen-lockfile
npm ci --prefix plugins/codex-security/mcp-app --no-audit --no-fund
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Install ripgrep
if: matrix.os == 'ubuntu-latest' && matrix.node == '22.13.0'
@@ -274,7 +272,8 @@ jobs:
node-version: "22.13.0"
- name: Test deterministic triage eval contracts
run: npm --prefix plugins/codex-security/skills/triage-finding/evals run test:deterministic
working-directory: plugins/codex-security/skills/triage-finding/evals
run: node --run test:deterministic
required-test:
name: ${{ matrix.os }} / node-22
@@ -325,7 +324,7 @@ jobs:
- name: Install dependencies
run: |
pnpm --dir sdk/typescript install --frozen-lockfile
npm ci --prefix plugins/codex-security/mcp-app --no-audit --no-fund
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Generate bundled plugin
run: pnpm --dir sdk/typescript run build:plugin
@@ -376,8 +375,6 @@ jobs:
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: plugins/codex-security/mcp-app/package-lock.json
- name: Set up pnpm
run: npm install --global pnpm@11.9.0 --no-audit --no-fund
@@ -385,7 +382,7 @@ jobs:
- name: Install dependencies
run: |
pnpm --dir sdk/typescript install --frozen-lockfile
npm ci --prefix plugins/codex-security/mcp-app --no-audit --no-fund
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Pack
working-directory: sdk/typescript
+1 -1
View File
@@ -136,7 +136,7 @@ jobs:
- name: Install dependencies
run: |
sfw pnpm --dir sdk/typescript install --frozen-lockfile
sfw npm ci --prefix plugins/codex-security/mcp-app --no-audit --no-fund
sfw pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Install ripgrep
run: |
+7 -3
View File
@@ -23,7 +23,7 @@ jobs:
runner:
name: ${{ matrix.os }} / ${{ matrix.mode }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
timeout-minutes: 30
env:
CODEX_SECURITY_PROPERTY_SEED: ${{ github.event_name == 'pull_request' && 1 || github.run_number }}
strategy:
@@ -71,12 +71,16 @@ jobs:
with:
package_json_file: sdk/typescript/package.json
cache: true
cache_dependency_path: sdk/typescript/pnpm-lock.yaml
cache_dependency_path: |
sdk/typescript/pnpm-lock.yaml
plugins/codex-security/mcp-app/pnpm-lock.yaml
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.13"
- name: Install dependencies
run: pnpm --dir sdk/typescript install --frozen-lockfile
run: |
pnpm --dir sdk/typescript install --frozen-lockfile
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Prepare private Windows test root
if: runner.os == 'Windows'
id: windows-temp
+1 -1
View File
@@ -10,7 +10,7 @@ tasks:
sudo apt-get install --yes ripgrep
fi
pnpm --dir sdk/typescript install --frozen-lockfile
npm ci --prefix plugins/codex-security/mcp-app --no-audit --no-fund
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
python -m pip install --disable-pip-version-check --no-input -e 'plugins/codex-security[test]'
triggeredBy:
- manual
+2 -2
View File
@@ -5,12 +5,12 @@ FROM node:22-bookworm-slim@sha256:6c74791e557ce11fc957704f6d4fe134a7bc8d6f5ca440
WORKDIR /build/sdk/typescript
COPY sdk/typescript/package.json sdk/typescript/pnpm-lock.yaml sdk/typescript/pnpm-workspace.yaml ./
COPY plugins/codex-security/mcp-app/package.json plugins/codex-security/mcp-app/package-lock.json /build/plugins/codex-security/mcp-app/
COPY plugins/codex-security/mcp-app/package.json plugins/codex-security/mcp-app/pnpm-lock.yaml plugins/codex-security/mcp-app/pnpm-workspace.yaml /build/plugins/codex-security/mcp-app/
RUN corepack enable \
&& corepack prepare "$(node --print 'require("./package.json").packageManager')" --activate \
&& pnpm install --frozen-lockfile \
&& npm ci --prefix /build/plugins/codex-security/mcp-app --no-audit --no-fund
&& pnpm --dir /build/plugins/codex-security/mcp-app install --frozen-lockfile
COPY sdk/typescript/ ./
COPY plugins/codex-security/ /build/plugins/codex-security/
File diff suppressed because it is too large Load Diff
@@ -3,6 +3,7 @@
"version": "0.1.158",
"type": "module",
"private": true,
"packageManager": "pnpm@11.9.0+sha512.bd682d5d03fe525ef7c9fd6780c6884d1e756ac4c9c9fe00c538782824310dcf90e3ddc4f53835f06dfaebd5085e41855e0bcbb3b60de2ac5bbab89e5036f03b",
"scripts": {
"build": "tsc --noEmit",
"build:mcp": "node scripts/build_mcp_app.mjs --output .preview/mcp",
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,2 @@
allowBuilds:
esbuild: false
@@ -43,15 +43,6 @@ const parentSandboxState = {
},
sandboxCwd: pathToFileURL(pluginRoot).href,
};
const packageManifest = JSON.parse(
await readFile(path.join(mcpAppRoot, "package.json"), "utf8"),
);
const packageLock = JSON.parse(
await readFile(path.join(mcpAppRoot, "package-lock.json"), "utf8"),
);
const MCP_APP_VERSION = packageManifest.version;
assert.equal(packageLock.version, MCP_APP_VERSION);
assert.equal(packageLock.packages[""].version, MCP_APP_VERSION);
const installedPluginRoot = pluginRoot;
const serverPath = path.join(installedPluginRoot, "mcp", "server.mjs");
const mcpConfig = JSON.parse(
+1 -1
View File
@@ -1423,7 +1423,7 @@ From a source checkout's `sdk/typescript` directory:
```bash
pnpm install --frozen-lockfile
npm ci --prefix ../../plugins/codex-security/mcp-app
pnpm --dir ../../plugins/codex-security/mcp-app install --frozen-lockfile
pnpm run build:plugin
pnpm run build
node bin/codex-security.mjs serve --port 3000
+2 -1
View File
@@ -1,11 +1,12 @@
# Testing the SDK and CLI
Use the pnpm version in `package.json` and Bun 1.3.14, matching required CI.
Install both the SDK and MCP app dependencies before building or testing.
Run these commands from `sdk/typescript`:
```sh
pnpm install --frozen-lockfile
npm ci --prefix ../../plugins/codex-security/mcp-app --no-audit --no-fund
pnpm --dir ../../plugins/codex-security/mcp-app install --frozen-lockfile
pnpm run check:plugin-source
bun test --timeout 30000 ./tests-ts/worker-progress.test.ts
pnpm run types
+2 -2
View File
@@ -56,10 +56,10 @@
"start:server": "node dist/server/index.js",
"test": "node --run build:plugin && bun test --timeout 30000 ./tests-ts",
"test:ci": "node -e \"require('node:fs').mkdirSync('reports',{recursive:true})\" && pnpm run test --coverage --coverage-reporter=text --coverage-reporter=lcov --reporter=junit --reporter-outfile=reports/junit.xml",
"test:mcp": "node --run build:plugin && npm --prefix ../../plugins/codex-security/mcp-app run test:mcp",
"test:mcp": "node --run build:plugin && pnpm --dir ../../plugins/codex-security/mcp-app run test:mcp",
"test:mutation": "stryker run",
"test:package": "node scripts/smoke-package.mjs",
"types": "pnpm run generate:models:check && npm --prefix ../../plugins/codex-security/mcp-app run typecheck && tsc --noEmit"
"types": "pnpm run generate:models:check && pnpm --dir ../../plugins/codex-security/mcp-app run typecheck && tsc --noEmit"
},
"dependencies": {
"@inquirer/prompts": "8.3.0",
@@ -559,7 +559,7 @@ describe("publish scan to Cloud", () => {
});
test.each([false, true])(
"preserves batch receipts on cancellation with a confirmed response: %s",
"preserves batch receipts on cancellation with a confirmed response: %j",
async (confirmed) => {
for (const [signal, code] of [
["SIGINT", 130],
+1 -1
View File
@@ -62,7 +62,7 @@ test("dedupe resolves a workflow's pinned scan and passes the workflow ID to the
});
test.each([false, true])(
"dedupe passes the scan selector, URL, and all-repository scope %s to the SDK",
"dedupe passes the scan selector, URL, and all-repository scope %j to the SDK",
async (allRepositories) => {
const stdout = capture();
const stderr = capture();
+2 -2
View File
@@ -123,7 +123,7 @@ describe("publish scan to custom", () => {
expect(JSON.parse(stdout.text())).toEqual(receipt);
});
test.each([false, true])(
"publishes a selected saved scan with dry-run=%s",
"publishes a selected saved scan with dry-run=%j",
async (dryRun) => {
const [scanDir] = await publicationScanDirectories(1);
const stdout = capture();
@@ -481,7 +481,7 @@ describe("publish scan", () => {
});
test.each([false, true])(
"resolves a saved scan ID for Linear publication with skipExisting=%s",
"resolves a saved scan ID for Linear publication with skipExisting=%j",
async (skipExisting) => {
const scanDir = await publicationDirectory();
const deps = dependencies({
+14 -7
View File
@@ -1,4 +1,4 @@
import { spawn, spawnSync } from "node:child_process";
import { spawn } from "node:child_process";
import { once } from "node:events";
import { mkdtemp, rm, stat, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
@@ -79,15 +79,22 @@ test("serve reports startup failures with a nonzero exit", async () => {
try {
const state = join(root, "not-a-directory");
await writeFile(state, "synthetic file");
const child = spawnSync(process.execPath, [cli, "serve"], {
const child = Bun.spawn({
cmd: [process.execPath, cli, "serve"],
env: { ...process.env, CODEX_SECURITY_STATE_DIR: state },
encoding: "utf8",
stdin: "ignore",
stdout: "pipe",
stderr: "pipe",
timeout: 20_000,
});
expect(child.error).toBeUndefined();
expect(child.status).toBe(1);
expect(child.stdout).toBe("");
expect(child.stderr).toContain("Could not access the findings database");
const [status, stdout, stderr] = await Promise.all([
child.exited,
new Response(child.stdout).text(),
new Response(child.stderr).text(),
]);
expect(status, stderr).toBe(1);
expect(stdout).toBe("");
expect(stderr).toContain("Could not access the findings database");
} finally {
await rm(root, { recursive: true, force: true });
}
+20 -16
View File
@@ -411,29 +411,33 @@ describe("CLI", () => {
const root = await mkdtemp(join(tmpdir(), "codex-security-deep-defaults-"));
try {
const result = spawnSync(
python!,
[
const child = Bun.spawn({
cmd: [
python!,
join(PLUGIN_ROOT, "scripts", "deep_scan_config.py"),
"--available-parallelism",
"12",
],
{
encoding: "utf8",
env: {
...process.env,
CODEX_HOME: join(root, "codex-home"),
PYTHONDONTWRITEBYTECODE: "1",
},
timeout: 30_000,
env: {
...process.env,
CODEX_HOME: join(root, "codex-home"),
PYTHONDONTWRITEBYTECODE: "1",
},
);
stdin: "ignore",
stdout: "pipe",
stderr: "pipe",
timeout: 30_000,
});
const [status, stdout, stderr] = await Promise.all([
child.exited,
new Response(child.stdout).text(),
new Response(child.stderr).text(),
]);
expect(result.error).toBeUndefined();
expect(result.status).toBe(0);
expect(result.stderr).toBe("");
expect(status, stderr).toBe(0);
expect(stderr).toBe("");
const defaults = JSON.parse(result.stdout) as {
const defaults = JSON.parse(stdout) as {
workers: number;
subagents: number;
stopAfterNoNew: number;
@@ -343,7 +343,7 @@ describe("Cloud publication", () => {
});
test.each([false, true])(
"rejects artifacts from another scan before upload or preview (dryRun=%s)",
"rejects artifacts from another scan before upload or preview (dryRun=%j)",
async (dryRun) => {
const { scan, environment } = await fixture();
let requests = 0;
@@ -601,7 +601,7 @@ test("retains earlier confirmed matches if later matching fails", async () => {
});
test.each([0, 1])(
"skips matching with %s populated components",
"skips matching with %i populated components",
async (populated) => {
const paths = await fixture();
let calls = 0;
@@ -909,7 +909,7 @@ test("CLI forwards scan settings and returns incomplete coverage", async () => {
});
test.each([false, true])(
"CLI reports matching completion (failure: %s)",
"CLI reports matching completion (failure: %j)",
async (failMatching) => {
const paths = await fixture();
let calls = 0;
@@ -908,7 +908,7 @@ describe("database-backed Linear publication integration", () => {
});
test.each([false, true])(
"keeps conflicting connector identities out of CLI history and retains recovery evidence with skipExisting=%s",
"keeps conflicting connector identities out of CLI history and retains recovery evidence with skipExisting=%j",
async (skipExisting) => {
const completed = await fixture(1 + Number(skipExisting));
const sealed = await artifactDigests(completed.scanDirectory);
+1 -1
View File
@@ -972,7 +972,7 @@ describe("direct Linear API publication", () => {
});
test.each([false, true])(
"lets active direct mutations settle after external cancellation with skipExisting=%s",
"lets active direct mutations settle after external cancellation with skipExisting=%j",
async (skipExisting) => {
const publication = preparedPublication(23);
const recorded = {
+1 -1
View File
@@ -167,7 +167,7 @@ describe("TypeScript package skeleton", () => {
);
expect(steps[dependencyInstallation]?.run).toContain(
"npm ci --prefix plugins/codex-security/mcp-app",
"pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile",
);
expect(steps[pluginGeneration]?.run).toBe(
"pnpm --dir sdk/typescript run build:plugin",