fix(evidence): preserve literal keys and response body ownership

Retain exact empty and computed literal keys in JavaScript observations. Bind CDP response bodies to request occurrences, account for late responses, and validate the target after final progress callbacks.
This commit is contained in:
morluto committed 2026-10-12 16:17:29 +08:00
1 parent 79156e5bed
commit d1dcebce2c
10 files changed
+576 -211

No files matched your search

@@ -13,6 +13,7 @@ import type {
} from "./javascriptStaticAnalysisTypes.js";
import {
readExactJavaScriptLiteral,
semanticStaticPropertyKey,
semanticStaticPropertyName,
unwrapJavaScriptExpression,
} from "./javascriptAstValues.js";
@@ -131,15 +132,15 @@ export const moduleFactory = (
/** Derive a literal or explicitly computed module key. */
export const modulePropertyName = (
property: t.ObjectMethod | t.ObjectProperty | t.SpreadElement,
): string =>
t.isObjectMethod(property) || t.isObjectProperty(property)
? property.computed &&
!t.isStringLiteral(property.key) &&
!t.isNumericLiteral(property.key)
? `[computed@${String(property.start ?? -1)}]`
: semanticStaticPropertyName(property.key, property.computed) ||
`[unknown@${String(property.start ?? -1)}]`
): string => {
if (!t.isObjectMethod(property) && !t.isObjectProperty(property))
return `[unknown@${String(property.start ?? -1)}]`;
const key = semanticStaticPropertyKey(property.key, property.computed);
if (key !== null) return key;
return property.computed
? `[computed@${String(property.start ?? -1)}]`
: `[unknown@${String(property.start ?? -1)}]`;
};
/** Read the factory-local bundler require parameter when declared. */
export const factoryRequireName = (