You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(engine): add get_input_source and get_input_color helpers for Pine input mapping #23
Cross-repo blocker for pineforge-codegen #9. Two Pine v6 input variants currently route to wrong/scalar engine getters because no proper helper exists.
Problem: Codegen routes `input.source` to `get_input_double` (scalar). Generated C++ emits e.g. `double src = 0.0; src = get_input_double("Source", current_bar_.close);` — `current_bar_.close` is captured ONCE at the call site, so any downstream `ta.sma(src, 14)` sees the same bar-0 close every bar = frozen scalar instead of a live series.
Required behavior: Engine receives a string key ("open" / "high" / "low" / "close" / "hl2" / etc.) at runtime, resolves to the matching native OHLCV Series reference, returns that reference. If no input override, returns the default series passed in (typically `_s_close`).
Analyzer contract (already enforced in pineforge-codegen): `input.source` defval MUST be a native chart series (open/high/low/close/hl2/hlc3/ohlc4/...). See codegen `_validate_plain_input_source`.
Problem: Codegen routes `input.color` to `get_input_int`. Acceptable for now because the analyzer guard in codegen PR #13 restricts defval to `color.` / `color.new(...)` / `color.rgb(...)` — all of which already lower to packed rgba int32 via `pine_color::new_color`. The semantic gap: the runtime key→value lookup is via string parsing (`std::stoi`) which works for integer literal but is semantically wrong for a color input.
Required behavior: Mirror `get_input_int` but document the value contract as packed rgba (R<<24 | G<<16 | B<<8 | A). Could be the same impl as `get_input_int` with a renamed entry point so codegen can route per-type.
Lower priority than get_input_source — current behavior produces correct values for the constrained defval set.
Out of scope
`input.time` already fixed via `get_input_int64` (PR #22, merged 2026-05-28).
When this lands
After both helpers are in the engine, pineforge-codegen `_input_type_to_getter` (`pineforge_codegen/codegen/input.py:102-122`) routes:
Resolved by #25 (+ codegen pineforge-4pass/pineforge-codegen#18).
get_input_source added: nine base source series (_src_open_.._src_hlcc4_) advanced once per script bar (gated by _src_series_active_), resolves a runtime override string to the matching native series. Codegen routes input.source to it.
get_input_color: intentionally NOT added. The real input.color bug was codegen-side (defval lowered to "0"); fixed there, with input.color routed to get_input_int64 (packed ARGB overflows int32). get_input_int64 already returns the correct value, so a dedicated color getter added no value.
Verification: ctest 45/45 (new test_get_input_source); corpus 231 excellent + 1 anomaly, no regression.
Activity
luisleo526 commentedon May 31, 2026
Resolved by #25 (+ codegen pineforge-4pass/pineforge-codegen#18).
_src_open_.._src_hlcc4_) advanced once per script bar (gated by_src_series_active_), resolves a runtime override string to the matching native series. Codegen routes input.source to it."0"); fixed there, with input.color routed toget_input_int64(packed ARGB overflows int32).get_input_int64already returns the correct value, so a dedicated color getter added no value.Verification: ctest 45/45 (new
test_get_input_source); corpus 231 excellent + 1 anomaly, no regression.docs(probes): design validation probes for input.source / color / sym…
feat: input.source series helper + syminfo tz/session/metadata inject…