Skip to content

fix: preserve nested callable TA and variable state#94

Merged
luisleo526 merged 5 commits into
mainfrom
codex/propagate-nested-ta-callpaths
Jul 20, 2026
Merged

fix: preserve nested callable TA and variable state#94
luisleo526 merged 5 commits into
mainfrom
codex/propagate-nested-ta-callpaths

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

What changed

  • propagate input-derived TA lengths through nested UDF and UDT-method call chains
  • compose exact TA-site identities when parent and callee source indices differ
  • isolate nested var, fixnan, and synthetic-history state by written call path
  • reject stateful callable recursion before instance expansion
  • add compile/runtime coverage for direct, transitive, crowded, shifted-index, method, and mixed-state paths

Root cause

The flat csN clone namespace assumed that a callee's source-site index matched its enclosing caller's active index. Crowded or transitive call graphs break that assumption, which could select the wrong TA target or share persistent state between distinct Pine call paths. The new propagation records exact edge lineage and emits a fresh nested instance only when the composed state path requires one.

Impact

Pine v6 strategies using forwarded dynamic TA lengths and nested stateful helpers now preserve written-call-site lifecycle semantics. The four affected Standard validation rows generated different C++ but retained identical tiers, metrics, trade counts, and trade tapes, so this correctness milestone is intentionally score-neutral.

Validation

  • full native pytest suite: pass
  • Pyodide parity: 277 fixtures (263 success, 14 expected rejection), pass
  • frozen exact-915 inventory: 903 success / 12 stable expected errors; inventory and result hashes unchanged from the final candidate
  • exhaustive 2^5 interaction matrix: 32/32 cells pass; publication gate GO; all-on exactly matches commit f67563f
  • public engine corpus: 257/257 regenerated, 252/252 built and run; 247 Excellent / 4 Strong / 1 expected anomaly; 252/252 tapes unchanged from the pre-run snapshot
  • controlled native A/B: 4/4 affected Standard strategies have identical trade tapes and zero metric/tier regressions
  • deterministic codegen tests and git diff --check: pass

@luisleo526
luisleo526 merged commit 28f4403 into main Jul 20, 2026
9 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