Skip to content

Commit 6c98393

Browse files
committed
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)
1 parent 447d428 commit 6c98393

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/producer/src/regression-harness.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,25 @@ function discoverTestSuites(
344344
tryAddSuite(entry, dir);
345345
}
346346

347+
// CLI filter, failures/ output, baselines, and the suite summary all key
348+
// off `suite.id`. If a future fixture lands at `tests/distributed/<x>/`
349+
// while a top-level `tests/<x>/` already exists they would silently
350+
// collide: both pushed with the same `id`, both running under one name,
351+
// and the second to write `failures/` overwrites the first. Fail fast
352+
// here naming both source dirs so the conflict is fixable at author time.
353+
const seen = new Map<string, string>();
354+
for (const suite of suites) {
355+
const prior = seen.get(suite.id);
356+
if (prior !== undefined) {
357+
throw new Error(
358+
`[regression-harness] duplicate fixture id ${JSON.stringify(suite.id)}: ` +
359+
`${prior} and ${suite.dir}. Rename one of the directories so the CLI ` +
360+
`--filter, failures/ output, and summary key onto a single suite.`,
361+
);
362+
}
363+
seen.set(suite.id, suite.dir);
364+
}
365+
347366
return suites;
348367
}
349368

0 commit comments

Comments
 (0)