fix: close performance evidence and budget gates
This commit is contained in:
@@ -10,6 +10,16 @@ export const aggregateFiveDriveTraces = (runs) => {
|
||||
if (typeof profile !== 'string' || runs.some((run) => run?.schema !== 'drive-trace.v1' || run.profile !== profile)) {
|
||||
throw new Error('All runs must use one drive-trace.v1 profile.');
|
||||
}
|
||||
const identities = runs.map((run) => run.referenceRun);
|
||||
const indexes = identities.map((identity) => identity?.runIndex).sort((left, right) => left - right);
|
||||
if (JSON.stringify(indexes) !== JSON.stringify([1, 2, 3, 4, 5])) {
|
||||
throw new Error('Reference evidence must contain unique run indexes 1 through 5.');
|
||||
}
|
||||
const runIds = new Set(identities.map((identity) => identity?.runId));
|
||||
const digests = new Set(identities.map((identity) => identity?.attestationDigest));
|
||||
if (runIds.size !== 5 || digests.size !== 5 || identities.some((identity) => !/^[a-f0-9]{64}$/u.test(identity?.attestationDigest ?? ''))) {
|
||||
throw new Error('Reference evidence must contain five unique authenticated identities.');
|
||||
}
|
||||
const lcp = runs.map((run) => run.metrics.lcp);
|
||||
const tbt = runs.map((run) => run.metrics.tbt);
|
||||
const everyPerRunBudgetPass = runs.every((run) => Object.values(run.budgetResults).every(Boolean));
|
||||
|
||||
Reference in New Issue
Block a user