Files
Michał Pierzchała 80b4769230 test(fuzz): structured CLI/Maestro generators that reach command validation and assert error codes (#1781 B2) (#1866)
* test(fuzz): structured CLI/Maestro generators that reach command validation and assert error codes (#1781 B2)

* test(fuzz): pin the rediscovered #1433 excess-positional case and keep numeric flag samples inside their range

* style: apply oxfmt to the new fuzz modules

* perf(fuzz): derive the CLI validation surface lazily so unrelated harness paths keep their startup

* test(fuzz): resolve validation generators in the run path so corpus replay keeps its small module graph

* test(fuzz): weight the CLI budget toward command validation, pin the finite classes as seeds, guard lazy surface derivation

* docs(testing): describe the validation lane's layer split, seed-pinned classes, and PR-time gates

* refactor(fuzz): split the validation generator into CLI and Maestro modules, mirrored in tests

* refactor(fuzz): collapse the flag-shaped mutation classes and seed literals, derive class coverage from declarations

* fix(fuzz): hash every case-generation module in configHash, guarded by an import-closure test

* test(fuzz): assert CLI command and flag-key coverage against the registry, and close the six gaps it found
2026-08-20 08:00:08 +02:00

18 lines
905 B
TypeScript

// Target name to validation generator (#1781 B2).
//
// The one place the two domain generators meet: `generate.ts` asks for a target's cases by name
// and gets the classic mutator when the answer is `undefined`. Keeping the lookup here means
// neither domain module imports the other, and adding a validation target is one line.
import type fc from 'fast-check';
import type { FuzzTargetName } from './target-types.ts';
import { cliValidationArb } from './validation-arbitraries-cli.ts';
import { maestroValidationArb } from './validation-arbitraries-maestro.ts';
/** The generator for a validation target, or `undefined` for the classic targets. */
export function validationArbitraryFor(target: FuzzTargetName): fc.Arbitrary<string> | undefined {
if (target === 'cli-validation') return cliValidationArb;
if (target === 'maestro-validation') return maestroValidationArb;
return undefined;
}