fix(runtime): preserve deterministic context identity
This commit is contained in:
parent
1bd65f68bc
commit
9bd2ac590c
|
|
@ -68,7 +68,11 @@ export const finalizeInspectorCapture = async ({
|
|||
scripts.set(script.script_key, script);
|
||||
}
|
||||
const items = [...scripts.values()].sort((left, right) =>
|
||||
left.script_key.localeCompare(right.script_key),
|
||||
left.script_key < right.script_key
|
||||
? -1
|
||||
: left.script_key > right.script_key
|
||||
? 1
|
||||
: 0,
|
||||
);
|
||||
const contexts = [...state.contexts.values()]
|
||||
.map((context) => ({
|
||||
|
|
@ -77,7 +81,13 @@ export const finalizeInspectorCapture = async ({
|
|||
name: null,
|
||||
origin: context.origin,
|
||||
}))
|
||||
.sort((left, right) => left.context_key.localeCompare(right.context_key));
|
||||
.sort((left, right) =>
|
||||
left.context_key < right.context_key
|
||||
? -1
|
||||
: left.context_key > right.context_key
|
||||
? 1
|
||||
: 0,
|
||||
);
|
||||
return {
|
||||
schema_version: 1,
|
||||
runtime,
|
||||
|
|
@ -132,6 +142,7 @@ const scriptFromDraft = (
|
|||
): JavaScriptRuntimeObservation["scripts"]["items"][number] => {
|
||||
const stable = JSON.stringify({
|
||||
location,
|
||||
execution_context_key: draft.executionContextKey,
|
||||
cdp_hash: draft.cdpHash,
|
||||
length: draft.length,
|
||||
is_module: draft.isModule,
|
||||
|
|
|
|||
|
|
@ -110,7 +110,9 @@ export class V8InspectorProvider implements JavaScriptRuntimeObservationPort {
|
|||
}
|
||||
allowed.push({ ...target, location: decision.location });
|
||||
}
|
||||
allowed.sort((left, right) => left.id.localeCompare(right.id));
|
||||
allowed.sort((left, right) =>
|
||||
left.id < right.id ? -1 : left.id > right.id ? 1 : 0,
|
||||
);
|
||||
const items = allowed
|
||||
.slice(input.offset, input.offset + input.limit)
|
||||
.map(projectTarget);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ export const commitBrowserScenarioNormalization = (
|
|||
...rule,
|
||||
artifacts: [...rule.artifacts].sort(),
|
||||
}))
|
||||
.sort((left, right) => left.rule_id.localeCompare(right.rule_id));
|
||||
.sort((left, right) =>
|
||||
left.rule_id < right.rule_id ? -1 : left.rule_id > right.rule_id ? 1 : 0,
|
||||
);
|
||||
const commitment = { built_in_rules: [...BUILT_IN_RULES], rules };
|
||||
return { ...commitment, sha256: digestCanonicalJson(commitment) };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ export const readinessFinding = (
|
|||
export const readinessFindingOrder = (
|
||||
left: ReadinessFinding,
|
||||
right: ReadinessFinding,
|
||||
): number =>
|
||||
`${left.stage_id}:${left.code}:${left.detail}`.localeCompare(
|
||||
`${right.stage_id}:${right.code}:${right.detail}`,
|
||||
);
|
||||
): number => {
|
||||
const leftKey = `${left.stage_id}:${left.code}:${left.detail}`;
|
||||
const rightKey = `${right.stage_id}:${right.code}:${right.detail}`;
|
||||
return leftKey < rightKey ? -1 : leftKey > rightKey ? 1 : 0;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue