OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security
TypeScript ai-securityapplication-securityclicode-scanningcodexcodex-securitycybersecuritydevsecopsnodejsnpmopenaisdksecuritytypescriptvulnerability-scanning
ci: remove redundant required check jobs (#2001)
Michael D'Angelob129d12dd36b
diff --git a/.github/scripts/test-verify-pr-source.mjs b/.github/scripts/test-verify-pr-source.mjsindex b717bba35..a49f1d101 100644--- a/.github/scripts/test-verify-pr-source.mjs+++ b/.github/scripts/test-verify-pr-source.mjs@@ -40,11 +40,7 @@ function run(id, changes = {}) {const edit = (id, changes) =>run(id, { display_title: "PR edit CI · PR #42 → main", ...changes });function evidence(id, selected = "success") {- const names = [- "ci",- "classify changes",- ...["ubuntu", "macos", "windows"].map((os) => os + "-latest / node-22"),- ];+ const names = ["ci", "classify changes"];const selection = {name: "Select required checks",status: "completed",@@ -135,8 +131,9 @@ test("only fresh canonical source jobs and genuine selection can qualify a sourcassert.ok(realSource(page, source));for (const change of [{ total_count: 99 },- { jobs: page.jobs.slice(1) },- { total_count: 6, jobs: [...page.jobs, page.jobs[0]] },+ { total_count: 1, jobs: page.jobs.slice(1) },+ { total_count: 1, jobs: page.jobs.slice(0, 1) },+ { total_count: 3, jobs: [...page.jobs, page.jobs[0]] },{ jobs: page.jobs.map((j) => ({ ...j, run_id: 1 })) },{ jobs: page.jobs.map((j) => ({ ...j, run_attempt: 2 })) },{@@ -192,7 +189,7 @@ test("retrying a failed edit cannot replace its full checks with older green resawait retry.finish();});-test("even full fallback needs a current target; repeat this check just before the aliases", async () => {+test("even full fallback needs a current target when the CI gate finishes", async () => {const stale = { ...target, base: { ...pr.base, ref: "other" } },unavailable = new Error("target unavailable");for (const history of [diff --git a/.github/scripts/verify-pr-source.mjs b/.github/scripts/verify-pr-source.mjsindex 0e3652da0..e2599f1e4 100644--- a/.github/scripts/verify-pr-source.mjs+++ b/.github/scripts/verify-pr-source.mjs@@ -47,11 +47,7 @@ export async function confirmTarget(pr, sha, api) {}export function realSource(page, run) {- const required = [- "ci",- "classify changes",- ...["ubuntu", "macos", "windows"].map((os) => `${os}-latest / node-22`),- ];+ const required = ["ci", "classify changes"];const jobs = page.jobs.filter((job) => required.includes(job.name));if (page.total_count !== page.jobs.length ||diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.ymlindex 658b75085..b25c0466d 100644--- a/.github/workflows/node-ci.yml+++ b/.github/workflows/node-ci.yml@@ -475,7 +475,7 @@ jobs:windows-test,windows-verify,]- if: &source-aggregate always()+ if: always()runs-on: ubuntu-latestpermissions:contents: read@@ -495,29 +495,6 @@ jobs:CLASSIFIER_ATTEMPT: ${{ needs.classify-changes.outputs.edit-attempt }}run: node .github/scripts/verify-pr-source.mjs confirm-target- # Retain required names until the repository ruleset has migrated to `ci`.- required-test:- name: ${{ matrix.os }} / node-22- needs: [classify-changes, ci]- if: *source-aggregate- runs-on: ubuntu-latest- strategy:- fail-fast: false- matrix:- os: [ubuntu-latest, macos-latest, windows-latest]- steps:- - name: Require CI gate- if: needs.ci.result != 'success'- run: exit 1- - name: Require the edit classifier from this attempt- if: >-- github.event_name == 'pull_request' && github.event.action == 'edited' &&- github.event.changes.base == null &&- needs['classify-changes'].outputs['edit-attempt'] != github.run_attempt- run: |- echo 'Re-run all jobs to qualify this pull request edit.'- exit 1-windows-test:if: needs.classify-changes.outputs.source-required == 'true'name: windows-latest / node-22 / tests-${{ matrix.shard }}diff --git a/docs/ci.md b/docs/ci.mdindex cb05a6652..52ecb8f91 100644--- a/docs/ci.md+++ b/docs/ci.md@@ -86,19 +86,9 @@ job can be skipped. Static checks are always required. The separate `test-qualitworkflow runs weekly property and mutation tests. Dispatch it to compare full SDKshard layouts.-One compatibility matrix forwards the `ci` result to the three OS-named Node 22-checks required by the current `main` ruleset. Migrate the required checks in-this order.--1. Merge the workflow change and verify that `ci` is reported for source and- documentation pull requests, including a failing selected-check example.-2. Change the repository's required status checks to `ci` and `Validate PR Title`,- preserving their GitHub Actions integration and all unrelated protection rules.-3. Remove the compatibility matrix `required-test` and its three OS check- names from source verification in a follow-up.--Do not remove the old contexts before changing the rules. The workflow change-itself does not change repository protection settings.+The required GitHub Actions checks on `main` are `ci` and `Validate PR Title`.+The title check runs on pull request edits. To diagnose a failed `ci`, open+the selected job named in the gate output.## Diagnostics and local checksdiff --git a/sdk/typescript/TESTING.md b/sdk/typescript/TESTING.mdindex ac19c872f..2ed9733cf 100644--- a/sdk/typescript/TESTING.md+++ b/sdk/typescript/TESTING.md@@ -139,12 +139,9 @@ default to 100 cases; filesystem contract properties default to 20.## GitHub Actions-`node-ci` reports one `ci` gate for all selected required checks. The existing-`ubuntu-latest / node-22`, `macos-latest / node-22`, and-`windows-latest / node-22` check names forward that result while repository-branch rules migrate. The [CI guide](../../docs/ci.md) describes documentation-only-routing, platform/version selection, full scheduled qualification, and the gate-migration.+`node-ci` reports one `ci` gate for all selected required checks. The+[CI guide](../../docs/ci.md) describes documentation-only routing,+platform/version selection, and full scheduled qualification.For source qualification, CI builds and inspects one package archive, then passesthat archive to jobs in the same workflow run, using the commit SHA in thediff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.tsindex dd7e13a1e..b05f52a12 100644--- a/sdk/typescript/tests-ts/release-automation.test.ts+++ b/sdk/typescript/tests-ts/release-automation.test.ts@@ -3870,7 +3870,7 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}expect(nodeCiWorkflow).toContain("needs: classify-changes");});- test("preserves source validation dependencies and forwards the centralized gate result", async () => {+ test("requires every selected source validation in the centralized gate", async () => {const workflow = Bun.YAML.parse(nodeCiWorkflow) as {concurrency: {group: string;@@ -3919,16 +3919,14 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}expect(workflow.jobs["static-checks"]?.if).toBe("needs.classify-changes.outputs.source-run == ''",);- const aggregates = ["ci", "required-test"];+ const gate = workflow.jobs["ci"]!;const checks = Object.entries(workflow.jobs).filter(- ([name]) => name !== "classify-changes" && !aggregates.includes(name),+ ([name]) => name !== "classify-changes" && name !== "ci",);- expect(new Set([workflow.jobs["ci"]!.needs].flat())).toEqual(+ expect(new Set([gate.needs].flat())).toEqual(new Set(["classify-changes", ...checks.map(([name]) => name)]),);- for (const job of aggregates) {- expect(workflow.jobs[job]?.if).toContain("always()");- }+ expect(gate.if).toContain("always()");expect(workflow.jobs["action-ci"]).toMatchObject({uses: "./.github/workflows/action-ci.yml",with: {@@ -3975,9 +3973,7 @@ ${workflowStepShell(releaseCutWorkflow, "Resolve the stable package version")}).toEqual(new Set(scheduled.map(([name]) => name)));}expect(- workflow.jobs["ci"]?.steps.find(- ({ name }) => name === "Require selected checks",- ),+ gate.steps.find(({ name }) => name === "Require selected checks"),).toMatchObject({run: "node .github/scripts/check-ci-results.mjs",env: { CI_RESULTS: "${{ toJSON(needs) }}" },diff --git a/sdk/typescript/tests-ts/skeleton.test.ts b/sdk/typescript/tests-ts/skeleton.test.tsindex 22afa5e6f..e135335c4 100644--- a/sdk/typescript/tests-ts/skeleton.test.ts+++ b/sdk/typescript/tests-ts/skeleton.test.ts@@ -154,7 +154,6 @@ describe("TypeScript package skeleton", () => {expect([false, "false"]).not.toContain(verificationSteps[pythonSetup]?.with?.["update-environment"],);- expect(jobs["required-test"]?.name).toEndWith("${{ matrix.os }} / node-22");for (const name of ["compatibility", "windows-verify"]) {expect(jobs[name]?.steps).toContainEqual(expect.objectContaining({diff --git a/sdk/typescript/tests-ts/workflow-quality.test.ts b/sdk/typescript/tests-ts/workflow-quality.test.tsindex f60fa77b3..6820f7e2b 100644--- a/sdk/typescript/tests-ts/workflow-quality.test.ts+++ b/sdk/typescript/tests-ts/workflow-quality.test.ts@@ -19,7 +19,6 @@ const ci = Bun.YAML.parse(name: string;needs?: string | string[];if?: string;- strategy?: { matrix: Record<string, string[]>; "fail-fast"?: boolean };steps: { name: string; if?: string; run: string }[];}>;@@ -59,13 +58,6 @@ function eventContext(};}-const aggregates = [- ["ci", {}, "ci"] as const,- ...ci.jobs["required-test"]!.strategy!.matrix["os"]!.map(- (os) => ["required-test", { os }, `${os} / node-22`] as const,- ),-];-test.each([["push", {}, true],["opened", {}, true],@@ -85,16 +77,14 @@ test.each([({ name }) => name === "Verify pull request source",)!;expect(expression(proof.if!, context)).toBe(!sourceEvent);- const confirmation = ci.jobs["ci"]!.steps.at(-1)!;+ const gate = ci.jobs["ci"]!;+ expect(gate.name).toBe("ci");+ expect(expression(gate.if!, context)).toBe(true);+ const confirmation = gate.steps.at(-1)!;expect(confirmation.run).toBe("node .github/scripts/verify-pr-source.mjs confirm-target",);expect(expression(confirmation.if!, context)).toBe(!sourceEvent);- for (const [id, matrix, name] of aggregates) {- const aggregate = ci.jobs[id]!;- expect(expression(aggregate.if!, context)).toBe(true);- expect(interpolate(aggregate.name, { ...context, matrix })).toBe(name);- }const sourceGroup = interpolate(ci.concurrency.group,eventContext("synchronize"),@@ -108,12 +98,6 @@ test.each([);test("all source jobs depend on classification and titles cannot block source checks", () => {- expect(aggregates.map(([, , name]) => name)).toEqual([- "ci",- "ubuntu-latest / node-22",- "macos-latest / node-22",- "windows-latest / node-22",- ]);expect(ci.on.pull_request.types).toEqual(["opened","edited",@@ -393,39 +377,3 @@ for (const target of musl.jobs.primitives.strategy.matrix.include) {});}}--test("legacy required check names propagate the final CI gate result", () => {- const forwarder = ci.jobs["required-test"]!;- expect(forwarder.strategy?.["fail-fast"]).toBe(false);- expect(new Set([forwarder.needs].flat())).toEqual(- new Set(["classify-changes", "ci"]),- );- expect(forwarder.if).toContain("always()");- const gate = forwarder.steps.find((step) => step.name === "Require CI gate")!;- expect(gate.run).toBe("exit 1");- for (const result of ["success", "failure", "cancelled", "skipped"]) {- expect(expression(gate.if!, { needs: { ci: { result } } })).toBe(- result !== "success",- );- }- const retry = forwarder.steps.find(- (step) => step.name === "Require the edit classifier from this attempt",- )!;- expect(retry.run).toContain("exit 1");- for (const [action, changes, classifier, refuse] of [- ["synchronize", {}, "", false],- ["edited", { base: {} }, "", false],- ["edited", {}, "", true],- ["edited", {}, "1", true],- ["edited", {}, "2", false],- ] as const) {- expect(- expression(retry.if!, {- needs: {- "classify-changes": { outputs: { "edit-attempt": classifier } },- },- github: { ...eventContext(action, changes).github, run_attempt: "2" },- }),- ).toBe(refuse);- }-});