Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

test(ci): run the weekly property suite across platforms (#1943)

Michael D'Angelo6b5074167804
diff --git a/.github/workflows/test-quality.yml b/.github/workflows/test-quality.yml
index 26c275e1c..b02e1a8f6 100644
--- a/.github/workflows/test-quality.yml
+++ b/.github/workflows/test-quality.yml
@@ -3,11 +3,17 @@ name: test-quality
on:
workflow_call:
inputs:
+ compare-layouts: &compare-layouts
+ description: Run the full SDK shard-layout comparison
+ type: boolean
+ default: true
native-artifacts-ready:
description: Use the native artifacts already built by the caller in this run.
type: boolean
default: false
workflow_dispatch:
+ inputs:
+ compare-layouts: *compare-layouts
schedule:
- cron: "23 9 * * 1"
@@ -29,12 +35,14 @@ jobs:
runner:
needs: native
- if: ${{ !cancelled() && (inputs.native-artifacts-ready || needs.native.result == 'success') }}
+ if: ${{ !cancelled() && inputs.compare-layouts && (inputs.native-artifacts-ready || needs.native.result == 'success') }}
name: ${{ matrix.target.os }} / ${{ matrix.target.mode }} / shard-${{ matrix.target.shard }}
runs-on: ${{ matrix.target.os }}
timeout-minutes: ${{ matrix.target.os == 'windows-latest' && 90 || 30 }}
env:
CODEX_SECURITY_PROPERTY_SEED: ${{ github.event_name == 'pull_request' && 1 || github.run_number }}
+ SHARD: ${{ matrix.target.shard }}/${{ matrix.target.count }}
+ REPORT_ID: ${{ matrix.target.os }}-${{ matrix.target.mode }}-${{ matrix.target.shard }}
strategy:
fail-fast: false
matrix:
@@ -79,7 +87,7 @@ jobs:
- { os: windows-latest, shard: 12, count: 14, mode: expanded }
- { os: windows-latest, shard: 13, count: 14, mode: expanded }
- { os: windows-latest, shard: 14, count: 14, mode: expanded }
- steps:
+ steps: &sdk-test-steps
- &actions-checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -102,10 +110,12 @@ jobs:
cache-dependency-path: |
sdk/typescript/pnpm-lock.yaml
plugins/codex-security/mcp-app/pnpm-lock.yaml
- - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
+ - &set-up-bun
+ uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
- name: Install dependencies
+ shell: bash
run: |
pnpm --dir sdk/typescript install --frozen-lockfile
pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
@@ -122,25 +132,51 @@ jobs:
sudo apt-get update
sudo apt-get install --yes ripgrep
- name: Test shard layout
+ if: inputs.compare-layouts
working-directory: sdk/typescript
- env:
+ env: &test-temp
TEMP: ${{ steps.windows-temp.outputs.path || runner.temp }}
TMP: ${{ steps.windows-temp.outputs.path || runner.temp }}
TMPDIR: ${{ steps.windows-temp.outputs.path || runner.temp }}
- run: node --experimental-strip-types scripts/run-ci-tests.mts ${{ matrix.target.shard }}/${{ matrix.target.count }} ${{ matrix.target.os == 'ubuntu-latest' && '--coverage --coverage-reporter=lcov' || '' }} --coverage-dir=reports/coverage-${{ matrix.target.os }}-${{ matrix.target.mode }}-${{ matrix.target.shard }} --seed=${{ env.CODEX_SECURITY_PROPERTY_SEED }} --reporter-outfile=reports/runner-${{ matrix.target.os }}-${{ matrix.target.mode }}-${{ matrix.target.shard }}.xml
+ run: node --experimental-strip-types scripts/run-ci-tests.mts ${{ env.SHARD }} ${{ runner.os == 'Linux' && '--coverage --coverage-reporter=lcov' || '' }} --coverage-dir=reports/coverage-${{ env.REPORT_ID }} --seed=${{ env.CODEX_SECURITY_PROPERTY_SEED }} --reporter-outfile=reports/runner-${{ env.REPORT_ID }}.xml
+ - name: Test rotating properties
+ if: ${{ !inputs.compare-layouts }}
+ working-directory: sdk/typescript
+ shell: bash
+ env: *test-temp
+ run: |
+ git grep -lzF 'support/property' -- 'tests-ts/*.test.ts' > "$RUNNER_TEMP/property-tests"
+ mkdir -p reports
+ xargs -0 bun test --timeout="$CODEX_SECURITY_TEST_TIMEOUT_MS" --seed="$CODEX_SECURITY_PROPERTY_SEED" --reporter=junit --reporter-outfile=reports/properties.xml < "$RUNNER_TEMP/property-tests"
- name: Upload runner report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
- name: runner-${{ matrix.target.os }}-${{ matrix.target.mode }}-${{ matrix.target.shard }}
+ name: runner-${{ env.REPORT_ID }}
overwrite: true
path: sdk/typescript/reports/
if-no-files-found: error
retention-days: 14
+ properties:
+ name: ${{ matrix.os }} / rotating properties
+ needs: native
+ if: ${{ !cancelled() && !inputs.compare-layouts && (inputs.native-artifacts-ready || needs.native.result == 'success') }}
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 20
+ env:
+ CODEX_SECURITY_PROPERTY_SEED: ${{ github.run_number }}
+ CODEX_SECURITY_TEST_TIMEOUT_MS: ${{ matrix.os == 'windows-latest' && '120000' || '30000' }}
+ REPORT_ID: ${{ matrix.os }}-properties
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ steps: *sdk-test-steps
+
compare:
name: Runner inventory and timing
- if: always() && !cancelled()
+ if: always() && !cancelled() && inputs.compare-layouts
needs: [runner]
runs-on: ubuntu-latest
steps:
@@ -195,9 +231,7 @@ jobs:
# Stryker 10's Babel 8 requires Node 22.18+ or 24.11+.
node-version: "24.15.0"
- *github-actions-setup-tools
- - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- with:
- bun-version: "1.3.14"
+ - *set-up-bun
- name: Install dependencies
run: pnpm --dir sdk/typescript install --frozen-lockfile
- name: Run mutation trial
diff --git a/docs/ci.md b/docs/ci.md
index e35421dc0..f4b349ee4 100644
--- a/docs/ci.md
+++ b/docs/ci.md
@@ -59,9 +59,9 @@ neither cancel source runs nor satisfy their required check names.
The `ci` job checks every selected required job. A failed, cancelled, missing,
or unexpectedly skipped selected job fails the gate. An explicitly unselected
-job can be skipped. Static checks are always required. Broad test-runner
-experiments run through the separate scheduled/manual `test-quality` workflow;
-they are not merge gates.
+job can be skipped. Static checks are always required. The separate `test-quality`
+workflow runs weekly property and mutation tests. Dispatch it to compare full SDK
+shard layouts.
The existing OS-named check contexts temporarily forward the `ci` result so
repository branch rules continue to work during migration. To finish migration:
diff --git a/sdk/typescript/TESTING.md b/sdk/typescript/TESTING.md
index 491f7811b..26b5e823c 100644
--- a/sdk/typescript/TESTING.md
+++ b/sdk/typescript/TESTING.md
@@ -183,10 +183,15 @@ Coverage is diagnostic and split across shards, not a combined percentage.
Failed tests and missing package artifacts block CI; failed diagnostic uploads
do not. Use `python -m pytest -n 0` to reproduce Python failures serially.
-The separate `test-quality` workflow runs weekly and can be dispatched manually.
+Each week `test-quality` runs the mutation trial on Linux. On Linux, macOS, and
+Windows it runs the test files that import the shared property options, using
+the workflow run number as the property seed. Each platform uploads its JUnit
+report. To replay the weekly jobs, dispatch with `compare-layouts` disabled.
Ordinary source pull requests run focused contracts for the shard runner, timing
metadata, report comparator, and Windows test-root helper in the required SDK suite.
-The diagnostic workflow compares the previous layout (three shards on Linux/macOS,
+
+Manual and reusable workflow runs default to comparing the previous layout
+(three shards on Linux/macOS,
seven on Windows) with the expanded production layout (six on Linux/macOS,
fourteen on Windows), for 39 sharded runner jobs. Both layouts use the same serial
Bun runner and platform timing snapshot; the comparison combines all shards for
@@ -194,8 +199,9 @@ each OS before checking inventory and outcomes. Local full-suite runs still cove
unsharded cross-file ordering. More jobs add setup overhead, so compare required-green
latency and summed runner time alongside shard test timings.
-Scheduled and manual diagnostics use the workflow run number as the same seed for
-property cases and test ordering in every layout. Reports have unique OS/layout/shard
+The comparison uses the same seed for property cases and test ordering in every
+layout. Manual runs use the workflow run number. Calls from pull request workflows
+use seed 1. Reports have unique OS/layout/shard
names. The workflow requires every expected shard report
before accepting comparisons, then compares complete shard groups by test
identity, outcome, assertion count, and occurrence count, retaining legitimate
diff --git a/sdk/typescript/tests-ts/skeleton.test.ts b/sdk/typescript/tests-ts/skeleton.test.ts
index c4aa6eab0..6eb88f816 100644
--- a/sdk/typescript/tests-ts/skeleton.test.ts
+++ b/sdk/typescript/tests-ts/skeleton.test.ts
@@ -523,6 +523,17 @@ describe("TypeScript package skeleton", () => {
"${{ github.event_name == 'pull_request' && 1 || github.run_number }}";
expect(quality.env).not.toHaveProperty("CODEX_SECURITY_PROPERTY_SEED");
expect(runner.env?.["CODEX_SECURITY_PROPERTY_SEED"]).toBe(seed);
+ for (const trigger of ["workflow_call", "workflow_dispatch"]) {
+ expect(quality.on[trigger]).toMatchObject({
+ inputs: { "compare-layouts": { type: "boolean", default: true } },
+ });
+ }
+ expect(quality.jobs["properties"]).toMatchObject({
+ env: { CODEX_SECURITY_PROPERTY_SEED: "${{ github.run_number }}" },
+ strategy: {
+ matrix: { os: ["ubuntu-latest", "macos-latest", "windows-latest"] },
+ },
+ });
const unixMatrix = ci.jobs["test"]!.strategy!.matrix as Record<
string,
unknown
@@ -591,7 +602,7 @@ describe("TypeScript package skeleton", () => {
"working-directory": "sdk/typescript",
});
expect(execution?.run).toContain(
- "scripts/run-ci-tests.mts ${{ matrix.target.shard }}/${{ matrix.target.count }}",
+ "scripts/run-ci-tests.mts ${{ env.SHARD }}",
);
expect(execution?.run).toContain(
"--seed=${{ env.CODEX_SECURITY_PROPERTY_SEED }}",
@@ -610,8 +621,12 @@ describe("TypeScript package skeleton", () => {
(step) => step.name === "Upload runner report",
);
expect(runnerUpload).not.toHaveProperty("continue-on-error");
- expect(runnerUpload?.with?.["name"]).toBe(
- "runner-${{ matrix.target.os }}-${{ matrix.target.mode }}-${{ matrix.target.shard }}",
+ expect(runnerUpload?.with?.["name"]).toBe("runner-${{ env.REPORT_ID }}");
+ expect(runner.env?.["SHARD"]).toBe(
+ "${{ matrix.target.shard }}/${{ matrix.target.count }}",
+ );
+ expect(runner.env?.["REPORT_ID"]).toBe(
+ "${{ matrix.target.os }}-${{ matrix.target.mode }}-${{ matrix.target.shard }}",
);
expect(
quality.jobs["mutation"]?.steps!.find(