fix(javascript)!: avoid event payload copies in graph metadata (#1427)

Share the canonical string identity rule with endpoint projection, scope event keys to each emitter, and keep complete event/listener names in properties. Verify real CLI and stdio MCP with large names, registration/removal, distinct emitters, exact name seeds, reserved-prefix values, and unresolved dynamic names.

BREAKING CHANGE: New analyses use digest-based IDs for long or reserved-prefix event names and shorter event/listener display labels. Select IDs from the parent graph and read exact names from event_name properties. Stored graphs and their original IDs remain accepted for semantic tracing.
This commit is contained in:
Ysopwnable
2026-10-10 12:20:05 +08:00
committed by GitHub
parent a9ee2360fd
commit f4a0c1ce95
5 changed files with 196 additions and 12 deletions
@@ -1,6 +1,6 @@
import { createHash } from "node:crypto";
import { digestCanonicalValue } from "../../domain/canonicalDigest.js";
import { compactStringIdentityKey } from "../../domain/compactStringIdentity.js";
import type { ApplicationNode } from "../../domain/javascript/javascriptApplicationGraphSchemas.js";
import type { JavaScriptStaticAnalysis } from "../../domain/javascript/javascriptStaticAnalysisTypes.js";
import type { JavaScriptArtifactFile } from "../../domain/javascript/javascriptArtifactFiles.js";
@@ -163,14 +163,7 @@ const addEndpoint = (
const source =
sourceNodeFor(context, input.file.path, input.value.module_key) ??
input.asset;
const digestPrefix = "value-sha256:";
const valueKey = `${digestPrefix}${digestCanonicalValue(input.value.value, "JavaScript endpoint")}`;
// Reserve the digest prefix so an exact caller value cannot alias a digest key.
const key =
input.value.value.length <= valueKey.length &&
!input.value.value.startsWith(digestPrefix)
? input.value.value
: valueKey;
const key = compactStringIdentityKey(input.value.value);
const label = `${input.value.kind} endpoint`;
const node = context.accumulator.addNode({
kind: "endpoint",