fix(audit): dedupe repeated backend CLI selections

Normalize repeated --backend values in phase0 capture/drift scripts so backend lists are unique and deterministic. Architecture/protocol diagrams reviewed; no updates needed for this parsing-only change.
This commit is contained in:
William Valentin
2026-02-27 13:27:35 -08:00
parent 940402729b
commit bfa857f074
3 changed files with 24 additions and 2 deletions
+6 -1
View File
@@ -146,9 +146,14 @@ function parseBackendTargets(raw: string | undefined): Phase0BackendTarget[] | u
return undefined;
}
const parsed: Phase0BackendTarget[] = [];
const seen = new Set<Phase0BackendTarget>();
for (const value of values) {
if (BACKEND_TARGETS.includes(value as Phase0BackendTarget)) {
parsed.push(value as Phase0BackendTarget);
const backend = value as Phase0BackendTarget;
if (!seen.has(backend)) {
parsed.push(backend);
seen.add(backend);
}
continue;
}
throw new Error(`Invalid backend "${value}".`);