From 2b34255d9657dc63830978f4e4433a422ec30765 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Mon, 14 Sep 2026 17:47:11 -0700 Subject: [PATCH] fix(ci): stop defining pilot mutant tests inside a conditional (#20755) `vitest/no-conditional-tests` fires on the `if (mutation) { it(...) }` inside the pilot loop, and `audit:code-quality:native` runs oxlint with `--deny-warnings`, so main's "Enforce focused code-quality plugins" step exits 1 and blocks every open PR. Pair each pilot with its pinned mutant and reference state before the loops, so every iteration defines exactly one test unconditionally. Same 14 tests, same names: 11 mutant-kill tests and the 3 reference tests that `skipIf` still gates on RPC_FOUNDATION_REFERENCE_ROOT. --- .../mutants/pilot-mutants.test.ts | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/mobile/src/test-support/rpc-recording/mutants/pilot-mutants.test.ts b/mobile/src/test-support/rpc-recording/mutants/pilot-mutants.test.ts index a81a48238f5..acd9840e4f0 100644 --- a/mobile/src/test-support/rpc-recording/mutants/pilot-mutants.test.ts +++ b/mobile/src/test-support/rpc-recording/mutants/pilot-mutants.test.ts @@ -59,30 +59,35 @@ function visibleState(recording: Recording): RecordedValue { return recording.checkpoints.at(-1)!.observation.state } +// Pair pilots with their pinned mutant/reference up front so each loop below defines exactly one test. +const pilots = pilotGoldens(input.scenarios) +const mutantPilots = pilots.flatMap((pilot) => { + const mutation = mutants[pilot.id] + return mutation ? [{ ...pilot, mutation }] : [] +}) +const referencePilots = pilots.flatMap((pilot) => { + const reference = referenceStates[pilot.id] + return reference ? [{ ...pilot, reference }] : [] +}) + describe('RPC main recording mutants', () => { - for (const pilot of pilotGoldens(input.scenarios)) { - const { id, scenario } = pilot - const mutation = mutants[id] - if (mutation) { - it(`${id}: kills ${mutation}`, async () => { - const { adapters, assertMutationApplied } = pilotMountAdapters(root, { - mutation: operationMutation(mutation) - }) - const result = await runRecordingMutant( - scenario, - adapters[scenario.operation], - vitestRecordingScheduler(), - readGolden(goldens, id).recording, - visibleState - ) - assertMutationApplied() - expect(result.verdict).toBe('killed') + for (const { id, scenario, mutation } of mutantPilots) { + it(`${id}: kills ${mutation}`, async () => { + const { adapters, assertMutationApplied } = pilotMountAdapters(root, { + mutation: operationMutation(mutation) }) - } - const reference = referenceStates[id] - if (!reference) { - continue - } + const result = await runRecordingMutant( + scenario, + adapters[scenario.operation], + vitestRecordingScheduler(), + readGolden(goldens, id).recording, + visibleState + ) + assertMutationApplied() + expect(result.verdict).toBe('killed') + }) + } + for (const { id, scenario, reference } of referencePilots) { it.skipIf(!process.env.RPC_FOUNDATION_REFERENCE_ROOT)(`${id}: rejects bcba08b3e4`, async () => { const { adapters } = pilotMountAdapters(process.env.RPC_FOUNDATION_REFERENCE_ROOT!, { reference: true