The test I wrote for PyRIT changes one converter setting at a time and requires the identifier to change. It merged. Then I attacked it the way a bug would: 54 one-line mutations of identifier code, and every one of them passed on main.
Why the samples were too polite
A sample like 3 versus 5 cannot catch code that keeps only part of a value. So the test now tries edge values whenever the constructor accepts them: 0, a negative, a small fraction, a value far above the first, a long string or list that differs only at the end, upper case, a duplicate.
- x or default fails on 0
- abs(x) fails on a negative
- int(x) fails on a fraction
- min(x, 100) fails far above
- x[:256] fails on the long string
- x.lower() fails on upper case
- sorted(set(x)) fails on a duplicate
Every mode, not just the first
Settings were checked under the first sampled value of each bool or strategy mode only. A quality setting lost under lossless=True went unseen. Now every sampled mode is tried, and the edge values come in through one keyword.
- converter_name: str, parameter_name: str, samples: dict[str, tuple[Any, ...]]
+ converter_name: str, parameter_name: str, samples: dict[str, tuple[Any, ...]], *, edges: bool = FalseThe details that hide bugs
One branch of CharSwapConverter kept the old identity for the default 20% and was never reached, so it now gets another proportion. random_seed gets 2 on purpose: it draws the same cell as the default 42, so a dropped seed cannot hide behind payload_index.
The description also lists what it still does not catch: whitespace and accents, a cut in the middle of a value, combinations beyond one mode and one setting. The suite went from 63 s to 71 s on my machine.
What I take from it
A test proves what it samples, nothing more. Before trusting the one I had just merged, I tried to break it, and 54 times it said green. That number is the reason for this pull request.
Ayoub Hammoudi, Software engineer, full-stack and AI platforms. github.com/Ayoubhm07


