Skip to content

Preserve shared lexical environments in compact EtsIR JSON - #442

Merged
CaelmBleidd merged 3 commits into
neofrom
caelmbleidd/ts-lexical-env-dto-references
Oct 15, 2026
Merged

CaelmBleidd merged 3 commits into
neofrom
caelmbleidd/ts-lexical-env-dto-references

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

The acquired lodash.js dependency expands shared closure-environment types into 755,694,861 JSON characters, exceeding Node's string limit and failing full-project frontend generation with RangeError: Invalid string length.

Serialize complete lexical environments once in a file-local table and use indexed references at their use sites. The Kotlin reader validates references and memoizes conversion to the existing environment model, preserving every captured local and function signature. Legacy inline JSON remains supported; invalid indices and cycles fail explicitly.

Validation:

  • 49 focused frontend checks and TypeScript typecheck passed.
  • 8 focused Kotlin reader/conversion checks passed, including legacy input, sharing, bounds, cycles and context cleanup.
  • The unchanged frozen 569-file real graph generated all 569 JSON files. The offending file shrank to 12,424,070 bytes while preserving 52 classes, 693 methods, 617 environments and all 2,001 captured locals.
  • Actual Kotlin decoding took 394 ms and model conversion 86 ms with -Xmx768m.

No symbolic machine or full test suite was run. Final combined frontend packaging and experiment startup remain separate validation steps.

Diff scope: production changes span 7 files (+179/-9 lines); focused tests and test-consumer helpers span 6 files (+372/-5 lines).

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  248 files  +1    248 suites  +1   16m 16s ⏱️ + 1m 30s
  900 tests +8    888 ✅ +8  12 💤 ±0  0 ❌ ±0 
2 170 runs  +8  2 120 ✅ +8  50 💤 ±0  0 ❌ ±0 

Results for commit 199ebe0. ± Comparison against base commit 1260b68.

♻️ This comment has been updated with latest results.

@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-lexical-env-dto-references branch from 20dfa67 to 199ebe0 Compare October 15, 2026 08:30
@CaelmBleidd
CaelmBleidd merged commit 7db549e into neo Oct 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant