Skip to content

Resolve input-derived security timeframes before evaluator setup#56

Merged
luisleo526 merged 1 commit into
mainfrom
fix/security-tf-input-derived
Jul 11, 2026
Merged

Resolve input-derived security timeframes before evaluator setup#56
luisleo526 merged 1 commit into
mainfrom
fix/security-tf-input-derived

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

What

Security timeframe expressions are emitted into configure_security_evaluators(), which runs before the first on_bar(). An input-derived variable sitting inside a BinOp/UnaryOp/FuncCall/ternary condition was rendered as the raw member — still its C++ default at setup — so conditionals like mode=="15" ? "240" : "60" took the wrong branch and registered the wrong timeframe (directly-assigned input vars already resolved; subtree leaves did not). The same defect silently ignored non-default ctx_*_in overrides.

Fix: the timeframe renderer substitutes input-derived leaves anywhere in the tree with their input getter calls; unchanged subtrees return the same object (unaffected output byte-identical). Series-derived timeframe leaves intentionally untouched (documented residual pending an engine-side input-init prologue).

Impact

Exemplar MTF-confluence strategy: gates registered ÷4 too fast → 266 phantom entries; fixed → 307/307 exact TV match (weak 69.5 → excellent 100%), tier-verified in the private sweeps.

Gates (author + independent fresh-context R7, both green)

  • REDs by stash-cycle: 4/5 pre-fix → 9/9 post; full pytest 1489 passed / 1 skipped; corpus compile sweep 254.
  • Differential transpile: 0/23 corpus and 140/143 private security strategies byte-identical; the 2 other changed strategies behavior-neutral at default inputs (verified 353/353 and 13/13, tiers unchanged).
  • Private sweeps: targeted 1 UP (the exemplar, weak→excellent) / 0 DOWN; full 412 inventory stable, 0 residual movement.

🤖 Generated with Claude Code

request.security / request.security_lower_tf timeframe expressions are
emitted into configure_security_evaluators(), which runs once before
the first on_bar(). A timeframe expression whose input-derived variable
sat inside a BinOp, UnaryOp, FuncCall, or ternary CONDITION was
rendered as the raw class member — still its C++ default at that point
— so the conditional took the wrong branch and registered the security
at the wrong timeframe. Directly-assigned input variables already
resolved; the leaf-inside-subtree case did not. The same defect made
the ctx_*_in override condition read the member, silently ignoring
non-default overrides.

The timeframe renderer now substitutes input-derived leaves anywhere in
the expression tree with their input getter calls (known strings fold
to literals; timeframe.period folds to the script timeframe; unchanged
subtrees return the same object, keeping unaffected output
byte-identical). Genuinely per-bar series-derived timeframe leaves are
intentionally left as members — a documented residual pending an
engine-side input-init prologue.

Exemplar: an MTF confluence strategy registered its direction gates one
timeframe level too fast (15/60/1 instead of 60/240/5), firing 266
phantom entries; fixed it converges to an exact 307/307 TV match
(weak 69.5 -> excellent 100). Differential transpile: 0 of 23 corpus
and 140 of 143 private security strategies byte-identical; the other
two changed strategies are behavior-neutral at default inputs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit aa774ff into main Jul 11, 2026
9 checks passed
@luisleo526 luisleo526 deleted the fix/security-tf-input-derived branch July 11, 2026 15:24
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