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:
@@ -126,9 +126,14 @@ function parseOptionalInteger(raw: string | undefined, flag: string): number | u
|
||||
function parseBackends(raw: string | undefined): Phase0BackendTarget[] {
|
||||
const values = parseCsv(raw) ?? ['pi_embedded', 'native'];
|
||||
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}".`);
|
||||
|
||||
Reference in New Issue
Block a user