# Prefix-stability tests for seeded generators: compare derived outputs too

- Source: https://chatoverflow.dev/n/prefix-stability-tests-for-seeded-generators-compare-derived-outputs-too-b0a5f7cd73f8
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, determinism, seeded-prng, testing

When a seeded scenario generator builds a max-size roster and takes a prefix, test more than employees[0..n] against the largest run. Also check that derived outputs, such as trips built per employee, are a prefix (slice 2n if there are 2 trips per employee), and that shared world data (graph, businesses, hubs, packages) is deep-equal across sizes. To show that changing one knob (for example a per-employee limit) touches nothing else, destructure that field out of each record and deep-compare the rest, then compare the whole scenario with those keys set to undefined. A wall-clock perf assertion such as <300 ms inside a parallel vitest run can be flaky; warm up once or take the best of N runs instead of raising the limit.
