pineforge-codegen 1.7.0__tar.gz → 1.9.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 (78) hide show
  1. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/CHANGELOG.md +292 -0
  2. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/CONTRIBUTING.md +11 -0
  3. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/PKG-INFO +10 -5
  4. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/README.md +9 -4
  5. pineforge_codegen-1.9.0/VERSION +1 -0
  6. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/docs/PUBLIC_CONTRACT.md +52 -9
  7. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/__init__.py +6 -1
  8. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/base.py +548 -4
  9. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/capabilities.py +8 -0
  10. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/checked_settings.py +13 -1
  11. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/collection_history.py +95 -9
  12. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/emit_top.py +107 -13
  13. pineforge_codegen-1.9.0/pineforge_codegen/codegen/graph_journal.py +540 -0
  14. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/helpers.py +8 -7
  15. pineforge_codegen-1.9.0/pineforge_codegen/codegen/history_sharing.py +222 -0
  16. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/host_members.py +4 -0
  17. pineforge_codegen-1.9.0/pineforge_codegen/codegen/id_sites.py +260 -0
  18. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/input.py +70 -7
  19. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/security.py +705 -55
  20. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/tables.py +160 -33
  21. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/types.py +13 -1
  22. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/visit_call.py +42 -40
  23. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/visit_expr.py +79 -1
  24. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/visit_stmt.py +15 -11
  25. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/collection_history.py +1 -1
  26. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/cpp_allowlist.py +3 -3
  27. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/diagnostics_catalog.json +11 -2
  28. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/lexer.py +62 -2
  29. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/parser.py +76 -14
  30. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/pragmas.py +3 -2
  31. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/signatures.py +18 -0
  32. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/support_checker.py +14 -10
  33. pineforge_codegen-1.7.0/VERSION +0 -1
  34. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/.gitignore +0 -0
  35. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/LEGAL.md +0 -0
  36. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/LICENSE +0 -0
  37. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/docs/codegen-coverage-gaps.md +0 -0
  38. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/docs/pine-cap-activation.md +0 -0
  39. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/__init__.py +0 -0
  40. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/base.py +0 -0
  41. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/call_handlers.py +0 -0
  42. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/contracts.py +0 -0
  43. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
  44. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/tables.py +0 -0
  45. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/analyzer/types.py +0 -0
  46. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/ast_nodes.py +0 -0
  47. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/block_locals.py +0 -0
  48. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/builtin_keywords.py +0 -0
  49. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/__init__.py +0 -0
  50. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/constant_fold.py +0 -0
  51. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/drawing.py +0 -0
  52. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
  53. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/order_shapes.py +0 -0
  54. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/run_stops.py +0 -0
  55. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/session_market.py +0 -0
  56. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/ta.py +0 -0
  57. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
  58. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/diagnostic_codes.py +0 -0
  59. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/errors.py +0 -0
  60. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/external_requests.py +0 -0
  61. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/finite_ta_length.py +0 -0
  62. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/library_inline.py +0 -0
  63. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/library_modules.py +0 -0
  64. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/library_v5.py +0 -0
  65. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/limits.py +0 -0
  66. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/matrix_overloads.py +0 -0
  67. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/method_binding.py +0 -0
  68. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/pine_libraries.py +0 -0
  69. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/pine_spelling.py +0 -0
  70. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/request_discovery.py +0 -0
  71. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/request_feed_inventory.py +0 -0
  72. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/security_contexts.py +0 -0
  73. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/session_reads.py +0 -0
  74. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/symbols.py +0 -0
  75. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/timeframe_token_cli.py +0 -0
  76. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/tokens.py +0 -0
  77. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pineforge_codegen/tv_input_choices.py +0 -0
  78. {pineforge_codegen-1.7.0 → pineforge_codegen-1.9.0}/pyproject.toml +0 -0
@@ -20,6 +20,192 @@ 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 (1.9.0)
24
+
25
+ - Generated closed-trade text comparisons against a NUL-free string literal
26
+ call the engine's in-place closed-trade comparison members, introduced in
27
+ the engine release after `v1.8.0`. Generated C++ using these members builds
28
+ only against that paired engine release. Every other shape keeps its owning
29
+ string emission.
30
+
31
+ ## 1.8.0 — 2026-10-29
32
+
33
+ Planned as 1.8.0, a minor release of the exact engine/codegen pair, paired with
34
+ engine `v1.8.0`. This entry records what changed in this repository since
35
+ 1.7.0 and nothing else: the behaviour changes, the CHANGELOG-only change and
36
+ the fixes that ship in the same release. The behaviour changes alter the
37
+ published input manifest, the emitted C++ for scripts that read
38
+ `strategy.account_currency`, have a persistent declaration whose initializer
39
+ depends on earlier statements, have a helper-local `var color` or a
40
+ `request.security` rollback hook, use a pivot-levels helper or an array or
41
+ matrix history read, bind `fclose`, have a calendar timestamp lambda whose body
42
+ identifiers collide with requested-context bindings, or use
43
+ `calc_on_order_fills` with growing primitive arrays, maps or matrices, and the
44
+ accepted input (line endings, one-line field assignments, an unevaluated
45
+ `request.currency_rate`).
46
+
47
+ ### Compatibility and migration
48
+
49
+ - Pairs with engine `v1.8.0` exactly. Regenerate strategy C++ with this release
50
+ and relink every strategy library against the engine `v1.8.0` headers and
51
+ `libpineforge.a`, even when the C ABI number is unchanged (README
52
+ [Engine pairing](README.md#engine-pairing)).
53
+ - **Hosts must recognize the new input type `color`.** The input manifest
54
+ (`transpile_full()` and the Pyodide/glue manifest) now reports every
55
+ `input.color` entry as `"type": "color"` with an unsigned packed
56
+ `0xAARRGGBB` integer `default` (`color.red` is `4294063685`, `0xFFF23645`;
57
+ transparency is included), where 1.7.0 and earlier reported `"type": "string"`
58
+ with a Pine-spelling default such as `"color.red"`. A host with a closed list
59
+ of manifest types needs a `color` arm. Treat the default as a number in
60
+ `0..4294967295`: do not parse it as a signed 32-bit integer, and send its
61
+ decimal text to the native setter (`get_input_int64`). A default that cannot
62
+ be folded to a constant keeps its previous (null) metadata. `supported`, the
63
+ emitted C++, the native setters and receipts, and the C ABI are unchanged.
64
+ `pineforge-hpo` accepts color inputs from its 1.8.0 release (a packed integer
65
+ in `0..4294967295`, booleans refused).
66
+ - Every generated strategy library gains the two id-sites receipt exports (see
67
+ the entry below); trading code is unchanged. Apart from that, the emitted C++
68
+ is intended to change only for the scripts the entries below name: those that
69
+ read `strategy.account_currency`, whose persistent declarations depend on
70
+ earlier statements, with a helper-local `var color`, with a helper that reads
71
+ the history of a derived argument, with a pivot-levels helper or an array or
72
+ matrix history read, that bind `fclose`, with a calendar timestamp lambda
73
+ whose body identifiers collide with requested-context bindings, or with a
74
+ `request.security` (for the late-restore change alone, only the
75
+ generated `restore_script_state()` changes, in 72 of the 555 corpus and
76
+ fixture scripts; the other entries change the scripts they name). This is
77
+ the design intent of the pull requests and their tests, not a byte
78
+ comparison of generated C++ against 1.7.0. Nine diagnostic codes are added
79
+ (`PF-E3093`, the refusal for a helper-local `var` of an unsupported type, and
80
+ `PF-E3094` through `PF-E3101`, the refusals of a derived helper-argument
81
+ history) and
82
+ the user-facing text of `PF-E1088` and `PF-W1088` is reworded; the catalog
83
+ schema is not changed.
84
+ - Engine behavior changes are described in the paired engine's own release
85
+ notes; this entry does not summarize them.
86
+
87
+ ### Changes since 1.7.0
88
+
89
+ - Preserve the calendar timestamp lambda's fixed body when a request
90
+ expression also reads a mutable global, helper local, loop counter or tuple
91
+ element whose name matches a body identifier, including history reads.
92
+ Calendar argument expressions still read their requested-context bindings.
93
+ - Avoid libc name collisions in generated C++: pivot-level helpers use
94
+ `open_price`, array and matrix history helpers use `open_slot`, and authored
95
+ `fclose` names are escaped. Scripts using either helper change only that
96
+ renamed identifier; scripts binding `fclose` change its escaped spelling.
97
+ - Avoid copying growing primitive arrays at each order-fill checkpoint when
98
+ their writes can be tracked completely. Rollback records individual edits;
99
+ bulk operations retain full preimages, and other arrays keep their existing
100
+ snapshots. The generated strategy class of a script that uses this is not
101
+ copyable or movable.
102
+ - Avoid checkpoint copies for isolated primitive maps and matrices with fully
103
+ tracked writes. Sparse writes use individual undo records; bulk mutations
104
+ save at most one full preimage per root between checkpoint or restore
105
+ boundaries. Dense writes switch to that preimage after exhausting the
106
+ element-count budget, preserving key order, matrix shape and handle identity.
107
+ - Reuse unchanged primitive-array history snapshots when every write can be
108
+ tracked, while preserving detached historical values and order-fill rollback.
109
+ The generated strategy class of a script that uses this is not copyable or
110
+ movable.
111
+ - Fix a silent wrong value under `calc_on_order_fills`: a fill recalculation
112
+ that ran after a deferred `request.security` evaluation (for example a late
113
+ margin-call liquidation) restored the strategy checkpoint taken before that
114
+ evaluation and rolled the requested context's own state back (helper-local
115
+ `var` series, requested TA objects, OHLC and expression histories, mutable
116
+ copies and bar-index clocks), while the engine's requested aggregators had
117
+ already advanced. The generated `restore_script_state()` now leaves that
118
+ requested progression alone and still restores the chart's state and the
119
+ merged request results; payloads that keep user calls on the chart's bar
120
+ (the chart-fallback warning) keep their old rollback, and so do the shared
121
+ helper-local `var` series of a script that has such a payload, so the
122
+ late-restore loss is fixed for every script without that warning and not
123
+ for the helper-local state of a script that has it. The emitted C++ changes
124
+ only in that one function; no engine change or ABI change is involved.
125
+ - Initialize a persistent (`var`) UDT, array, map or matrix once at its
126
+ declaration, in statement order, when its initializer reads a value computed
127
+ earlier in the statement walk: an earlier declaration, reassignment, field
128
+ write, collection method or global read by a user helper
129
+ ([#226](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/226)).
130
+ The first-bar preamble previously read the zero default. Emitted C++ changes
131
+ only for scripts with such a dependency; independent constructors and
132
+ callable-local declarations keep their routes. A `varip` declaration with the
133
+ same dependency takes the same route, with its storage and once flag left out
134
+ of the `calc_on_order_fills` rollback checkpoint
135
+ ([#258](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/258)).
136
+ - Raise currency-conversion errors only when `request.currency_rate` is
137
+ evaluated, not when the call merely appears in a branch that never runs
138
+ ([#228](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/228)).
139
+ No currency-rate data feed is added: an evaluated call stops the run with a
140
+ no-data error. Only the diagnostic text of scripts that previously failed to
141
+ translate changes, and the wording of one warning; a call that names its second argument `to = ...` still
142
+ does not parse, as before.
143
+ - Support explicit and inferred helper-local `var color` state in
144
+ `request.security`, preserving persistence, transparency and `na`
145
+ ([#229](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/229)).
146
+ The epoch-width integer and the collection, object and drawing refusals are
147
+ unchanged; the refusal for any other unsupported helper-local `var` type has
148
+ the new code `PF-E3093`.
149
+ - Sample the history of a derived helper argument on the requested context's
150
+ own bars in `request.security`: a helper such as `f(x) => x[1]` called as
151
+ `f(close - open)` now reads the previous value of the argument on the
152
+ requested bars, not the chart's bars
153
+ ([#229](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/229)).
154
+ The argument is sampled through one ring per call site, which the
155
+ late-restore rule above leaves alone with the rest of the requested state.
156
+ Shapes that cannot be sampled are refused with located errors, `PF-E3094`
157
+ through `PF-E3101`: a derived history offset that is not a non-negative
158
+ constant integer, a ring capacity that is not representable, a call that is
159
+ not unconditional, a helper that depends on other helpers' state, history
160
+ composed with helper-result history, a mutable global that cannot be
161
+ replayed, and a parameter whose type or width has no lossless history.
162
+ Direct OHLC and time bindings, builtin forms and method envelopes keep their
163
+ existing lowering.
164
+ - Accept a UDT field assignment (`:=`, `+=`, ...) as the body of a one-line
165
+ function or method, `set(State s) => s.value := 1`, translating like the same
166
+ body on its own indented line
167
+ ([#230](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/230)).
168
+ A plain-name or subscript target in a one-line body keeps its parser error.
169
+ - Fix `input.color` metadata so its default round-trips through the native
170
+ input setter ([#231](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/231),
171
+ [#251](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/251)).
172
+ Python `transpile_full()` and the Pyodide/glue manifest now report
173
+ `type: "color"` and an unsigned packed `0xAARRGGBB` integer default for named
174
+ Pine v6 colors, hex literals and literal `color.new` / `color.rgb`
175
+ expressions, including transparency. Unfoldable defaults retain their previous
176
+ metadata; accepted expressions are unchanged. See the migration note above.
177
+ - Fix `strategy.account_currency` to return the declared constant currency,
178
+ falling back to the symbol currency when omitted or `currency.NONE`, and
179
+ support currency-constant comparisons and string concatenation
180
+ ([#227](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/227),
181
+ [#250](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/250)).
182
+ No currency conversion is added; only the value the script reads changes, so a
183
+ script that branches on `strategy.account_currency` can now take a different
184
+ branch than under 1.7.0.
185
+ - Accept CRLF and lone CR code line endings like LF across the Python and JSON
186
+ translation entry points, preserving generated C++, diagnostics and literal
187
+ string contents
188
+ ([#230](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/230),
189
+ [#252](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/252)).
190
+ This is the line-ending part of #230; a lone `\r` inside a string literal
191
+ stays data. Output for LF sources is unchanged.
192
+ - Report how many order sites create a computed id in one execution of the
193
+ script (not per bar: `calc_on_order_fills` runs the script again after each
194
+ fill). Every generated
195
+ strategy library also defines `strategy_id_sites_api_version()`, which returns
196
+ 1, and `strategy_id_sites_receipt(s, json, capacity, required, error,
197
+ error_capacity)`, beside the order-shapes receipt and with the same buffer
198
+ protocol. Its canonical JSON, `{"strategy":{"ids":{"freshPerBar":K}},"version":1}`,
199
+ counts the lowered `strategy.entry`, `strategy.order` and `strategy.exit` sites
200
+ whose `id` is not a literal, once per static call of the function that holds
201
+ them and once per iteration of a `for` loop with known bounds; a loop without a
202
+ static bound or a recursion around a computed id gives
203
+ `{"strategy":{"ids":{"freshPerBarStatus":"unbounded"}},"version":1}`. The
204
+ emitted C++ of every strategy gains the two exports; trading code is unchanged.
205
+ - Backfill release notes for earlier codegen releases, including the Security
206
+ entry for GHSA-5www-2x9c-mgr6
207
+ ([#248](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/248)).
208
+
23
209
  ## 1.7.0 — 2026-10-25
24
210
 
25
211
  A minor release of the exact engine/codegen pair, paired with engine `v1.7.0`
@@ -91,6 +277,112 @@ changes the emitted C++ and the other two only the repository's own CI.
91
277
  and `test.yml` adopts the organization's CI canon (CR-241,
92
278
  [#243](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/243)).
93
279
 
280
+ ## 1.6.3 — 2026-10-23
281
+
282
+ A patch release of the exact engine/codegen pair, paired with engine `v1.6.3`
283
+ and dated 2026-10-23. This entry records what changed in this repository since
284
+ 1.6.2 and nothing else: one security fix to the emitted C++, merged from a
285
+ private fork (commit `041889818e2206fdf7261574128064fb0b4142ad`), and four pull
286
+ requests that change only the repository's own CI, publishing and documentation.
287
+
288
+ ### Security
289
+
290
+ - Published advisory
291
+ [GHSA-5www-2x9c-mgr6](https://github.com/pineforge-4pass/pineforge-codegen-oss/security/advisories/GHSA-5www-2x9c-mgr6),
292
+ "Codegen can emit C++ calls and type names taken from the input script"
293
+ (severity high, CWE-94). Fixed in 1.6.3 of both packages. The affected
294
+ versions are `pineforge-codegen` from 0.6.4 up to but not including 1.6.3 and
295
+ `@pineforge/codegen-pyodide` from 0.7.0 up to but not including 1.6.3, which
296
+ ships the same Python sources. Images of
297
+ `ghcr.io/pineforge-4pass/pineforge-release` before 1.6.3 contain an affected
298
+ codegen; the 1.6.3 image contains the fixed one. Upgrade to 1.6.3 or later; the
299
+ advisory states the mitigation and the upgrade steps and, like this entry,
300
+ contains no reproduction recipe.
301
+
302
+ ### Compatibility and migration
303
+
304
+ - Scripts that reached the two affected paths are now refused instead of
305
+ transpiled. A call or member that the codegen has no lowering for ends with
306
+ `<name>(...) is not implemented in PineForge runtime.` where it used to be
307
+ written into the emitted C++; a token that is not a type, in a type position
308
+ or inside `<...>`, ends with a located parse error; and `array.new` or
309
+ `array.from` with an undeclared element type is refused with the same
310
+ "not implemented" message. A script that compiled under 1.6.2 can therefore
311
+ fail with a compile or parse error under 1.6.3, and this is the intended
312
+ effect of the fix. For scripts that stay accepted the emitted C++ is unchanged
313
+ except that the default of an enum-typed element is `na<double>()` (a type
314
+ name that is not a declared user type falls back to its slot's default) and
315
+ `format`, `currency` and `order` values are typed `std::string`. A pair change
316
+ requires regenerated C++ and relinked strategy libraries against the paired
317
+ engine release's headers and `libpineforge.a` (README
318
+ [Engine pairing](README.md#engine-pairing)); regenerate any C++ that an
319
+ affected release produced from a script you do not trust.
320
+
321
+ ### Changes since 1.6.2
322
+
323
+ - Run every codegen job on GitHub-hosted runners
324
+ ([#237](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/237)).
325
+ - Publish to npm only by operator dispatch, in the main-only `npm-publish`
326
+ environment
327
+ ([#238](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/238)),
328
+ and state the npm publishing bound as it now exists: both npm jobs run in that
329
+ environment
330
+ ([#240](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/240)).
331
+ - Stop naming a retired private campaign repository in five lines of the
332
+ documentation
333
+ ([#239](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/239)).
334
+
335
+ ## 1.6.2 — 2026-10-21
336
+
337
+ A patch release of the exact engine/codegen pair, paired with engine `v1.6.2`
338
+ and dated 2026-10-21; the prerelease `1.6.2-rc.1` (2026-10-19) pairs with engine
339
+ `v1.6.2-rc.1`. This entry records what changed in this repository since 1.6.1
340
+ and nothing else: a checker for generated C++ and a reserved-name change in the
341
+ emitter, a change of the licensor's written entity, and CI changes.
342
+
343
+ ### Compatibility and migration
344
+
345
+ - New command `pf-cpp-allowlist` (`pineforge_codegen.cpp_allowlist:main`,
346
+ installed with the package), a checker for a generated C++ translation unit
347
+ that flags dangerous primitives
348
+ ([#210](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/210),
349
+ CR-164 S1). It is a denylist with known false positives, a mitigation and not
350
+ proof that a unit is safe (the wording of the 1.6.3 security advisory).
351
+ - A script identifier equal to a symbol that the checker refuses when it appears
352
+ bare (`system`, `free`, `socket`, `open` and the rest of the list in
353
+ `pineforge_codegen/codegen/helpers.py`, `LIBC_RESERVED_NAMES`) is now emitted
354
+ as `pf_safe_<name>` instead of the bare libc name, so the emitted C++ for
355
+ scripts that declare such a name changes.
356
+ - A pair change requires regenerated C++ and relinked strategy libraries against
357
+ the paired engine release's headers and `libpineforge.a` (README
358
+ [Engine pairing](README.md#engine-pairing)).
359
+
360
+ ### Changes since 1.6.1
361
+
362
+ - The licensor entity is written exactly as `PINEFORGE LLC` in `LICENSE`,
363
+ `LEGAL.md` and `CONTRIBUTING.md`
364
+ ([#234](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/234)).
365
+ - CI: Linux x64 jobs on the pf-ci-spot pool
366
+ ([#212](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/212),
367
+ tracked at fragment b240f6d7 in
368
+ [#215](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/215)),
369
+ credentialed release and deploy jobs kept on hosted runners
370
+ ([#214](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/214)), a
371
+ guarded job and a token-free OIDC job to claim the PyPI `tunaxis-codegen` and
372
+ npm `@tunaxis/codegen-pyodide` names with a 0.0.1 placeholder
373
+ ([#216](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/216),
374
+ [#217](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/217)), the
375
+ App-token owner following the repository owner
376
+ ([#221](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/221)),
377
+ the open Dependabot bumps folded and pinned by SHA with the exact release
378
+ ([#223](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/223)),
379
+ superseded pull-request runs of the gate and test workflows cancelled
380
+ ([#225](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/225)),
381
+ `timeout-minutes` dropped from `gate.yml` and `test.yml`
382
+ ([#233](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/233)),
383
+ and the pull-request suite skipped on draft pull requests
384
+ ([#236](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/236)).
385
+
94
386
  ## 1.6.1 — 2026-10-18
95
387
 
96
388
  A patch release of the exact engine/codegen pair, paired with engine `v1.6.1`
@@ -128,6 +128,17 @@ An unmerged close of our own allowed pull request passes the guard with
128
128
  promotion skipped. Manual dispatch requires repository write access, and
129
129
  every other event is refused.
130
130
 
131
+ App-token minting jobs use two main-only GitHub environments: human-dispatched
132
+ release jobs use `release`, with the owner as required reviewer; automatic
133
+ baseline promotion (including its manual re-fire) uses `release-bot`, without
134
+ a reviewer. The `workflow-lint` preflight checks every workflow and requires a
135
+ literal, non-empty job environment for App-token actions or private-key secret
136
+ use, and flags recognizable scripted minting for human review. Keep this change
137
+ in draft until the owner confirms both environments and their same-name secret
138
+ copies exist. For rollback, remove the added `environment:` lines and revert
139
+ their policy pins together; repository-level secret copies remain available
140
+ until the owner deletes them after the dry runs.
141
+
131
142
  ## npm publication (operators)
132
143
 
133
144
  The release and npm publication workflows run on GitHub-hosted runners.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pineforge-codegen
3
- Version: 1.7.0
3
+ Version: 1.9.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
@@ -368,8 +368,9 @@ Give each input a unique title; different `group=` labels do not separate
368
368
  override keys. The paired checked path refuses a shared key and returns a null
369
369
  fingerprint for a completed run of such a script even without an override.
370
370
  The [1.4.0 migration notes](CHANGELOG.md#140--2026-10-08) cover this change,
371
- new refusals of some previously accepted settings, and color's string manifest
372
- versus packed-integer native value. Check stored presets before submitting them.
371
+ new refusals of some previously accepted settings, and that release's color
372
+ metadata mismatch. Current color manifests use `type: "color"` with a packed
373
+ integer default; check stored presets before submitting them.
373
374
  Users of `pineforge-hpo` 0.11.0 must preserve the manifest's number type for
374
375
  each option at its input boundary; see the [known issue](CHANGELOG.md#known-issues-with-consumers).
375
376
 
@@ -528,8 +529,12 @@ not a lossless-string promise. Literal Unicode and escaped backslashes are
528
529
  retained. Run-time arithmetic, `not true` and calendar-part `timestamp` values
529
530
  still have no published default or unfoldable bounds; a folded
530
531
  `timestamp("...")` is a literal. The whole numeric `options` field is omitted
531
- if any choice is unfoldable. Colors retain their Pine spelling and `string`
532
- manifest type, while the checked native setter requires a packed integer.
532
+ if any choice is unfoldable. An `input.color` has manifest `type: "color"` and
533
+ a literal-foldable `default` encoded as an unsigned `0xAARRGGBB` integer:
534
+ `color.red` is `4294063685` (`0xFFF23645`), and `color.new` / `color.rgb` include
535
+ their literal transparency. Preserve that integer and pass its decimal text to
536
+ the native input setter. Releases through 1.7.0 published a `string` type and
537
+ Pine spelling for colors; the generated C++ and other input types are unchanged.
533
538
  The [contract](docs/PUBLIC_CONTRACT.md#input-manifest-and-override-keys) lists
534
539
  these retained limits. The PyPI and Pyodide manifests carry the same fields; no key is
535
540
  renamed or removed, and the changelog lists the values that changed.
@@ -83,8 +83,9 @@ Give each input a unique title; different `group=` labels do not separate
83
83
  override keys. The paired checked path refuses a shared key and returns a null
84
84
  fingerprint for a completed run of such a script even without an override.
85
85
  The [1.4.0 migration notes](CHANGELOG.md#140--2026-10-08) cover this change,
86
- new refusals of some previously accepted settings, and color's string manifest
87
- versus packed-integer native value. Check stored presets before submitting them.
86
+ new refusals of some previously accepted settings, and that release's color
87
+ metadata mismatch. Current color manifests use `type: "color"` with a packed
88
+ integer default; check stored presets before submitting them.
88
89
  Users of `pineforge-hpo` 0.11.0 must preserve the manifest's number type for
89
90
  each option at its input boundary; see the [known issue](CHANGELOG.md#known-issues-with-consumers).
90
91
 
@@ -243,8 +244,12 @@ not a lossless-string promise. Literal Unicode and escaped backslashes are
243
244
  retained. Run-time arithmetic, `not true` and calendar-part `timestamp` values
244
245
  still have no published default or unfoldable bounds; a folded
245
246
  `timestamp("...")` is a literal. The whole numeric `options` field is omitted
246
- if any choice is unfoldable. Colors retain their Pine spelling and `string`
247
- manifest type, while the checked native setter requires a packed integer.
247
+ if any choice is unfoldable. An `input.color` has manifest `type: "color"` and
248
+ a literal-foldable `default` encoded as an unsigned `0xAARRGGBB` integer:
249
+ `color.red` is `4294063685` (`0xFFF23645`), and `color.new` / `color.rgb` include
250
+ their literal transparency. Preserve that integer and pass its decimal text to
251
+ the native input setter. Releases through 1.7.0 published a `string` type and
252
+ Pine spelling for colors; the generated C++ and other input types are unchanged.
248
253
  The [contract](docs/PUBLIC_CONTRACT.md#input-manifest-and-override-keys) lists
249
254
  these retained limits. The PyPI and Pyodide manifests carry the same fields; no key is
250
255
  renamed or removed, and the changelog lists the values that changed.
@@ -0,0 +1 @@
1
+ 1.9.0
@@ -140,6 +140,35 @@ arbitrary order shape is supported in a live run; engine `v1.3.0` does not read
140
140
  Existing capability and confirmed-bar receipts, including their order
141
141
  classifications, remain unchanged.
142
142
 
143
+ Every generated strategy library also defines `strategy_id_sites_api_version()`,
144
+ which returns 1, and
145
+ `strategy_id_sites_receipt(handle, json, capacity, required, error, error_capacity)`,
146
+ beside the order-shapes receipt and with the same checked-settings buffer
147
+ protocol, whether or not the script places orders. Its immutable canonical JSON
148
+ (sorted keys, no whitespace) is `{"strategy":{"ids":{"freshPerBar":K}},"version":1}`,
149
+ where `K` is the number of lowered `strategy.entry`, `strategy.order` and
150
+ `strategy.exit` sites that can create an order id the script computes: sites whose
151
+ `id` is not a literal string. A literal or empty `id` adds nothing, and
152
+ `strategy.close`, `strategy.close_all`, `strategy.cancel`, `strategy.cancel_all` and
153
+ drawings are never counted. A site in a user function or method counts once per
154
+ static call of that function, transitively, so a function called twice from a
155
+ function called twice counts four times. A site in a `for` loop whose start, end
156
+ and step are known when the script is translated counts once per iteration. When a
157
+ `while` or `for ... in` loop, a `for` loop with a computed bound, or a recursive
158
+ call surrounds a computed `id`, the count has no static bound and the JSON is
159
+ `{"strategy":{"ids":{"freshPerBarStatus":"unbounded"}},"version":1}`, with no
160
+ `freshPerBar` key; a count above 4294967295 is reported the same way. A loop that
161
+ holds only literal ids does not make the count unbounded. `K` is an upper bound,
162
+ not an exact count: both arms of a conditional count, a method call counts by the
163
+ method's name, and a function parameter used as an `id` counts as computed. It
164
+ counts sites per execution of the script body, not per bar: the translator cannot bound how often
165
+ the body runs on one bar, because `calc_on_order_fills` (set by the script or by a
166
+ run-time override) runs it again after each fill. A host can size its order-id
167
+ bookkeeping from `K` times the number of executions it expects, and should treat
168
+ the demand as unbounded when `calc_on_order_fills` is on. The receipt describes the compiled script
169
+ and adds metadata only: generated trading code is unchanged, and a host that does
170
+ not look for the export is unaffected.
171
+
143
172
  Version 1 has `version`, `declarations`, `requests`, `requirements` and `unresolved`
144
173
  keys. Declarations include calculation cadence, close execution, magnifier,
145
174
  standard-OHLC fill mode, limit verification, currency and clock settings. Requests
@@ -196,8 +225,10 @@ the 1.3.0 harness used the legacy setters. Some requests that previously
196
225
  returned success now fail before execution: a shared `Period` key set to `"7"`
197
226
  is `setting_rejected` with reason `ambiguous_key`, textual color `"color.blue"`
198
227
  is `expected_integer`, and `"15"` outside choices `[10, 20, 30]` is
199
- `invalid_input_option`. The color manifest's `string` type and Pine-spelling
200
- default do not describe the native setter's packed-integer encoding. Validate
228
+ `invalid_input_option`. The 1.4.0 color manifest's `string` type and Pine-spelling
229
+ default did not describe the native setter's packed-integer encoding. Current
230
+ manifests use `type: "color"` with a packed integer default, as defined under
231
+ [Input manifest and override keys](#input-manifest-and-override-keys). Validate
201
232
  presets against the compiled settings, including types, bounds and options;
202
233
  the checked path also refuses unknown keys and invalid numeric, boolean or
203
234
  enum values. An input with `supported: false` rejects a supplied value with
@@ -454,9 +485,9 @@ errors together with either nonfatal level.
454
485
  ### Input manifest and override keys
455
486
 
456
487
  Each manifest entry has `title` (string), `type` (one of `int`, `float`,
457
- `bool`, `string`, `source`, `enum`), `default` (a literal scalar or `None`) and
458
- `supported` (boolean; the manifests of releases up to 1.3.0 lack it). It may
459
- also have `min`, `max`, `step` numeric values and an `options` list. Since 1.1.0,
488
+ `bool`, `string`, `source`, `enum`, `color`), `default` (a literal scalar or
489
+ `None`) and `supported` (boolean; the manifests of releases up to 1.3.0 lack it).
490
+ It may also have `min`, `max`, `step` numeric values and an `options` list. Since 1.1.0,
460
491
  an `input.symbol` entry also has `kind` equal to `"symbol"`. An optional field
461
492
  is omitted when its argument is absent or cannot be reduced to the supported
462
493
  literal form.
@@ -498,6 +529,22 @@ them identically.
498
529
  - An enum input publishes its `Enum.member` choices in declaration order as
499
530
  `options` and keeps its `Enum.member` `default`, which the receipt encodes as
500
531
  the member's index (map it through the receipt's `option_values`).
532
+ - A color input (`input.color`) has `type: "color"`. Its literal-foldable
533
+ `default` is an unsigned packed `0xAARRGGBB` integer (0 through 4294967295),
534
+ where `AA` is opacity: 255 is opaque and 0 is transparent. Named Pine v6
535
+ constants, hex color literals, and `color.new` / `color.rgb` with literal
536
+ arguments publish the value the generated `get_input_int64` default uses,
537
+ including transparency. For example, `input.color(color.red, "Line color")`
538
+ publishes `{"title":"Line color","type":"color","default":4294063685,"supported":true}`
539
+ (`0xFFF23645`); `color.new(color.red, 50)` publishes `0x80F23645` as an
540
+ integer. Preserve the unsigned value when reading the JSON. Pass its decimal
541
+ representation to the native input setter; a Pine expression such as
542
+ `"color.red"` is not a native input value. This corrects the `string` type and
543
+ Pine-spelling default published through 1.7.0. `supported` and other input
544
+ fields, the emitted C++ and the native receipt's storage type (`int`, 64-bit)
545
+ and historical `kind: "string"` are unchanged. An unfoldable color default
546
+ retains its previous unpublished value (`None`/JSON `null`); accepted default
547
+ expressions are unchanged.
501
548
  - A typed numeric input (`input.int`, `.float`, `.price`, `.time`) publishes
502
549
  numeric `default`, `min`, `max`, `step` and the numeric choices of an
503
550
  `options=[...]` dropdown where the receipt's value is a literal: a signed number (`-2.5`), a named constant (`LEN = 14`,
@@ -515,10 +562,6 @@ them identically.
515
562
  field is omitted when any choice is unfoldable. These gaps are pinned in
516
563
  `tests/test_input_metadata_receipt.py`'s `KNOWN_LIMITS`; its test view maps
517
564
  an absent options field to `[]`, which is not the public manifest shape.
518
- An `input.color`'s
519
- `default` is its Pine spelling (`"color.red"`) and its `type` `string`, where
520
- the receipt holds the packed integer required by the checked native setter.
521
- Do not submit the manifest's Pine-spelling string as a native color value.
522
565
  Apart from the source-input case
523
566
  above, a plain `input(...)` whose default is not a literal is typed
524
567
  `string` with a `None` default.
@@ -26,11 +26,14 @@ def _parse_bounded(pine_source: str, filename: str, budget: TimeBudget | None =
26
26
  ensure_recursion_headroom()
27
27
  check_source_size(pine_source, filename)
28
28
  budget = budget or TimeBudget(filename)
29
+ # Normalize once before the pre-pass; all stages use the lexer's text.
30
+ lexer = Lexer(pine_source, filename=filename, budget=budget)
31
+ pine_source = lexer.source
29
32
  pragmas = extract_pf_trace_pragmas(
30
33
  pine_source, filename=filename, budget=budget,
31
34
  )
32
35
  budget.check(phase=Phase.LEXER)
33
- tokens = Lexer(pine_source, filename=filename, budget=budget).tokenize()
36
+ tokens = lexer.tokenize()
34
37
  budget.check(phase=Phase.LEXER)
35
38
  ast = Parser(tokens, source=pine_source, filename=filename,
36
39
  budget=budget).parse()
@@ -170,6 +173,8 @@ def transpile_full(pine_source: str, *, check_support: bool = True,
170
173
  ``min`` / ``max`` / ``step`` / ``options`` (omitted when the
171
174
  corresponding signature argument is absent or is not a literal the
172
175
  receipt holds); an ``input.symbol`` entry also has ``kind: "symbol"``.
176
+ An ``input.color`` has ``type: "color"`` and an unsigned packed
177
+ ``0xAARRGGBB`` integer default when its color expression is literal-foldable.
173
178
  See :meth:`CodeGen.extract_input_manifest`.
174
179
  - ``strategyParams``: the literal ``strategy(...)`` kwargs the analyzer
175
180
  surfaced (e.g. ``initial_capital``, ``pyramiding``).