fix(javascript)!: avoid endpoint payload copies in graph metadata (#1423)

Keep exact endpoint observations and request properties while using compact display labels and collision-safe canonical value digests for long artifact-local endpoint keys. Verify real CLI/stdio MCP tracing and version comparison without truncating evidence.

BREAKING CHANGE: New analyses use compact endpoint labels and digest-based IDs for long or reserved-prefix endpoint keys. Select IDs from the parent graph and read full values from endpoint properties. Previously stored graphs retain their original identities and remain valid workflow inputs.
This commit is contained in:
Ysopwnable
2026-10-10 12:02:24 +08:00
committed by GitHub
parent 81cdafc132
commit 98022a8352
4 changed files with 295 additions and 7 deletions
@@ -1,5 +1,6 @@
import { createHash } from "node:crypto";
import { digestCanonicalValue } from "../../domain/canonicalDigest.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";
@@ -162,16 +163,22 @@ 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 label = `${input.value.kind} endpoint`;
const node = context.accumulator.addNode({
kind: "endpoint",
identity: artifactLocalIdentity(
input.file.sha256,
input.value.kind,
input.value.value,
),
identity: artifactLocalIdentity(input.file.sha256, input.value.kind, key),
observations: [
{
label: input.value.value,
label:
input.value.value.length <= label.length ? input.value.value : label,
properties: {
endpoint_kind: input.value.kind,
value: input.value.value,