fix(producer): detect duplicate fixture IDs across tests/<x>/ and tests/distributed/<x>/

Address @vanceingalls review on #845: the new discoverTestSuites
dispatch was silently allowing a future tests/distributed/<x>/ fixture
to collide with an existing tests/<x>/ fixture of the same name. Both
would push under the same suite.id and stomp each other's failures/
output, baseline lookup, and CLI --filter match.

Detect the collision at discovery time and throw with both source dirs
named, so the conflict is fixable at author time. Easier to enforce now
(one fixture in the new namespace) than after the rest of the Phase 4
fixtures land.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
James
2026-05-14 23:41:51 +00:00
parent 447d428452
commit 6c98393ec9
@@ -344,6 +344,25 @@ function discoverTestSuites(
tryAddSuite(entry, dir);
}
// CLI filter, failures/ output, baselines, and the suite summary all key
// off `suite.id`. If a future fixture lands at `tests/distributed/<x>/`
// while a top-level `tests/<x>/` already exists they would silently
// collide: both pushed with the same `id`, both running under one name,
// and the second to write `failures/` overwrites the first. Fail fast
// here naming both source dirs so the conflict is fixable at author time.
const seen = new Map<string, string>();
for (const suite of suites) {
const prior = seen.get(suite.id);
if (prior !== undefined) {
throw new Error(
`[regression-harness] duplicate fixture id ${JSON.stringify(suite.id)}: ` +
`${prior} and ${suite.dir}. Rename one of the directories so the CLI ` +
`--filter, failures/ output, and summary key onto a single suite.`,
);
}
seen.set(suite.id, suite.dir);
}
return suites;
}