Repository navigation
Preserve initialized source data in TypeScript input witnesses - #570
Open
CaelmBleidd wants to merge 1 commit into
Open
CaelmBleidd wants to merge 1 commit into
CaelmBleidd wants to merge 1 commit into
Conversation
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Concrete entry witnesses currently omit source static fields and module data. Reading those values from the final heap is also incorrect after the target mutates an initializer-created object or array. This change retains a persistent heap view after natural initialization and resolves each touched source data binding from that view, using the same identity cache as the original receiver and arguments.
For example, a static object initialized with
value = 31and changed to92during the target now resolves to31in the entry environment and92in the current environment. Later natural initializers update earlier owners' baseline until user code first observes environment data; initializer-internal accesses do not create target-input bindings.Depends on #561. Review this PR before the concrete Calls candidate consumer (#568).
The materialization boundary is explicit:
resolveInputsrequests source environment data by default; callers can explicitly request original roots only withresolveEnvironment = false.resolvecallers retain their previous inputs/result contract; complete environment resolution is opt-in there.TsUnsupportedEnvironmentWitnessException. Dense arrays and aliases between captured static values are supported.No symbolic state/constraint graph is serialized. These persistent memory views remain in RAM; the downstream consumer writes concrete values.
Validation: 19 selected tests pass (9 new environment regressions, 2 original-input resolver regressions, 3 Globals, 3 StaticFieldTypedWrite, 2 StaticInitializationMarker), with zero skipped or failed tests. Strict TS main/test detekt passes with zero issues. The tests cover initialized primitive/object/dense-array values before and after mutation, module reassignment, alias identity, first lazy initialization, cross-initializer mutation, explicit sparse/interleaved rejection, recording failures that preserve normal returned states, legacy result conversion, and stopped initializers that retain explicit partial roots. Broad suites are left to CI. Native experiment replay and persistence costs are measured in the dependent consumer work.