Skip to content

fix(javascript)!: stop copying literals into semantic metadata - #1407

Merged
kaoru0822-kitauji merged 1 commit into
mainfrom
fix/javascript-literal-identity-size
Oct 10, 2026
Merged

kaoru0822-kitauji merged 1 commit into
mainfrom
fix/javascript-literal-identity-size

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Large JavaScript literals are copied into identity.role_key and the string label as well as properties.value. A source-owned 2.10 MB file with a 1,572,864-character literal produces 7.00 MB CLI JSON and an oversized default MCP response. Commit the canonical JSON value by SHA-256 in the role key and use string literal for the display label. Keep the exact value, binding/property role, artifact hash, source range, Evidence, and literal-query behavior.

Refs #723. This fixes producer-side repetition; the broader discovery/text/structured design remains open. It does not establish the private-bundle crash cause in #1387.

On the same owned fixture, bounded Linux x64:

Surface Before After
Complete CLI JSON 6,999,140 bytes 2,149,559 bytes (69% smaller)
Literal role key 2,031,674 characters 133 characters
String label 2,031,618 characters 14 characters
Default stdio MCP typed receive-budget constraint complete 4,591,550-byte response

Both runs retain the exact literal and the same four semantic nodes/two relations. Node 24.18.0 and 22.22.2 MCP runs verify full value preservation, retained-reference semantic tracing, summary, and subsequent ping. These are serialized-size measurements, not observed model-host token counts or billing.

Validation:

  • npm run test:focused -- tests/boundary/mcp/javascriptLiteralPayload.test.ts src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts tests/boundary/javascriptSemanticTraceEvidence.test.ts: 56 passed; the final E2E also checks typed 1/"1" seeds and the empty string.
  • npm run check:fast.
  • Public CLI accepts the previously produced Evidence and its original literal node ID after this change.
  • No Hopper/Ghidra verification required; static JavaScript analysis and real public CLI/stdio MCP are exercised.

Compatibility: breaking metadata change, marked !. New literal node IDs use value-sha256 role keys; string labels become string literal. Read exact values from properties.value and obtain IDs from the selected parent graph. Existing stored graphs remain valid. Request/output schema shapes, complete Evidence, and text/structured equivalence are preserved; no caps or truncation are added.

Follow-up: the shorter-encoding refinement was not part of this merged head. It is tracked in #1408 to retain short literal keys/labels while preserving the large-payload reduction.

Commit literal values with canonical JSON SHA-256 in semantic role keys
and use a type label for strings. Preserve complete values, provenance and
literal queries while avoiding two payload copies in each string node.

Verify real compiled CLI/default stdio MCP, typed union seeds, empty
strings and trace continuation with a large source-owned fixture.

Refs #723

BREAKING CHANGE: Newly produced semantic literal node IDs use
value-sha256 role keys, and string labels read "string literal". Read exact
values from properties.value and obtain node IDs from the selected parent
graph. Previously stored Evidence and its original IDs remain valid.
@N0zoM1z0 N0zoM1z0 added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 10, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@kaoru0822-kitauji
kaoru0822-kitauji merged commit 8550913 into main Oct 10, 2026
19 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/javascript-literal-identity-size branch October 10, 2026 03:00
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
…to#1407)

Commit literal values with canonical JSON SHA-256 in semantic role keys
and use a type label for strings. Preserve complete values, provenance and
literal queries while avoiding two payload copies in each string node.

Verify real compiled CLI/default stdio MCP, typed union seeds, empty
strings and trace continuation with a large source-owned fixture.

Refs morluto#723

BREAKING CHANGE: Newly produced semantic literal node IDs use
value-sha256 role keys, and string labels read "string literal". Read exact
values from properties.value and obtain node IDs from the selected parent
graph. Previously stored Evidence and its original IDs remain valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants