Skip to content

fix(codegen): bare ta.<prop> read must bind to a LIVE ta site, not a dead one#46

Merged
luisleo526 merged 1 commit into
mainfrom
fix/bare-ta-property-skip-dead-sites
Jul 7, 2026
Merged

fix(codegen): bare ta.<prop> read must bind to a LIVE ta site, not a dead one#46
luisleo526 merged 1 commit into
mainfrom
fix/bare-ta-property-skip-dead-sites

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

Bug

The bare property-read resolver for ta.vwap / argless-implicit-compute TAs (visit_expr.py) picked the first ta_call_sites entry matching _ta_<prop>_, with no dead-code check. When that first site is owned by a never-called (dead) function, its member declaration is pruned by the dead-code pass — so a live bare read referenced an undeclared member → error: use of undeclared identifier.

Exemplar nightowlxtrader-azt: f5()/f15() defined but never called → their ta.vwap sites (_ta_vwap_10/_13) pruned; the live vwap2 = ta.vwap + two request.security(..., ta.vwap, ...) reads all resolved to _ta_vwap_10 → compile-error. (It was carrying a stale old-codegen excellent CSV, masking this.)

Fix

Skip _dead_ta_indices in the resolver → a live read binds to the first live matching site (_ta_vwap_37). Truly-dead sites stay pruned — dead-code elimination preserved.

Verification (fresh-context R7 = GO)

  • Corpus emission byte-identical: 265/265 corpus strategies, SHA-256 HEAD vs parent (swap-sensitivity proven — harness does flag nightowl as changed, so 0-changed is a real negative).
  • pytest 1446 passed incl. the 3 dead-code-elimination regression tests.
  • nightowlxtrader: clang++ exit 0, grades a genuine excellent (was stale).
  • Sentinels (3commas-pol-grid, lukeborgerding) + normal vwap strategies (van007trader-vwap-bands, etc.) byte-identical.

🤖 Generated with Claude Code

…dead one

The bare property-read resolver for ta.vwap / argless-implicit-compute TAs
(visit_expr.py) picked the FIRST ta_call_sites entry whose member matched
`_ta_<prop>_`, with no dead-code check. When the first such site is owned by a
never-called (dead) function, its member declaration is pruned by the dead-code
pass — so a LIVE bare read (top-level or inside request.security) referenced an
undeclared member.

Regression exemplar: nightowlxtrader-azt — `f5()`/`f15()` are defined but never
called (dead), so their `ta.vwap` sites (`_ta_vwap_10`/`_ta_vwap_13`) are pruned;
the live `vwap2 = ta.vwap` and two `request.security(..., ta.vwap, ...)` reads all
resolved to `_ta_vwap_10` → `error: use of undeclared identifier '_ta_vwap_10'`
(compile-error; the strategy was carrying a STALE old-codegen excellent CSV).

Fix: skip `_dead_ta_indices` in the resolver so a live read binds to the first
LIVE matching site (here `_ta_vwap_37`, owner=None). Truly-dead sites stay pruned
— dead-code elimination is preserved.

Corpus emission BYTE-IDENTICAL (265/265 corpus strategies, SHA-256 fix vs base —
no corpus strategy has a dead-owned property site before a live read). pytest
1446 passed. nightowlxtrader now compiles + grades a genuine excellent (was stale).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit cd6cb8b into main Jul 7, 2026
9 checks passed
@luisleo526 luisleo526 deleted the fix/bare-ta-property-skip-dead-sites branch July 7, 2026 13:31
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