Repository navigation
Compile timeframe.isminutes and timeframe.isseconds when a script uses them as values - #320
luisleo526 wants to merge 4 commits into
Conversation
…r and through history A timeframe.isminutes or timeframe.isseconds flag passed to a user function, or read through history, does not compile today. These rows run each timeframe bool through both shapes on an hourly chart, compare the printed and filled quantity with a Pine reference computed in the same script, and are written before the fix so they fail first. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…so they compile as values These two flags were declared bool but kept string storage, so a function parameter or a history read that received them became a std::string and did not compile. They now take the same bool type as the other timeframe flags; their text conversion still prints true or false. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…wn bars
The new timeframe-flag rows restamp the chart at one-hour steps but reused the one-minute auxiliary feed built for the original fifteen-minute stamps, so the engine rejected the run ("auxiliary request.security bar does not map to a native chart bar") before any row could pass or fail. The hourly fixture now writes its own auxiliary feed: sixty one-minute bars start at every hourly stamp.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The rows restamped the chart at one-hour steps, which put bars outside the 0930-1600 session grid, so the engine refused the run ("auxiliary request.security bar does not map to a native chart bar") before any row could pass or fail, with or without a matching auxiliary feed. The rows now use the fixture's own fifteen-minute chart and auxiliary feed, as the other native rows in this file do. The reference is computed in the same script from the flag itself, so it does not depend on the chart timeframe; on this chart timeframe.isminutes and timeframe.isintraday are true and the other flags are false.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 not verified).
Formal verification. PR-changed functions: 0/1 verified (0 proven, 0 may-equivalent, 0 distinguished) · 1 not verified (1 unsupported).
Not verified on this run: \_visit\_MemberAccess (unsupported).
Graphify review — findings
Drops the VARIABLE_STORAGE_COMPATIBILITY override so timeframe.* member access in Analyzer._visit_MemberAccess resolves only from TIMEFRAME_VARIABLES, with PineType.STRING still the default for any key missing from that table. That removes the stored-as-string path for timeframe.isminutes and timeframe.isseconds, so their type now depends entirely on whether the table registers them as bool. Tests now build their bool list from TIMEFRAME_BOOLS instead of the removed table, and a new native test checks that timeframe predicates passed through a parameter or read from history select and fill the same quantity as the Pine reference.
Worth a look
- timeframe.isminutes/isseconds may fall back to STRING after the compat table was removed —
pineforge_codegen/analyzer/base.py:8286· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 3919 functions depend on the 333 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
_run_native()— 4 callers, 3 callees
Verification — 3919 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 2862 function(s) in the blast radius were not formally verified this run
Cross-repo impact
Cross-repo impact
No cross-repo impact detected among the indexed peer repo(s).
1 peer repo(s) in this group are not yet indexed — cross-repo impact may be incomplete.
Cross-repo linkage is derived (SCIP-moniker matches are sound; name/contract matches are heuristic) and ADVISORY — it never affects this check's conclusion.
Formal verification
Could not verify: Could not verify \_visit\_MemberAccess.
The verifier did not have enough to check \_visit\_MemberAccess, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
· 1 more finding(s) on lines outside this diff (see the check run).
This closes the gap that #319 listed under its known gaps: a
timeframe.isminutesortimeframe.issecondsflag used as a value. No public issue tracks it, so there is noFixesline.timeframe.isminutesandtimeframe.issecondsare Pine bools, and TradingView accepts them anywhere a bool goes. Passing either one to a user function, or reading it through history (flag[1]), did not compile: g++ stopped withcould not convert 'p' from 'std::string' to 'bool'(function argument) orcannot convert 'bool' to 'std::string'(history read).What changes
Cause. The signature registry declares both flags as bool, but a second table (
VARIABLE_STORAGE_COMPATIBILITY, added so that a stored flag kept its generated C++ when bool text conversion was fixed) gave them string storage, and the analyzer looked that table up before the registry. So a parameter that received one of the flags was astd::stringand a history read of one was a string series. The other timeframe flags (isintraday,isdaily, ...) were not in that table and already worked.Change. The table is deleted and the analyzer reads the timeframe variable's type from the registry (
pineforge_codegen/signatures.py,pineforge_codegen/analyzer/base.py: 1 line added, 10 removed). Both flags are now bool everywhere, like the other timeframe flags. No member-name special case, nothing added to any refusal list.str.tostring(timeframe.isminutes)still printstrue/false, directly, stored in a variable, through a function argument and through history.Verification
timeframe.isminutes/timeframe.issecondsas the initializer intest_bool_conditions_keep_complete_reference_cpp) pinned the old string storage that this change removes; 34 skipped more, because the native rows need the engine and skip on this host on both trees (16 new rows, plus 18 from three existing tests that now enumerate all eight timeframe bools instead of two).84120311: 20,522 passed, 235 skipped, 0 failed; compile corpus 312 passed; the parity gate step passes.ifcomputed in the same script from the flag itself. On main plus these rows and no source change, exactly four fail (isminutesandisseconds, parameter and history), with the g++ errors above, and the other twelve pass as controls; on this head all sixteen pass. These rows run on a 15-minute chart and prove that the flags keep their bool type through a parameter and through history; they are not TradingView values.isminutesis true andissecondsis false on a 60-minute chart: quantity 2 for the twoisminutesscripts and 1 for the twoissecondsscripts, so the four rows export two distinct tapes, not four independent datasets); on main none of the four compiles. The text-conversion rows and the input-history rows measured for the previous change are unchanged.timeframe.isminutes(none usestimeframe.isseconds); all 17 translate exactly as before, because none of them passes the flag through a parameter or history. Over a further 188 sources nothing changes either (none of them uses either flag).strategy.ordercomment rows of the previous change give the same result on this head as on main.d129cc03, against the active baseline: PASS, no improvement and no regression. 7,989 probes are comparable and every one is measured on both sides; the hard gate evaluates 1,009 with 0 moves and 0 regressions, the target gate evaluates 6,980 with 0 moves up or down, and no band gains or loses an entrant. The gate verdict is recorded for this engine and codegen pair and reads back as PASS, no-improve-no-regression; advancing the baseline after the merge is a separate step.🤖 Generated with Claude Code