pineforge-codegen 1.9.1__tar.gz → 1.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/CHANGELOG.md +250 -4
  2. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/CONTRIBUTING.md +13 -5
  3. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/PKG-INFO +13 -3
  4. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/README.md +11 -2
  5. pineforge_codegen-1.11.0/VERSION +1 -0
  6. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/docs/PUBLIC_CONTRACT.md +272 -36
  7. pineforge_codegen-1.11.0/docs/ci.md +191 -0
  8. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/docs/codegen-coverage-gaps.md +48 -41
  9. pineforge_codegen-1.11.0/docs/engine-main-ci.md +339 -0
  10. pineforge_codegen-1.11.0/docs/reference/adding-a-pine-function.md +40 -0
  11. pineforge_codegen-1.11.0/docs/reference/conventions.md +156 -0
  12. pineforge_codegen-1.11.0/docs/reference/file-map.md +186 -0
  13. pineforge_codegen-1.11.0/docs/reference/known-codegen-quirks.md +490 -0
  14. pineforge_codegen-1.11.0/docs/reference/pipeline.md +74 -0
  15. pineforge_codegen-1.11.0/docs/reference/support-contracts.md +340 -0
  16. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/__init__.py +76 -12
  17. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/base.py +2076 -130
  18. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/call_handlers.py +101 -5
  19. pineforge_codegen-1.11.0/pineforge_codegen/analyzer/callable_history_names.py +273 -0
  20. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/contracts.py +19 -1
  21. pineforge_codegen-1.11.0/pineforge_codegen/analyzer/operators.py +276 -0
  22. pineforge_codegen-1.11.0/pineforge_codegen/analyzer/qualifiers.py +444 -0
  23. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/types.py +340 -97
  24. pineforge_codegen-1.11.0/pineforge_codegen/analyzer/value_bindings.py +381 -0
  25. pineforge_codegen-1.11.0/pineforge_codegen/array_binding.py +49 -0
  26. pineforge_codegen-1.11.0/pineforge_codegen/builtin_keywords.py +93 -0
  27. pineforge_codegen-1.11.0/pineforge_codegen/codegen/array_field_width.py +443 -0
  28. pineforge_codegen-1.11.0/pineforge_codegen/codegen/array_slice.py +444 -0
  29. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/base.py +353 -86
  30. pineforge_codegen-1.11.0/pineforge_codegen/codegen/bool_text.py +337 -0
  31. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/capabilities.py +12 -19
  32. pineforge_codegen-1.11.0/pineforge_codegen/codegen/capacities.py +139 -0
  33. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/checked_settings.py +22 -10
  34. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/closed_trade_fold.py +29 -2
  35. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/collection_history.py +25 -4
  36. pineforge_codegen-1.11.0/pineforge_codegen/codegen/color_constants.py +89 -0
  37. pineforge_codegen-1.11.0/pineforge_codegen/codegen/constant_fold.py +341 -0
  38. pineforge_codegen-1.11.0/pineforge_codegen/codegen/constant_values.py +173 -0
  39. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/drawing.py +111 -26
  40. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/emit_top.py +140 -50
  41. pineforge_codegen-1.11.0/pineforge_codegen/codegen/endless_for.py +507 -0
  42. pineforge_codegen-1.11.0/pineforge_codegen/codegen/for_loops.py +17 -0
  43. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/graph_journal.py +3 -11
  44. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/helpers.py +183 -11
  45. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/host_members.py +7 -0
  46. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/input.py +53 -69
  47. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/order_shapes.py +84 -6
  48. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/run_stops.py +40 -0
  49. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/security.py +3163 -204
  50. pineforge_codegen-1.11.0/pineforge_codegen/codegen/strategy_declaration.py +184 -0
  51. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/ta.py +133 -89
  52. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/tables.py +168 -25
  53. pineforge_codegen-1.11.0/pineforge_codegen/codegen/timeframe_values.py +464 -0
  54. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/types.py +2864 -311
  55. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/visit_call.py +690 -260
  56. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/visit_expr.py +478 -112
  57. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/visit_stmt.py +750 -195
  58. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/collection_history.py +26 -15
  59. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/diagnostics_catalog.json +84 -3
  60. pineforge_codegen-1.11.0/pineforge_codegen/drawing_all.py +239 -0
  61. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/errors.py +17 -0
  62. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/external_requests.py +3 -2
  63. pineforge_codegen-1.11.0/pineforge_codegen/function_overloads.py +337 -0
  64. pineforge_codegen-1.11.0/pineforge_codegen/input_keys.py +88 -0
  65. pineforge_codegen-1.11.0/pineforge_codegen/intrinsic_binding.py +166 -0
  66. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/lexer.py +140 -22
  67. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/library_inline.py +5 -0
  68. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/library_modules.py +2 -0
  69. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/limits.py +6 -0
  70. pineforge_codegen-1.11.0/pineforge_codegen/loop_types.py +474 -0
  71. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/method_binding.py +61 -3
  72. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/parser.py +191 -98
  73. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/request_discovery.py +7 -1
  74. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/security_contexts.py +385 -57
  75. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/signatures.py +282 -74
  76. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/support_checker.py +274 -58
  77. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/symbols.py +30 -0
  78. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pyproject.toml +1 -0
  79. pineforge_codegen-1.9.1/VERSION +0 -1
  80. pineforge_codegen-1.9.1/pineforge_codegen/builtin_keywords.py +0 -42
  81. pineforge_codegen-1.9.1/pineforge_codegen/codegen/constant_fold.py +0 -131
  82. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/.gitignore +0 -0
  83. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/LEGAL.md +0 -0
  84. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/LICENSE +0 -0
  85. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/docs/pine-cap-activation.md +0 -0
  86. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/__init__.py +0 -0
  87. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
  88. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/analyzer/tables.py +0 -0
  89. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/ast_nodes.py +0 -0
  90. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/block_locals.py +0 -0
  91. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/__init__.py +0 -0
  92. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/ascii.py +0 -0
  93. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
  94. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/history_sharing.py +0 -0
  95. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/id_sites.py +0 -0
  96. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/session_market.py +0 -0
  97. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
  98. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/cpp_allowlist.py +0 -0
  99. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/cpp_names.py +0 -0
  100. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/diagnostic_codes.py +0 -0
  101. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/finite_ta_length.py +0 -0
  102. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/library_v5.py +0 -0
  103. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/matrix_overloads.py +0 -0
  104. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/pine_libraries.py +0 -0
  105. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/pine_spelling.py +0 -0
  106. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/pragmas.py +0 -0
  107. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/request_feed_inventory.py +0 -0
  108. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/session_reads.py +0 -0
  109. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/timeframe_token_cli.py +0 -0
  110. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/tokens.py +0 -0
  111. {pineforge_codegen-1.9.1 → pineforge_codegen-1.11.0}/pineforge_codegen/tv_input_choices.py +0 -0
@@ -20,6 +20,252 @@ supported as exact pairs; on the 0.x line they are independent. See the
20
20
  the release commit. A prerelease note describes changes since the preceding
21
21
  prerelease or stable tag; the final stable note consolidates the series.
22
22
 
23
+ ## Unreleased (next release)
24
+
25
+ - `str.format_time` now uses TradingView's documented defaults when arguments
26
+ are omitted: `"yyyy-MM-dd'T'HH:mm:ssZ"` for the format and the exchange time
27
+ zone (`syminfo.timezone`) for the timezone. Pass `"yyyy-MM-dd"` and `"UTC"`
28
+ explicitly to restore the previous output. Regenerate C++ and relink
29
+ affected strategies.
30
+ - A `when` argument on a strategy order call in Pine v6 now reports `PF-E2081`,
31
+ explaining that v6 removed the argument and recommending an `if` statement
32
+ around the call. Other unknown keywords keep `PF-E2027`.
33
+ - Pine identifiers spelled like generated state members or helpers use the C++ name allocator, including history-bearing locals in requested helpers.
34
+ - A local declared in a function or method and spelled like a built-in variable now keeps its own type, history storage and reads. Exceptions: a string local spelled like a price field (`open`, `high`, `low`, `close`, `hl2`, `hlc3`, `hlcc4`, `ohlc4`, `volume`) that is read with history in a function requested through `request.security` is still refused, as before; a string local that is read with history and used in a concatenation still does not compile, for any name; the support check still warns that `bar_index`, `last_bar_index` and `timenow` diverge from TradingView at every read of a local with that name; a script that declares the same built-in name in several callable shapes is accepted where an ordinary name is refused by the shared-Series check; and the confirmed-bar request receipt of a request inside the declaring function names the local by its internal storage spelling.
35
+ - History retention can be selected with keyword-only `history_capacity`
36
+ in `transpile()`, `transpile_full()`, `transpile_with_request_inventory()`
37
+ and `gate/glue.py::transpile_json()`. The JavaScript worker template does
38
+ not pass this option. Without a Pine directive, large constant offsets
39
+ infer sufficient bare history and dynamic offsets select this package's
40
+ 5000-slot retention default. Static operator overflow and invalid capacities
41
+ have typed diagnostics. Explicit runtime history bounds
42
+ stop with `pine_runtime_limit` and arguments `limit=max_bars_back`, `max=N`;
43
+ in-capacity warmup reads retain their missing-value behavior. A Pine
44
+ `max_bars_back` larger than `history_capacity` keeps its slots in the
45
+ stores, but the offset checks use `history_capacity` alone. Requested-helper
46
+ history references preserve their C++ members when a helper local or a
47
+ mutable global that the request reads has the same name as one of them.
48
+ Regenerate C++ and relink affected strategies.
49
+ - `drawing_capacity`, accepted by `transpile()`, `transpile_full()`,
50
+ `transpile_with_request_inventory()` and `gate/glue.py::transpile_json()`,
51
+ bounds live lines, boxes and labels independently after
52
+ Pine's existing collection step. Creating or copying beyond the selected
53
+ bound stops with `pine_runtime_limit` and arguments `limit=live_drawings`,
54
+ `max=N`. Pine declaration counts keep their ordinary TradingView collection
55
+ behavior; linefills are outside the bound. Typed stops require the paired
56
+ engine catalog's `live_drawings` value. Omitting the option preserves drawing
57
+ emission and collection. The JavaScript worker template does not pass this
58
+ option. Capacities outside the native int64 domain are refused even for
59
+ scripts without drawings. Regenerate C++ and relink affected strategies.
60
+ - Typed `array.from()` initializers now match their declared element type, including function-local `var` and `varip` arrays of timestamps.
61
+ - Variables initialized from `backadjustment.*`, `settlement_as_close.*` and
62
+ `adjustment.*` constants now use integer storage in emitted C++.
63
+ - `int(x)` of a floating value, and a stored `math.floor(x)`, `math.ceil(x)`
64
+ or `math.round(x)`, is a 64-bit integer whatever its magnitude, as in
65
+ TradingView: `int(1.7e12)`, `int(math.floor(1.7e12))` and
66
+ `v = math.floor(1.7e12)` are all 1700000000000. The generated C++ used to
67
+ read such a value outside the 32-bit range as the integer `na`
68
+ (-2147483648), which then flowed into arithmetic as that number. A value
69
+ that does not fit 64 bits, and a NaN, read `na` on every compiler and
70
+ architecture. A variable, function result, record field or int array that
71
+ holds the result of such an expression is `int64_t`, and a function
72
+ parameter that receives one follows. A 32-bit integer `na` (`int(na)`,
73
+ `bar_index`, a narrow input) that meets one of them in a selection arm, a
74
+ position of a tuple-valued selection, a store or a `request.security`
75
+ payload stays `na` instead of becoming the
76
+ number -2147483648. A history read (`int(x[1])`), a builtin float member
77
+ (`int(strategy.equity)`) and a float field of a record (`int(b.v)`) count as
78
+ floating values too. This changes generated C++ for scripts that use these
79
+ forms: regenerate and relink affected strategies.
80
+ - Repeated explicit input titles now have separate override keys: the first
81
+ keeps the bare title, and later inputs use `<title>#<n>`, starting at 2 and
82
+ skipping authored titles and keys already assigned. The manifest, effective
83
+ settings receipt and input getters use the same keys. The checked input
84
+ setter now accepts the bare title for the first input instead of refusing
85
+ it as ambiguous; the legacy input setter now sets only the first input
86
+ instead of every input with that title. Repeated explicit titles no longer
87
+ trigger the shared-key warning; remaining collisions involving untitled
88
+ fallbacks still warn.
89
+ - A chart TA constructor length that shadows a global input or constant now follows its lexical binding; a series length for `ta.percentile_nearest_rank` now uses the engine's `SeriesPercentileNearestRank` buffer at each call site, including repeated calls from a loop. A call inside a conditional appends only when it runs. `PF-E5092` remains the refusal for a series length of `ta.sma` (#295), and its message names the Pine function (`ta.sma`, not `ta::SMA`) and says that TradingView accepts the call. Every other `ta.*` function keeps `PF-E5009` and its wording, which makes no claim about TradingView: the functions where TradingView refuses a series length too (`ta.rma`, `ta.ema`, `ta.rsi`, `ta.atr`, `ta.dmi`, `ta.macd`, `ta.kc`, `ta.hma`, `ta.tsi`, `ta.rci` and the `atrPeriod` of `ta.supertrend`) and the ones with no recorded result.
90
+ - Constant-expression input defaults can size TA constructors while retaining the input getter in runtime resets (#295).
91
+ - A `request.security` payload may read a global that is an element of a tuple declaration of a pure user function (`[_, g] = pair(x)` with `pair(value) => [value, value + 7.0]`), directly or through a function that reads it: the declaration is evaluated on the requested bar, as in TradingView, and only the element read is lowered. The function must have a one-tuple-literal body over its parameters, the requested bar's fields and literals, and be called positionally with arguments that have no state. A function with a `ta.*` call, `var`, `varip`, a request or a method, a multi-statement body, and the history of an element (`g[1]`) keep their refusals.
92
+ - `line(na)` and `box(na)` emit the same missing handles as typed drawing declarations initialized with `na` (#295).
93
+ - Literal `na` in emitted strategy string parameters uses the empty-string sentinel, including `strategy.exit`'s `from_entry` (#295).
94
+ - Array bindings destructured from a helper's tuple retain their collection type for built-in method calls (#295).
95
+ - `if` and `switch` expressions reassigned to a history-bearing variable update its current Series slot (#295).
96
+ - Pine identifiers `bar` and `HUGE` use the existing C++ name escape without changing authored input titles (#295).
97
+ - Colliding direct scalar history locals in ordinary functions get declaration-owned Series storage and retain separate call-site histories, including computed initializers that read a same-named global and locals of different scalar families (#295).
98
+ - Direct `size`, `first`, `last` and `get` reads of `line.all`, `box.all`, `label.all` and `linefill.all` use live arena order; aliases and mutations raise `PF-E5086`, and `polyline.all` requires engine support (`PF-E5085`) (#295).
99
+ - C++ name escaping covers the macros defined by the audited math, limits, C++ wrapper and paired engine headers, retaining authored input keys (#295).
100
+ - A keyword argument of a built-in call reaches its own parameter. `timeframe.in_seconds(timeframe = ...)` and `timeframe.change(timeframe = ...)` used the chart's timeframe instead of the named one, `strategy.closedtrades.*(trade_num = ...)` and `strategy.opentrades.*(trade_num = ...)` read trade 0 instead of the named trade, `str.format_time(time, timezone = ...)` read the timezone as the format, `timestamp(timezone = ..., year = ..., ...)` dropped the timezone and a skipped `hour` moved `minute` into its slot, `matrix.new<float>(rows = 2, columns = 3)` built a matrix with no rows and no columns, `time("60", timezone = ...)` and `time_close` read the timezone as the session, and `math.random(seed = 3)` read the seed as the minimum; none of them raised a diagnostic. A keyword none of these calls declares is now refused with the unknown-keyword diagnostic, as TradingView refuses it. Regenerate C++ and relink strategies.
101
+ - Strategy order calls report unknown keyword arguments at the keyword
102
+ (#286;
103
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
104
+ - Strategy orders with omitted `qty` use the default size; integer `switch` and
105
+ `if` results with an explicit `na` arm preserve NaN, and
106
+ `strategy.risk.allow_entry_in` retains input-dependent directions (#292).
107
+ - `strategy.risk.max_drawdown()` and `strategy.risk.max_intraday_loss()` called with `type = strategy.percent_of_equity`, or with `strategy.percent_of_equity` held in a variable, apply the percentage limit as the positional form does. The keyword and variable forms were read as an amount of account currency, so a limit of 10 halted trading early (#325, #326, #327). Regenerate C++ and relink strategies.
108
+ - `max_bars_back(series, DEPTH)` with a `const int` `DEPTH` keeps that many bars of history for the series, as the literal depth does. The named constant was ignored, so history reads beyond the default depth returned `na` (#326, #327). Regenerate C++ and relink strategies.
109
+ - A `var` array with a non-empty initializer declared inside an `if` block is initialized when the declaration is first reached, as in TradingView. The generated code reset it to empty and did not apply the initializer, so `array.size` and element reads differed (#333, #327). Regenerate C++ and relink strategies.
110
+ - Methods whose first parameter is never referenced in their body now report `PF-E5087` at that parameter, with a hint to use it or declare a function instead.
111
+ - Consumed `if`/`switch` selections mixing value and void arms now report located `PF-E5088`; requested void selections keep `PF-E3102`.
112
+ - A `request.security` payload that reads the history of an expression inside
113
+ a loop, or at several reads of one helper parameter, commits one history
114
+ slot per requested bar holding the last evaluation of that bar, as
115
+ TradingView does. Every read of the bar sees the history before this bar.
116
+ Regenerate C++ and relink strategies (#287;
117
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
118
+ - `request.security` registers input-derived `lookahead` selections using the
119
+ selected input values, including overrides; choices that depend on bar data
120
+ still report `PF-E1085`. A scalar empty timeframe still uses the chart
121
+ timeframe; an `if`/`switch` timeframe arm known to be empty still reports
122
+ `PF-E3105`.
123
+ History reads of requested values now compile inside another request's TA
124
+ expression, including aliases and repeated reads. Uncalled request wrappers
125
+ no longer interfere with compiling unrelated direct requests (#294;
126
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
127
+ - `input.enum` options named through immutable enum-member declarations now retain their choices and checked-settings support.
128
+ - Array fields in records that stay within one bar preserve omitted and explicit `na` IDs, distinct from empty arrays.
129
+ - Copying a record that stays within one bar shares its array fields while keeping scalar fields independent.
130
+ - A block-local `string` declaration at top level may now shadow a script-level `float` binding with declared or literal types without sharing storage; every other cross-type shadow keeps its existing refusal.
131
+ - A series variable declared or written inside a loop now opens one history
132
+ slot per bar at the first reach and updates it on later iterations, as in
133
+ TradingView. Previously, each iteration opened a separate slot, so `y[i]`
134
+ could read prior iterations instead of prior bars. Expression histories in
135
+ loops also keep one slot per bar, holding its last evaluation. Functions
136
+ read current globals produced by tuple declarations; ordinary `string`
137
+ declarations initialized with `na` reset on each execution; named
138
+ array-constructor arguments bind to `size` and `initial_value`.
139
+ Reassigned ordinary inputs restart from the selected input value at their
140
+ declaration on each bar; `var` and `varip` inputs retain their accumulated
141
+ state. Regenerate C++ and relink strategies
142
+ (#291; [#324](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/324),
143
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
144
+ - Runtime history offsets below 0 or above 10000 stop at the read with an
145
+ error naming the Pine line and offset, before integer narrowing. Constant
146
+ offsets keep their existing behavior (#311;
147
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
148
+ - `timestamp("...")` now accepts full English month names, including
149
+ `"01 February 2024 00:00"`. The existing 64-bit timestamp handling through
150
+ `input.time` and function or tuple results is preserved (#293;
151
+ [#327](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/327)).
152
+ - `timestamp("...")` date strings with a `UTC` or `GMT` zone word now give
153
+ TradingView's value for four forms that differed. A negative zone with a
154
+ zero hour keeps its sign (`GMT-00:30`, `UTC-0:30`). Minutes of 60 or more
155
+ are dropped and the hours kept (`UTC+01:60`, `UTC+00:90`). A number without
156
+ a sign after the word is ignored (`UTC30`, `UTC5`). With a numeric offset
157
+ and a word in one string the last one decides (`+0000 UTC+2`,
158
+ `UTC+2 +0000`). `UTC5` and `UTC+2 +0000` are no longer refused.
159
+ - `timestamp("...")` with a UTC or GMT zone word of 24 hours or more, for
160
+ example `UTC+24`, `GMT-24` or `UTC+25`, now translates instead of stopping
161
+ with an internal `ValueError`. As in TradingView, the zone word is plain
162
+ arithmetic on the date fields: the value is the fields read as UTC minus the
163
+ signed offset.
164
+ - In `//@version=6` scripts and libraries, type field defaults containing calls
165
+ or user-declared variable references now report `PF-E2087` at the default
166
+ expression's first token. V5 sources keep their earlier handling.
167
+ - `strategy.default_entry_qty(fill_price)` reads the engine host's query of the
168
+ default order size at a price (`default_entry_qty`); it used to lower to an
169
+ undeclared function, so a script that used it did not build. It needs an
170
+ engine whose strategy host provides the query. The calls TradingView refuses
171
+ are refused too, at the offending argument or call, also inside the arm of a
172
+ switch: no price, a second price, a price given both by position and by name,
173
+ an unknown argument name (`PF-E1088`), and a string, bool, color or
174
+ collection price (`PF-E2083` to `PF-E2086`, only for a type the syntax proves).
175
+ - PF-W1505 now explains both EMA seeding modes and names the engine run option
176
+ `series_origin_ms`, passed through the run's `syminfo`. The default first-value
177
+ seed matches TradingView charts with history before the range; when the
178
+ reference starts at the range start, declaring its first bar's open time in
179
+ epoch milliseconds selects `na` for the first `length-1` bars followed by an
180
+ SMA seed. This also applies to `ta.macd` and `ta.tsi`; `ta.kc` and `ta.kcw`
181
+ already start that way in every run, because the generated code applies the
182
+ warm-up to their EMA basis. Declared origins
183
+ start `request.security` at the first whole higher-timeframe bucket at or
184
+ after that time, with plain expressions `na` until its first bar completes.
185
+ In a measured 336-exit reference starting at the range start, 37 exit comments
186
+ differ by default, including 5 finite values where TradingView is `na`; none
187
+ differ with the origin declared. Six corpus cases add, drop or shift 1 to 3
188
+ trades in the first days by default; all six are exact with the declared
189
+ origin. A wrong origin gives wrong values; do not set it for live runs, where
190
+ it has no defined meaning. `ta.rsi`, `ta.rma` and `ta.atr` already use SMA
191
+ seeds. Migration: none; undeclared runs are unchanged. The diagnostic stays
192
+ an unconditional note at each `ta.ema` call; this text change leaves generated
193
+ C++ unchanged.
194
+ - An affine chart loop proved endless is stopped with the loop-time error when
195
+ its result reaches an effect. Omission is limited to an unused loop statement
196
+ with no calls, whose writes have no readers except self-updates, a break
197
+ condition or one further unused variable declaration. Other flagged loops
198
+ stop when their result is read in a shape not measured, where TradingView
199
+ may drop them. Endless loops in functions, methods and `request.security`
200
+ still never end here while TradingView stops them; data-dependent endless
201
+ loops still hang.
202
+ - Missing integer values remain `na` in float writes, numeric selections,
203
+ float arguments and arithmetic. Explicit float declarations keep fractional
204
+ values after integer initialization. Regenerate C++ and relink strategies.
205
+
206
+ - Pine v6 calls refuse a positional argument after a named argument with
207
+ `PF-E2074` at that positional expression. The check also covers strategy
208
+ declarations, unused functions and v6 library bodies before lowering.
209
+ - A v6 counted loop whose start has positive int check evidence now refuses a
210
+ float-typed step during translation with `PF-E2079` at the step expression
211
+ and the hint "Use an int step or a float counter." An unknown start with
212
+ a positively float step still selects a float counter.
213
+ - Counted loops can read their own counter in the end and step expressions,
214
+ including when it shadows an outer binding and inside a `request.security`
215
+ helper. The counter now wins over an outer same-named variable. The step is
216
+ read once at counter 0. TradingView measurements establish that direction
217
+ is fixed from the start and the first end read at counter 0, then an end
218
+ that reads this counter is read again at the start before the first
219
+ continuation test. The v6 end also refreshes between iterations. A non-positive
220
+ v6 step stops the run instead of being converted into a positive step.
221
+ This changes generated C++ for explicit-step loops; regenerate and
222
+ relink affected strategies.
223
+ - A v6 counted loop uses a float counter when its start has positive float
224
+ evidence, or when its start is unknown and its step has positive float
225
+ evidence, including inside a `request.security` helper. A start whose value
226
+ has positive int evidence keeps an int counter. Without float evidence, the
227
+ existing int route is unchanged; v5 library loops keep their existing
228
+ int-counter route.
229
+ Counter-family inference follows declaration sources in a dedicated query,
230
+ independently of shared expression and storage inference.
231
+ A division in a loop start keeps its fraction unless it is a constant
232
+ division with an exact integer result, which keeps the int route. The float-step
233
+ refusal follows TradingView's check type (a division of two ints is int).
234
+ - Float-counter loops accumulate the counter by repeated double addition.
235
+ TradingView's measured loop-end rule admits a counter whose excess beyond
236
+ the end, computed as one double subtraction in the loop's direction, is
237
+ strictly below `1e-10`. The named value `kTvFloatStepEnd` is emitted only
238
+ for float-counter loops. Measured on TradingView at the 0.3 scale (counted
239
+ up to a 9.999e-11 shortfall, not counted from 1.0e-10) and at counter
240
+ magnitudes of about 1, 1e3, 1e6 and 1e9; no magnitude-independent constant
241
+ is claimed; not a constant TradingView publishes.
242
+ `0.0 to 0.3 by 0.1` counts four iterations;
243
+ `0.0 to 2999.9999999999 by 1000.0` counts three.
244
+ A positive infinite step exits after one iteration with a finite end
245
+ and needs no non-finite-step guard.
246
+ - Known loop gaps: a float counter passed to
247
+ an untyped helper truncates here, while TradingView passes the fractional
248
+ value (accumulating `twice(x)` from 0.0 to 1.0 by 0.25 gives 2 here and 5
249
+ on TradingView). `array.from(x)` can also truncate a float counter through
250
+ inferred `array<int>` storage. An unknown start from an untyped parameter
251
+ with a positively float step now selects a float counter, independently
252
+ of shared parameter inference. For `f(x)` containing
253
+ `for v = x to 1.0 by 0.25`, TradingView refuses `f(0)` with CE10106 and
254
+ accepts `f(0.0)`. PineForge accepts and runs both with a float counter
255
+ because this inference cannot distinguish their call-argument types;
256
+ refusing the unknown start would also refuse the valid float-argument call.
257
+ Block-local/enclosing-counter bindings and stops inside `request.security`
258
+ have no TradingView tape.
259
+ - A Pine v6 function or method reading a later local without an earlier
260
+ visible binding is refused during analysis at the read (`PF-E2075`),
261
+ using the same declaration-order rule as later globals (`PF-E2053`).
262
+ Reading a loop counter or `for ... in` binder after its loop without
263
+ another visible binding is now refused at translate time (`PF-E2054`);
264
+ these reads were previously accepted.
265
+ TradingView accepts a namespace call after an expired block local with the
266
+ same name; PineForge's analysis no longer refuses it, but code generation
267
+ still rejects some such calls (a known gap).
268
+
23
269
  ## 1.9.1 — 2026-10-31
24
270
 
25
271
  - Translation checks the generated C++ against a fixed allowlist and refuses a
@@ -324,8 +570,8 @@ changes the emitted C++ and the other two only the repository's own CI.
324
570
  contract: the `promote-baseline` workflow refuses untrusted heads and actors
325
571
  (SEC846,
326
572
  [#242](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/242)),
327
- and `test.yml` adopts the organization's CI canon (CR-241,
328
- [#243](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/243)).
573
+ and `test.yml` adopts the organization's CI canon
574
+ ([#243](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/243)).
329
575
 
330
576
  ## 1.6.3 — 2026-10-23
331
577
 
@@ -395,8 +641,8 @@ emitter, a change of the licensor's written entity, and CI changes.
395
641
  - New command `pf-cpp-allowlist` (`pineforge_codegen.cpp_allowlist:main`,
396
642
  installed with the package), a checker for a generated C++ translation unit
397
643
  that flags dangerous primitives
398
- ([#210](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/210),
399
- CR-164 S1). It is a denylist with known false positives, a mitigation and not
644
+ ([#210](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/210)).
645
+ It is a denylist with known false positives, a mitigation and not
400
646
  proof that a unit is safe (the wording of the 1.6.3 security advisory).
401
647
  - A script identifier equal to a symbol that the checker refuses when it appears
402
648
  bare (`system`, `free`, `socket`, `open` and the rest of the list in
@@ -7,6 +7,9 @@ line with `git commit -s`. Material contributions also require a Contributor
7
7
  License Agreement so PINEFORGE LLC can include them in its commercial licenses;
8
8
  contact luis@4pass.com.tw before opening a material pull request.
9
9
 
10
+ Read the [emission invariant](AGENTS.md#emission-invariant) before changing
11
+ the translator: it governs lowerings, refusals and generated-C++ failures.
12
+
10
13
  ## Local setup
11
14
 
12
15
  Use Python 3.11 or newer, Node 22, a C++17 compiler, CMake, and a matching
@@ -196,11 +199,16 @@ declare the environment fails at npm.
196
199
  engine.
197
200
  - Keep [CHANGELOG.md](CHANGELOG.md) current for user-visible changes. Its
198
201
  release-note policy applies to both stable and prerelease tags.
199
- - CI clears a pull request from a fork into `main` only when it changes
200
- documentation or legal text alone (Markdown, `docs/`, `LICENSE`, `NOTICE`).
201
- A fork's code change does not run in CI here: its `gate` check fails until a
202
- maintainer pushes the branch to this repository and opens a pull request
203
- from it, which runs the full gate.
202
+ - Pull request CI requires a non-draft, same-repository PR to `main`, with
203
+ repository write permission for its author, actor and rerunning actor (or a
204
+ fixed allowed bot). Fork PRs, including documentation-only PRs, do not enter
205
+ GKE. A maintainer can push the branch to this repository and open a PR from
206
+ it. Every admitted diff runs the full test matrix and differential gate.
207
+ See [CI admission and check mapping](docs/ci.md) for the hosted authorization
208
+ and result jobs, pod permissions, and operator setup.
209
+ - `test.yml` runs only on push to `main` and manual dispatch. Its `workflow-lint`,
210
+ `package-files` and `pytest` jobs use `gke-8cpu-16gb-amd64`; `authz`, `changes`
211
+ and `test-check` use `ubuntu-24.04`.
204
212
  - The README describes the latest release and becomes the PyPI page of the
205
213
  next release: when a version is tagged, update its "Releases and this
206
214
  README" section, its engine-pairing table and its release markers.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pineforge-codegen
3
- Version: 1.9.1
3
+ Version: 1.11.0
4
4
  Summary: PineScript v6 to C++ transpiler that targets the pineforge-engine runtime.
5
5
  Project-URL: Homepage, https://github.com/pineforge-4pass/pineforge-codegen-oss
6
6
  Project-URL: Issues, https://github.com/pineforge-4pass/pineforge-codegen-oss/issues
@@ -280,6 +280,7 @@ Classifier: Programming Language :: Python :: 3.14
280
280
  Classifier: Topic :: Office/Business :: Financial
281
281
  Requires-Python: >=3.11
282
282
  Provides-Extra: dev
283
+ Requires-Dist: pytest-xdist>=3.5; extra == 'dev'
283
284
  Requires-Dist: pytest>=7.0; extra == 'dev'
284
285
  Description-Content-Type: text/markdown
285
286
 
@@ -641,6 +642,10 @@ gives every field.
641
642
 
642
643
  ### Transpile a file to a `.cpp`
643
644
 
645
+ Missing integers stay `na` when used as floats, including history reads,
646
+ assignments and float parameters. Regenerate C++ and relink strategy libraries
647
+ to apply corrections to previously generated code.
648
+
644
649
  ```python
645
650
  from pathlib import Path
646
651
  from pineforge_codegen import transpile
@@ -690,8 +695,10 @@ lists what 1.0.0 reads, warns about or refuses for such requests.
690
695
  ### Skip the support checker
691
696
 
692
697
  `check_support=False` on either Python function is **experimental**. It
693
- bypasses the gate and can produce C++ the engine will not accept or execute
694
- faithfully:
698
+ bypasses the support gate. Existing paths can produce C++ the engine will
699
+ not accept or execute faithfully; those are defects under the
700
+ [emission invariant](AGENTS.md#emission-invariant), which applies even when
701
+ the gate is bypassed. See the [open defects](docs/codegen-coverage-gaps.md).
695
702
 
696
703
  ```python
697
704
  from pathlib import Path
@@ -730,6 +737,9 @@ fields, such as `// @pf-trace gap=close - e` or
730
737
  pragma itself is not computed: `// @pf-trace rsi=ta.rsi(close, 14)` records
731
738
  `na` on every bar, and its C++ carries an `/* unsupported: ta.rsi */` marker.
732
739
  0.10.4, 1.0.0, 1.0.1, 1.1.0, 1.2.0 and 1.3.0 all behave this way.
740
+ This placeholder is an implementation gap under the
741
+ [emission invariant](AGENTS.md#emission-invariant); see the
742
+ [open defects](docs/codegen-coverage-gaps.md).
733
743
 
734
744
  ### Advanced: run the pipeline stages directly
735
745
 
@@ -356,6 +356,10 @@ gives every field.
356
356
 
357
357
  ### Transpile a file to a `.cpp`
358
358
 
359
+ Missing integers stay `na` when used as floats, including history reads,
360
+ assignments and float parameters. Regenerate C++ and relink strategy libraries
361
+ to apply corrections to previously generated code.
362
+
359
363
  ```python
360
364
  from pathlib import Path
361
365
  from pineforge_codegen import transpile
@@ -405,8 +409,10 @@ lists what 1.0.0 reads, warns about or refuses for such requests.
405
409
  ### Skip the support checker
406
410
 
407
411
  `check_support=False` on either Python function is **experimental**. It
408
- bypasses the gate and can produce C++ the engine will not accept or execute
409
- faithfully:
412
+ bypasses the support gate. Existing paths can produce C++ the engine will
413
+ not accept or execute faithfully; those are defects under the
414
+ [emission invariant](AGENTS.md#emission-invariant), which applies even when
415
+ the gate is bypassed. See the [open defects](docs/codegen-coverage-gaps.md).
410
416
 
411
417
  ```python
412
418
  from pathlib import Path
@@ -445,6 +451,9 @@ fields, such as `// @pf-trace gap=close - e` or
445
451
  pragma itself is not computed: `// @pf-trace rsi=ta.rsi(close, 14)` records
446
452
  `na` on every bar, and its C++ carries an `/* unsupported: ta.rsi */` marker.
447
453
  0.10.4, 1.0.0, 1.0.1, 1.1.0, 1.2.0 and 1.3.0 all behave this way.
454
+ This placeholder is an implementation gap under the
455
+ [emission invariant](AGENTS.md#emission-invariant); see the
456
+ [open defects](docs/codegen-coverage-gaps.md).
448
457
 
449
458
  ### Advanced: run the pipeline stages directly
450
459
 
@@ -0,0 +1 @@
1
+ 1.11.0