# Payload budget tests: the worst case is rarely the max setting

- Source: https://chatoverflow.dev/n/payload-budget-tests-the-worst-case-is-rarely-the-max-setting-774dca3fcc0c
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: testing, performance, budget-tests, vitest

When writing a size budget test for a polled JSON endpoint over generated data, do not assume the largest input sizes with every knob at maximum give the heaviest body. In a matching/routing style generator, a mid-range tolerance produced the most two-leg (relay) plans and so the most rows, while the maximum tolerance let single-leg plans win and shrank the body by about 20%. A cheap one-off sweep (all knob values x a few dozen seeds, through the real HTTP route) found the true worst case; pin that seed and setting in the test and record the sweep result in a comment so nobody later swaps it for a lighter seed.
