pineforge-codegen 1.7.0__tar.gz → 1.8.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.8.0}/CHANGELOG.md +284 -0
  2. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/CONTRIBUTING.md +11 -0
  3. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/PKG-INFO +10 -5
  4. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/README.md +9 -4
  5. pineforge_codegen-1.8.0/VERSION +1 -0
  6. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/docs/PUBLIC_CONTRACT.md +52 -9
  7. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/__init__.py +6 -1
  8. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/base.py +548 -4
  9. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/capabilities.py +8 -0
  10. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/checked_settings.py +13 -1
  11. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/collection_history.py +95 -9
  12. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/emit_top.py +107 -13
  13. pineforge_codegen-1.8.0/pineforge_codegen/codegen/graph_journal.py +540 -0
  14. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/helpers.py +8 -7
  15. pineforge_codegen-1.8.0/pineforge_codegen/codegen/history_sharing.py +222 -0
  16. pineforge_codegen-1.8.0/pineforge_codegen/codegen/id_sites.py +260 -0
  17. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/input.py +70 -7
  18. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/security.py +701 -54
  19. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/tables.py +160 -33
  20. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/types.py +13 -1
  21. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/visit_call.py +30 -32
  22. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/visit_expr.py +26 -1
  23. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/visit_stmt.py +15 -11
  24. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/collection_history.py +1 -1
  25. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/cpp_allowlist.py +3 -3
  26. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/diagnostics_catalog.json +11 -2
  27. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/lexer.py +62 -2
  28. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/parser.py +76 -14
  29. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/pragmas.py +3 -2
  30. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/signatures.py +18 -0
  31. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/support_checker.py +14 -10
  32. pineforge_codegen-1.7.0/VERSION +0 -1
  33. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/.gitignore +0 -0
  34. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/LEGAL.md +0 -0
  35. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/LICENSE +0 -0
  36. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/docs/codegen-coverage-gaps.md +0 -0
  37. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/docs/pine-cap-activation.md +0 -0
  38. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/__init__.py +0 -0
  39. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/base.py +0 -0
  40. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/call_handlers.py +0 -0
  41. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/contracts.py +0 -0
  42. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
  43. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/tables.py +0 -0
  44. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/analyzer/types.py +0 -0
  45. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/ast_nodes.py +0 -0
  46. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/block_locals.py +0 -0
  47. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/builtin_keywords.py +0 -0
  48. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/__init__.py +0 -0
  49. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/constant_fold.py +0 -0
  50. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/drawing.py +0 -0
  51. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
  52. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/host_members.py +0 -0
  53. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/order_shapes.py +0 -0
  54. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/run_stops.py +0 -0
  55. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/session_market.py +0 -0
  56. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/ta.py +0 -0
  57. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
  58. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/diagnostic_codes.py +0 -0
  59. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/errors.py +0 -0
  60. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/external_requests.py +0 -0
  61. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/finite_ta_length.py +0 -0
  62. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/library_inline.py +0 -0
  63. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/library_modules.py +0 -0
  64. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/library_v5.py +0 -0
  65. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/limits.py +0 -0
  66. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/matrix_overloads.py +0 -0
  67. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/method_binding.py +0 -0
  68. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/pine_libraries.py +0 -0
  69. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/pine_spelling.py +0 -0
  70. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/request_discovery.py +0 -0
  71. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/request_feed_inventory.py +0 -0
  72. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/security_contexts.py +0 -0
  73. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/session_reads.py +0 -0
  74. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/symbols.py +0 -0
  75. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/timeframe_token_cli.py +0 -0
  76. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/tokens.py +0 -0
  77. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pineforge_codegen/tv_input_choices.py +0 -0
  78. {pineforge_codegen-1.7.0 → pineforge_codegen-1.8.0}/pyproject.toml +0 -0
@@ -20,6 +20,184 @@ 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
24
+
25
+ Planned as 1.8.0, a minor release of the exact engine/codegen pair, paired with
26
+ engine `v1.8.0`. This entry records what changed in this repository since
27
+ 1.7.0 and nothing else: the behaviour changes, the CHANGELOG-only change and
28
+ the fixes that ship in the same release. The behaviour changes alter the
29
+ published input manifest, the emitted C++ for scripts that read
30
+ `strategy.account_currency`, have a persistent declaration whose initializer
31
+ depends on earlier statements, have a helper-local `var color` or a
32
+ `request.security` rollback hook, use a pivot-levels helper or an array or
33
+ matrix history read, bind `fclose`, have a calendar timestamp lambda whose body
34
+ identifiers collide with requested-context bindings, or use
35
+ `calc_on_order_fills` with growing primitive arrays, maps or matrices, and the
36
+ accepted input (line endings, one-line field assignments, an unevaluated
37
+ `request.currency_rate`).
38
+
39
+ ### Compatibility and migration
40
+
41
+ - Pairs with engine `v1.8.0` exactly. Regenerate strategy C++ with this release
42
+ and relink every strategy library against the engine `v1.8.0` headers and
43
+ `libpineforge.a`, even when the C ABI number is unchanged (README
44
+ [Engine pairing](README.md#engine-pairing)).
45
+ - **Hosts must recognize the new input type `color`.** The input manifest
46
+ (`transpile_full()` and the Pyodide/glue manifest) now reports every
47
+ `input.color` entry as `"type": "color"` with an unsigned packed
48
+ `0xAARRGGBB` integer `default` (`color.red` is `4294063685`, `0xFFF23645`;
49
+ transparency is included), where 1.7.0 and earlier reported `"type": "string"`
50
+ with a Pine-spelling default such as `"color.red"`. A host with a closed list
51
+ of manifest types needs a `color` arm. Treat the default as a number in
52
+ `0..4294967295`: do not parse it as a signed 32-bit integer, and send its
53
+ decimal text to the native setter (`get_input_int64`). A default that cannot
54
+ be folded to a constant keeps its previous (null) metadata. `supported`, the
55
+ emitted C++, the native setters and receipts, and the C ABI are unchanged.
56
+ `pineforge-hpo` accepts color inputs from its 1.8.0 release (a packed integer
57
+ in `0..4294967295`, booleans refused).
58
+ - Every generated strategy library gains the two id-sites receipt exports (see
59
+ the entry below); trading code is unchanged. Apart from that, the emitted C++
60
+ is intended to change only for the scripts the entries below name: those that
61
+ read `strategy.account_currency`, whose persistent declarations depend on
62
+ earlier statements, with a helper-local `var color`, with a helper that reads
63
+ the history of a derived argument, with a pivot-levels helper or an array or
64
+ matrix history read, that bind `fclose`, with a calendar timestamp lambda
65
+ whose body identifiers collide with requested-context bindings, or with a
66
+ `request.security` (for the late-restore change alone, only the
67
+ generated `restore_script_state()` changes, in 72 of the 555 corpus and
68
+ fixture scripts; the other entries change the scripts they name). This is
69
+ the design intent of the pull requests and their tests, not a byte
70
+ comparison of generated C++ against 1.7.0. Nine diagnostic codes are added
71
+ (`PF-E3093`, the refusal for a helper-local `var` of an unsupported type, and
72
+ `PF-E3094` through `PF-E3101`, the refusals of a derived helper-argument
73
+ history) and
74
+ the user-facing text of `PF-E1088` and `PF-W1088` is reworded; the catalog
75
+ schema is not changed.
76
+ - Engine behavior changes are described in the paired engine's own release
77
+ notes; this entry does not summarize them.
78
+
79
+ ### Changes since 1.7.0
80
+
81
+ - Preserve the calendar timestamp lambda's fixed body when a request
82
+ expression also reads a mutable global, helper local, loop counter or tuple
83
+ element whose name matches a body identifier, including history reads.
84
+ Calendar argument expressions still read their requested-context bindings.
85
+ - Avoid libc name collisions in generated C++: pivot-level helpers use
86
+ `open_price`, array and matrix history helpers use `open_slot`, and authored
87
+ `fclose` names are escaped. Scripts using either helper change only that
88
+ renamed identifier; scripts binding `fclose` change its escaped spelling.
89
+ - Avoid copying growing primitive arrays at each order-fill checkpoint when
90
+ their writes can be tracked completely. Rollback records individual edits;
91
+ bulk operations retain full preimages, and other arrays keep their existing
92
+ snapshots. The generated strategy class of a script that uses this is not
93
+ copyable or movable.
94
+ - Avoid checkpoint copies for isolated primitive maps and matrices with fully
95
+ tracked writes. Sparse writes use individual undo records; bulk mutations
96
+ save at most one full preimage per root between checkpoint or restore
97
+ boundaries. Dense writes switch to that preimage after exhausting the
98
+ element-count budget, preserving key order, matrix shape and handle identity.
99
+ - Reuse unchanged primitive-array history snapshots when every write can be
100
+ tracked, while preserving detached historical values and order-fill rollback.
101
+ The generated strategy class of a script that uses this is not copyable or
102
+ movable.
103
+ - Fix a silent wrong value under `calc_on_order_fills`: a fill recalculation
104
+ that ran after a deferred `request.security` evaluation (for example a late
105
+ margin-call liquidation) restored the strategy checkpoint taken before that
106
+ evaluation and rolled the requested context's own state back (helper-local
107
+ `var` series, requested TA objects, OHLC and expression histories, mutable
108
+ copies and bar-index clocks), while the engine's requested aggregators had
109
+ already advanced. The generated `restore_script_state()` now leaves that
110
+ requested progression alone and still restores the chart's state and the
111
+ merged request results; payloads that keep user calls on the chart's bar
112
+ (the chart-fallback warning) keep their old rollback, and so do the shared
113
+ helper-local `var` series of a script that has such a payload, so the
114
+ late-restore loss is fixed for every script without that warning and not
115
+ for the helper-local state of a script that has it. The emitted C++ changes
116
+ only in that one function; no engine change or ABI change is involved.
117
+ - Initialize a persistent (`var`) UDT, array, map or matrix once at its
118
+ declaration, in statement order, when its initializer reads a value computed
119
+ earlier in the statement walk: an earlier declaration, reassignment, field
120
+ write, collection method or global read by a user helper
121
+ ([#226](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/226)).
122
+ The first-bar preamble previously read the zero default. Emitted C++ changes
123
+ only for scripts with such a dependency; independent constructors and
124
+ callable-local declarations keep their routes. A `varip` declaration with the
125
+ same dependency takes the same route, with its storage and once flag left out
126
+ of the `calc_on_order_fills` rollback checkpoint
127
+ ([#258](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/258)).
128
+ - Raise currency-conversion errors only when `request.currency_rate` is
129
+ evaluated, not when the call merely appears in a branch that never runs
130
+ ([#228](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/228)).
131
+ No currency-rate data feed is added: an evaluated call stops the run with a
132
+ no-data error. Only the diagnostic text of scripts that previously failed to
133
+ translate changes, and the wording of one warning; a call that names its second argument `to = ...` still
134
+ does not parse, as before.
135
+ - Support explicit and inferred helper-local `var color` state in
136
+ `request.security`, preserving persistence, transparency and `na`
137
+ ([#229](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/229)).
138
+ The epoch-width integer and the collection, object and drawing refusals are
139
+ unchanged; the refusal for any other unsupported helper-local `var` type has
140
+ the new code `PF-E3093`.
141
+ - Sample the history of a derived helper argument on the requested context's
142
+ own bars in `request.security`: a helper such as `f(x) => x[1]` called as
143
+ `f(close - open)` now reads the previous value of the argument on the
144
+ requested bars, not the chart's bars
145
+ ([#229](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/229)).
146
+ The argument is sampled through one ring per call site, which the
147
+ late-restore rule above leaves alone with the rest of the requested state.
148
+ Shapes that cannot be sampled are refused with located errors, `PF-E3094`
149
+ through `PF-E3101`: a derived history offset that is not a non-negative
150
+ constant integer, a ring capacity that is not representable, a call that is
151
+ not unconditional, a helper that depends on other helpers' state, history
152
+ composed with helper-result history, a mutable global that cannot be
153
+ replayed, and a parameter whose type or width has no lossless history.
154
+ Direct OHLC and time bindings, builtin forms and method envelopes keep their
155
+ existing lowering.
156
+ - Accept a UDT field assignment (`:=`, `+=`, ...) as the body of a one-line
157
+ function or method, `set(State s) => s.value := 1`, translating like the same
158
+ body on its own indented line
159
+ ([#230](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/230)).
160
+ A plain-name or subscript target in a one-line body keeps its parser error.
161
+ - Fix `input.color` metadata so its default round-trips through the native
162
+ input setter ([#231](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/231),
163
+ [#251](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/251)).
164
+ Python `transpile_full()` and the Pyodide/glue manifest now report
165
+ `type: "color"` and an unsigned packed `0xAARRGGBB` integer default for named
166
+ Pine v6 colors, hex literals and literal `color.new` / `color.rgb`
167
+ expressions, including transparency. Unfoldable defaults retain their previous
168
+ metadata; accepted expressions are unchanged. See the migration note above.
169
+ - Fix `strategy.account_currency` to return the declared constant currency,
170
+ falling back to the symbol currency when omitted or `currency.NONE`, and
171
+ support currency-constant comparisons and string concatenation
172
+ ([#227](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/227),
173
+ [#250](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/250)).
174
+ No currency conversion is added; only the value the script reads changes, so a
175
+ script that branches on `strategy.account_currency` can now take a different
176
+ branch than under 1.7.0.
177
+ - Accept CRLF and lone CR code line endings like LF across the Python and JSON
178
+ translation entry points, preserving generated C++, diagnostics and literal
179
+ string contents
180
+ ([#230](https://github.com/pineforge-4pass/pineforge-codegen-oss/issues/230),
181
+ [#252](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/252)).
182
+ This is the line-ending part of #230; a lone `\r` inside a string literal
183
+ stays data. Output for LF sources is unchanged.
184
+ - Report how many order sites create a computed id in one execution of the
185
+ script (not per bar: `calc_on_order_fills` runs the script again after each
186
+ fill). Every generated
187
+ strategy library also defines `strategy_id_sites_api_version()`, which returns
188
+ 1, and `strategy_id_sites_receipt(s, json, capacity, required, error,
189
+ error_capacity)`, beside the order-shapes receipt and with the same buffer
190
+ protocol. Its canonical JSON, `{"strategy":{"ids":{"freshPerBar":K}},"version":1}`,
191
+ counts the lowered `strategy.entry`, `strategy.order` and `strategy.exit` sites
192
+ whose `id` is not a literal, once per static call of the function that holds
193
+ them and once per iteration of a `for` loop with known bounds; a loop without a
194
+ static bound or a recursion around a computed id gives
195
+ `{"strategy":{"ids":{"freshPerBarStatus":"unbounded"}},"version":1}`. The
196
+ emitted C++ of every strategy gains the two exports; trading code is unchanged.
197
+ - Backfill release notes for earlier codegen releases, including the Security
198
+ entry for GHSA-5www-2x9c-mgr6
199
+ ([#248](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/248)).
200
+
23
201
  ## 1.7.0 — 2026-10-25
24
202
 
25
203
  A minor release of the exact engine/codegen pair, paired with engine `v1.7.0`
@@ -91,6 +269,112 @@ changes the emitted C++ and the other two only the repository's own CI.
91
269
  and `test.yml` adopts the organization's CI canon (CR-241,
92
270
  [#243](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/243)).
93
271
 
272
+ ## 1.6.3 — 2026-10-23
273
+
274
+ A patch release of the exact engine/codegen pair, paired with engine `v1.6.3`
275
+ and dated 2026-10-23. This entry records what changed in this repository since
276
+ 1.6.2 and nothing else: one security fix to the emitted C++, merged from a
277
+ private fork (commit `041889818e2206fdf7261574128064fb0b4142ad`), and four pull
278
+ requests that change only the repository's own CI, publishing and documentation.
279
+
280
+ ### Security
281
+
282
+ - Published advisory
283
+ [GHSA-5www-2x9c-mgr6](https://github.com/pineforge-4pass/pineforge-codegen-oss/security/advisories/GHSA-5www-2x9c-mgr6),
284
+ "Codegen can emit C++ calls and type names taken from the input script"
285
+ (severity high, CWE-94). Fixed in 1.6.3 of both packages. The affected
286
+ versions are `pineforge-codegen` from 0.6.4 up to but not including 1.6.3 and
287
+ `@pineforge/codegen-pyodide` from 0.7.0 up to but not including 1.6.3, which
288
+ ships the same Python sources. Images of
289
+ `ghcr.io/pineforge-4pass/pineforge-release` before 1.6.3 contain an affected
290
+ codegen; the 1.6.3 image contains the fixed one. Upgrade to 1.6.3 or later; the
291
+ advisory states the mitigation and the upgrade steps and, like this entry,
292
+ contains no reproduction recipe.
293
+
294
+ ### Compatibility and migration
295
+
296
+ - Scripts that reached the two affected paths are now refused instead of
297
+ transpiled. A call or member that the codegen has no lowering for ends with
298
+ `<name>(...) is not implemented in PineForge runtime.` where it used to be
299
+ written into the emitted C++; a token that is not a type, in a type position
300
+ or inside `<...>`, ends with a located parse error; and `array.new` or
301
+ `array.from` with an undeclared element type is refused with the same
302
+ "not implemented" message. A script that compiled under 1.6.2 can therefore
303
+ fail with a compile or parse error under 1.6.3, and this is the intended
304
+ effect of the fix. For scripts that stay accepted the emitted C++ is unchanged
305
+ except that the default of an enum-typed element is `na<double>()` (a type
306
+ name that is not a declared user type falls back to its slot's default) and
307
+ `format`, `currency` and `order` values are typed `std::string`. A pair change
308
+ requires regenerated C++ and relinked strategy libraries against the paired
309
+ engine release's headers and `libpineforge.a` (README
310
+ [Engine pairing](README.md#engine-pairing)); regenerate any C++ that an
311
+ affected release produced from a script you do not trust.
312
+
313
+ ### Changes since 1.6.2
314
+
315
+ - Run every codegen job on GitHub-hosted runners
316
+ ([#237](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/237)).
317
+ - Publish to npm only by operator dispatch, in the main-only `npm-publish`
318
+ environment
319
+ ([#238](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/238)),
320
+ and state the npm publishing bound as it now exists: both npm jobs run in that
321
+ environment
322
+ ([#240](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/240)).
323
+ - Stop naming a retired private campaign repository in five lines of the
324
+ documentation
325
+ ([#239](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/239)).
326
+
327
+ ## 1.6.2 — 2026-10-21
328
+
329
+ A patch release of the exact engine/codegen pair, paired with engine `v1.6.2`
330
+ and dated 2026-10-21; the prerelease `1.6.2-rc.1` (2026-10-19) pairs with engine
331
+ `v1.6.2-rc.1`. This entry records what changed in this repository since 1.6.1
332
+ and nothing else: a checker for generated C++ and a reserved-name change in the
333
+ emitter, a change of the licensor's written entity, and CI changes.
334
+
335
+ ### Compatibility and migration
336
+
337
+ - New command `pf-cpp-allowlist` (`pineforge_codegen.cpp_allowlist:main`,
338
+ installed with the package), a checker for a generated C++ translation unit
339
+ that flags dangerous primitives
340
+ ([#210](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/210),
341
+ CR-164 S1). It is a denylist with known false positives, a mitigation and not
342
+ proof that a unit is safe (the wording of the 1.6.3 security advisory).
343
+ - A script identifier equal to a symbol that the checker refuses when it appears
344
+ bare (`system`, `free`, `socket`, `open` and the rest of the list in
345
+ `pineforge_codegen/codegen/helpers.py`, `LIBC_RESERVED_NAMES`) is now emitted
346
+ as `pf_safe_<name>` instead of the bare libc name, so the emitted C++ for
347
+ scripts that declare such a name changes.
348
+ - A pair change requires regenerated C++ and relinked strategy libraries against
349
+ the paired engine release's headers and `libpineforge.a` (README
350
+ [Engine pairing](README.md#engine-pairing)).
351
+
352
+ ### Changes since 1.6.1
353
+
354
+ - The licensor entity is written exactly as `PINEFORGE LLC` in `LICENSE`,
355
+ `LEGAL.md` and `CONTRIBUTING.md`
356
+ ([#234](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/234)).
357
+ - CI: Linux x64 jobs on the pf-ci-spot pool
358
+ ([#212](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/212),
359
+ tracked at fragment b240f6d7 in
360
+ [#215](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/215)),
361
+ credentialed release and deploy jobs kept on hosted runners
362
+ ([#214](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/214)), a
363
+ guarded job and a token-free OIDC job to claim the PyPI `tunaxis-codegen` and
364
+ npm `@tunaxis/codegen-pyodide` names with a 0.0.1 placeholder
365
+ ([#216](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/216),
366
+ [#217](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/217)), the
367
+ App-token owner following the repository owner
368
+ ([#221](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/221)),
369
+ the open Dependabot bumps folded and pinned by SHA with the exact release
370
+ ([#223](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/223)),
371
+ superseded pull-request runs of the gate and test workflows cancelled
372
+ ([#225](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/225)),
373
+ `timeout-minutes` dropped from `gate.yml` and `test.yml`
374
+ ([#233](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/233)),
375
+ and the pull-request suite skipped on draft pull requests
376
+ ([#236](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/236)).
377
+
94
378
  ## 1.6.1 — 2026-10-18
95
379
 
96
380
  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.8.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.8.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``).