fix: initialize persistent runtime scalars deterministically#65
Merged
Conversation
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.
Outcome
Initialize non-series persistent primitive
varstate at the Pine declaration site when the declaration first executes.if/elseand everyswitchcase/defaultRoot cause
var float macroBearLow = lowin Vasanth VBS previously emitted a bare, uninitialized C++ member. Allocator residue selected one of two trade tapes, and the verifier's offset ladder could therefore change the winningbarIndexOffseteven when neither the Pine source nor the engine changed.With this patch, five independent forced-no-cache verifier processes all produced:
excellent100.0 / 0.00981022391f58ce82d02f5ff7aa15614440d7e565645d5b053d14e060a8f2be6fRegression gates
12/12262/262404 ok + 1 no-trades + 6 transpile + 1 existing run error)346 Excellent / 47 Strong / 4 Moderate / 5 Weak0 UP / 0 DOWNe7cc1def70eadf2d6872cfe0446166195cb732b8736ccdcf6cd3374361cd739fgit diff --check: PASSThe score does not move because the committed Vasanth trade tape already happened to be the correct allocator outcome. This patch removes the undefined behavior and makes that result deterministic without changing any tracked trade tape.