Skip to content

Isolate nested UDF state by call path#52

Merged
luisleo526 merged 1 commit into
mainfrom
codex/nested-ta-callsite-state
Jul 10, 2026
Merged

Isolate nested UDF state by call path#52
luisleo526 merged 1 commit into
mainfrom
codex/nested-ta-callsite-state

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

What changed

  • Propagate stateful UDF call-site counts through the full nested call path.
  • Treat TA range and fixnan state as clone-requiring state.
  • Materialize late inherited TA/fixnan variants after call counts settle.
  • Add pure nested-TA and fixnan regressions that pin distinct live state and dispatch.

Root cause

An outer function could be cloned per call site while a nested helper whose only state was math.sum or fixnan remained shared. Multiple consumers then advanced one rolling state instance each bar. In Todrock, both f_tqi variants called f_er_cs0, phase-skewing the 20-bar efficiency-ratio denominator.

Impact

Todrock moves from moderate to strong: canonical match 92.9% → 99.5%, with 421/452 raw TV trades matched, exact prices, and entry/exit p90 at zero. The full campaign gate moves exactly one strategy up and none down, raising excellent+strong from 353 to 354/400.

Validation

  • Full codegen: 1,453 passed / 1 skipped
  • Target transpile and C++ syntax compile: pass
  • Five request-security/fresh-instance sentinel families unchanged
  • Primary engine: 83/83
  • Corpus: 252/252; 239 excellent / 12 strong / 1 anomaly
  • Full scraper sweep: 412; stable 401/1/8/1/1 inventory; 1 up / 0 down
  • Two-stage independent semantic review: GO after persisted target rerun

Reviewed diff SHA-256: 81e797f069ce100737a359214a335f7cc6a76adff303350a2239fb3829315a31

@luisleo526 luisleo526 marked this pull request as ready for review July 10, 2026 09:59
@luisleo526 luisleo526 merged commit 9aa99e4 into main Jul 10, 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