diff --git a/test/README.md b/test/README.md index 4a60af891b2..b9fb902f4d9 100644 --- a/test/README.md +++ b/test/README.md @@ -76,6 +76,14 @@ distinct quality value. Do not move assertions into helpers, aggregate objects, After a valid reduction, run `npm run e2e:assertions:update` and include the lower baseline in the same change. The ratchet rejects growth and stale baselines. +PR #11919 has one bounded admission for #11859's fixed managed-vLLM installed-CLI qualification. +It permits adding `test/e2e/live/managed-vllm-config-export.test.ts` and its +`managed-vllm-config-export-helpers.ts` companion: one test file, two live files, 19 direct +assertion points, and 51 transitive assertion points. The allowance applies only before that test +has a budget in the base revision. Other PRs, existing tests, and later growth retain their limits. +The policy must land on `main` before #11919 raises its budget because CI executes the trusted +base's guard. This admission does not replace Linux/AMD64 live qualification evidence. + New test files must use TypeScript. Each plugin test must execute at least one Vitest `expect` assertion. The repository test configuration owns automatic mock and environment cleanup; restore direct global or environment mutations in the test that owns them. diff --git a/test/automation/pull-requests/growth-guardrail-parsers.test.ts b/test/automation/pull-requests/growth-guardrail-parsers.test.ts index 80f8fedd398..22931e0d526 100644 --- a/test/automation/pull-requests/growth-guardrail-parsers.test.ts +++ b/test/automation/pull-requests/growth-guardrail-parsers.test.ts @@ -99,6 +99,39 @@ function e2eAssertionBudget( }); } +function managedVllmAdmission(pullRequestNumber: number | null = 11919) { + const testFile = "test/e2e/live/managed-vllm-config-export.test.ts"; + const helperFile = "test/e2e/live/managed-vllm-config-export-helpers.ts"; + const base = JSON.parse(e2eAssertionBudget(1)); + const head = structuredClone(base); + head.limits.testFileCount += 1; + head.limits.liveFileCount += 2; + head.limits.direct.nodeAssertions += 19; + head.limits.direct.assertionPoints += 19; + head.limits.unique.nodeAssertions += 51; + head.limits.unique.assertionPoints += 51; + head.limits.files[testFile] = [0, 19, 0, 51, 0]; + const files = [ + { filename: "ci/e2e-assertion-budget.json", status: "modified" }, + { filename: testFile, status: "added" }, + { filename: helperFile, status: "added" }, + ]; + return { + base, + head, + files, + testFile, + helperFile, + diff: () => + fixtureDiff( + files, + { "ci/e2e-assertion-budget.json": JSON.stringify(base) }, + { "ci/e2e-assertion-budget.json": JSON.stringify(head) }, + pullRequestNumber, + ), + }; +} + /** Register synthetic cases for the growth guardrail parsers and diagnostics. */ function defineCodebaseGrowthGuardrailTestSupport(): void { it("caches repeated blob reads across guardrail checks", () => { @@ -321,6 +354,69 @@ function defineCodebaseGrowthGuardrailTestSupport(): void { expect(await e2eAssertionBudgetGrowthViolations(diff)).toEqual([]); }); + it.each([11919, null])( + "admits only the fixed managed-vLLM qualification in PR %s (#11859)", + async (pullRequestNumber) => { + const f = managedVllmAdmission(pullRequestNumber); + expect(await e2eAssertionBudgetGrowthViolations(f.diff())).toEqual([]); + }, + ); + + it("does not grant the managed-vLLM admission to another PR (#11859)", async () => { + const f = managedVllmAdmission(11920); + expect(await e2eAssertionBudgetGrowthViolations(f.diff())).toContain( + `${f.testFile} added a live E2E assertion budget`, + ); + }); + + it.each(["test", "helper"])( + "requires the admitted %s file to be added (#11859)", + async (kind) => { + const f = managedVllmAdmission(); + f.files[kind === "test" ? 1 : 2].status = "modified"; + expect(await e2eAssertionBudgetGrowthViolations(f.diff())).toContain( + `${f.testFile} added a live E2E assertion budget`, + ); + }, + ); + + it("rejects unrelated growth alongside the managed-vLLM admission (#11859)", async () => { + const f = managedVllmAdmission(); + f.head.limits.files["test/e2e/live/example.test.ts"][1] += 1; + f.head.limits.files["test/e2e/live/unrelated.test.ts"] = [0, 0, 0, 0, 0]; + expect(await e2eAssertionBudgetGrowthViolations(f.diff())).toEqual([ + "test/e2e/live/example.test.ts directAssertionPoints increased from 1 to 2", + "test/e2e/live/unrelated.test.ts added a live E2E assertion budget", + ]); + }); + + it("enforces the admitted file and suite ceilings (#11859)", async () => { + const f = managedVllmAdmission(); + f.head.limits.testFileCount += 1; + f.head.limits.liveFileCount += 1; + f.head.limits.direct.assertionPoints += 1; + f.head.limits.unique.assertionPoints += 1; + f.head.limits.files[f.testFile][3] += 1; + expect(await e2eAssertionBudgetGrowthViolations(f.diff())).toEqual([ + "testFileCount increased from 2 to 3", + "liveFileCount increased from 3 to 4", + "direct.assertionPoints increased from 20 to 21", + "unique.assertionPoints increased from 52 to 53", + `${f.testFile} transitiveAssertionPoints increased from 51 to 52`, + ]); + }); + + it("does not renew the allowance after the qualification is in the base (#11859)", async () => { + const f = managedVllmAdmission(); + Object.assign(f.base, structuredClone(f.head)); + f.head.limits.unique.assertionPoints += 1; + f.head.limits.files[f.testFile][3] += 1; + expect(await e2eAssertionBudgetGrowthViolations(f.diff())).toEqual([ + "unique.assertionPoints increased from 52 to 53", + `${f.testFile} transitiveAssertionPoints increased from 51 to 52`, + ]); + }); + it("rejects a larger live E2E assertion budget and changed reference", async () => { const diff = fixtureDiff( [{ filename: "ci/e2e-assertion-budget.json", status: "modified" }], diff --git a/test/helpers/growth-guardrail-checks.ts b/test/helpers/growth-guardrail-checks.ts index bb12b7a5497..0891f9949e5 100644 --- a/test/helpers/growth-guardrail-checks.ts +++ b/test/helpers/growth-guardrail-checks.ts @@ -3,7 +3,10 @@ import ts from "typescript"; -import { parseE2eAssertionBudget } from "../../scripts/checks/e2e-assertion-census.mts"; +import { + parseE2eAssertionBudget, + type E2eAssertionBudget, +} from "../../scripts/checks/e2e-assertion-census.mts"; import type { GrowthGuardrailDiff, PullRequestFile } from "./growth-guardrail-diff"; const BUDGET_FILE = "ci/test-file-size-budget.json"; @@ -488,6 +491,42 @@ export async function testSizeViolations(diff: GrowthGuardrailDiff): Promise + diff.files.some((file) => file.filename === filename && file.status === "added"), + ) + ) + return base; + return { + ...base, + limits: { + ...base.limits, + testFileCount: base.limits.testFileCount + 1, + liveFileCount: base.limits.liveFileCount + 2, + direct: { + ...base.limits.direct, + nodeAssertions: base.limits.direct.nodeAssertions + 19, + assertionPoints: base.limits.direct.assertionPoints + 19, + }, + unique: { + ...base.limits.unique, + nodeAssertions: base.limits.unique.nodeAssertions + 51, + assertionPoints: base.limits.unique.assertionPoints + 51, + }, + files: { ...base.limits.files, [testFile]: [0, 19, 0, 51, 0] }, + }, + }; +} + export async function e2eAssertionBudgetGrowthViolations( diff: GrowthGuardrailDiff, ): Promise { @@ -507,7 +546,7 @@ export async function e2eAssertionBudgetGrowthViolations( } if (baseSource === null || baseSource === undefined) return []; - const base = parseE2eAssertionBudget(baseSource); + const base = managedVllmExportAdmission(parseE2eAssertionBudget(baseSource), diff); const head = parseE2eAssertionBudget(headSource); const violations: string[] = []; if (JSON.stringify(head.reference) !== JSON.stringify(base.reference)) {