pineforge-codegen 1.0.0__tar.gz → 1.0.1__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 (64) hide show
  1. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/CHANGELOG.md +183 -7
  2. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/CONTRIBUTING.md +9 -8
  3. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/PKG-INFO +83 -60
  4. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/README.md +82 -59
  5. pineforge_codegen-1.0.1/VERSION +1 -0
  6. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/docs/PUBLIC_CONTRACT.md +3 -3
  7. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/docs/pine-cap-activation.md +5 -5
  8. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/base.py +189 -1
  9. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/contracts.py +3 -0
  10. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/types.py +16 -5
  11. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/ast_nodes.py +7 -0
  12. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/base.py +136 -14
  13. pineforge_codegen-1.0.1/pineforge_codegen/codegen/collection_history.py +200 -0
  14. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/emit_top.py +32 -5
  15. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/helpers.py +5 -1
  16. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/security.py +56 -1
  17. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/ta.py +65 -1
  18. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/types.py +136 -8
  19. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/visit_call.py +92 -3
  20. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/visit_expr.py +202 -3
  21. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/visit_stmt.py +19 -4
  22. pineforge_codegen-1.0.1/pineforge_codegen/collection_history.py +1595 -0
  23. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/parser.py +19 -4
  24. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/support_checker.py +37 -0
  25. pineforge_codegen-1.0.0/VERSION +0 -1
  26. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/.gitignore +0 -0
  27. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/LEGAL.md +0 -0
  28. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/LICENSE +0 -0
  29. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/docs/codegen-coverage-gaps.md +0 -0
  30. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/__init__.py +0 -0
  31. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/__init__.py +0 -0
  32. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/call_handlers.py +0 -0
  33. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/diagnostics.py +0 -0
  34. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/analyzer/tables.py +0 -0
  35. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/block_locals.py +0 -0
  36. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/builtin_keywords.py +0 -0
  37. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/__init__.py +0 -0
  38. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/constant_fold.py +0 -0
  39. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/drawing.py +0 -0
  40. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
  41. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/host_members.py +0 -0
  42. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/input.py +0 -0
  43. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/session_market.py +0 -0
  44. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/tables.py +0 -0
  45. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/codegen/tv_number_format.py +0 -0
  46. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/errors.py +0 -0
  47. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/external_requests.py +0 -0
  48. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/finite_ta_length.py +0 -0
  49. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/lexer.py +0 -0
  50. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/library_inline.py +0 -0
  51. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/library_modules.py +0 -0
  52. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/library_v5.py +0 -0
  53. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/limits.py +0 -0
  54. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/method_binding.py +0 -0
  55. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/pine_libraries.py +0 -0
  56. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/pine_spelling.py +0 -0
  57. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/pragmas.py +0 -0
  58. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/security_contexts.py +0 -0
  59. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/session_reads.py +0 -0
  60. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/signatures.py +0 -0
  61. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/symbols.py +0 -0
  62. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/tokens.py +0 -0
  63. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pineforge_codegen/tv_input_choices.py +0 -0
  64. {pineforge_codegen-1.0.0 → pineforge_codegen-1.0.1}/pyproject.toml +0 -0
@@ -20,15 +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
- ## 1.0.0 — Unreleased
23
+ ## 1.0.1 — 2026-10-02
24
24
 
25
- This is the proposed 1.0 release note. It covers the changes merged to `main`
25
+ A patch release of translation fixes. It covers the changes merged to `main`
26
+ since 1.0.0:
27
+ [#156](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/156) and
28
+ [#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)
29
+ change the translation, and
30
+ [#154](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/154) and
31
+ [#155](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/155)
32
+ the documentation. Codegen `1.0.1` supports only engine `v1.0.1`. Engine
33
+ `v1.0.1` changes only documentation since `v1.0.0`, so the pair keeps C ABI
34
+ version 4 and the script ABI epoch `engine_script_run_v19`.
35
+
36
+ ### Compatibility and migration
37
+
38
+ - Regenerate C++ with 1.0.1 and relink it against engine `v1.0.1`'s headers
39
+ and `libpineforge.a`. A pair change requires it, even though the C ABI
40
+ number is unchanged.
41
+ - The Python and JSON contract is unchanged: `transpile()`,
42
+ `transpile_full()` and `gate/glue.py`'s `transpile_json` keep their
43
+ arguments, result keys and envelopes. No report key changes: the engine's
44
+ JSON report keeps the keys it had with 1.0.0, `metrics.equity.sharpe_tv`
45
+ and `sortino_tv` included.
46
+ - The engine's 325 public corpus sources and this repository's 277 gate
47
+ fixtures transpile to the same C++ as with 1.0.0, byte for byte (the 13
48
+ fixtures the gate expects to be refused are refused with the same message),
49
+ and so do the 1,384 real-world strategy sources the two pull requests
50
+ measured, transpiled in fresh processes.
51
+ - Some scripts that 1.0.0 transpiled are refused now, each with the code
52
+ TradingView's compiler refuses it with. Among them are an array's history
53
+ used as an operand or as a value (`a[1] + 1`, `c.push(a[1])`: CE10123),
54
+ which 1.0.0 read, with a warning, as an element of the current array, and
55
+ a method straight after a history read (`m[1].get(0, 0)`: CE10011), which
56
+ is written `(m[1]).get(0, 0)`. "Refused at compile time" below lists them
57
+ all.
58
+
59
+ ### History of user-defined objects and drawings
60
+
61
+ 1.0.0 emitted C++ that did not compile for the history of an object: it
62
+ declared a variable of a user-defined type or a drawing type whose history
63
+ was read `Series<double>`
64
+ ([#156](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/156)).
65
+
66
+ - `obj[k]` is the reference the variable held k bars back, `na` before the
67
+ first, and `(obj[k]).field` reads that object as it is now, as on
68
+ TradingView, for boxes, lines and labels too. This holds for globals, `var`
69
+ objects, block and function locals, function parameters and method
70
+ receivers, and a drawing parameter's or receiver's history takes its
71
+ built-in methods (`(this[1]).get_top()`).
72
+ - In a function, a method and an `if` block the history counts the executions
73
+ of the scope. At a call site that skips bars, a function's object
74
+ parameter keeps one slot per chart bar, as TradingView does; a typed
75
+ method's receiver does not yet (see "Not covered" below).
76
+ - A temporary drawing passed to a drawing parameter compiles: a history read,
77
+ a new drawing or chart point, or a call's result.
78
+ - The history of an expression whose value is an object (`o.inner[1]`,
79
+ `f()[1]`, `(c ? a : b)[1]`) is the reference it produced at its previous
80
+ evaluation. Below a lazy edge, such as a `?:` arm, a read that is safe to
81
+ evaluate (a pure or constructor call over pure arguments, a ternary over
82
+ names, a named object's field) is kept on every bar, as TradingView keeps
83
+ it.
84
+ - `==` / `!=` compare two lines or two labels by identity, `na` included.
85
+
86
+ ### History of arrays and matrices
87
+
88
+ 1.0.0 emitted C++ that did not compile for the history of an array or a
89
+ matrix, such as `(a[1]).size()`, `array.size(a[1])` and `(m[1]).get(0, 0)`
90
+ ([#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)).
91
+
92
+ - `a[k]` of an array or matrix variable, top-level or a block's local, is a
93
+ read-only copy of the collection as the variable left it at the end of its
94
+ scope's execution k executions back: the bar k bars back for a top-level
95
+ variable, the block's previous run for a block's local. A built-in reads
96
+ it, `na()` tests it, a variable or a function argument can hold it, and
97
+ `matrix.copy(m[1])` has the variable's element type. A `for...in` loop over
98
+ `a[1]` iterates the array the variable holds now, as on TradingView.
99
+ - Two sibling blocks that declare the same name keep a history each.
100
+ - A change to the copy, to a slice of it, or through a variable or parameter
101
+ bound to it stops the run with TradingView's runtime error RE10051. A method
102
+ on it before the variable has a history stops the run with RE10052 for an
103
+ array and RE10053 for a matrix.
104
+
105
+ ### Int values in float fields
106
+
107
+ From [#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157):
108
+
109
+ - `Cell.new(v = bar_index)`, a non-constant int given to a `float` field of a
110
+ user-defined type, compiles: the int converts to a double and an int `na`
111
+ to `na`. 1.0.0 narrowed it in a braced initializer, which did not compile.
112
+ - A value that came out silently wrong: `c.v := iv`, an int assigned to a
113
+ `float` field, stored an int `na` as -2147483648; it now stores `na`, as
114
+ TradingView does. On the `uassign_float` tape 112 of 336 exits differed
115
+ before.
116
+ - A bool given to a `float` field converts to 1 or 0 and is never `na`.
117
+ TradingView refuses a bool there (CE10123 in a constructor, CE10173 in an
118
+ assignment).
119
+
120
+ ### Refused at compile time
121
+
122
+ A located `CompileError` now refuses, with TradingView's error code, what
123
+ TradingView's compiler refuses
124
+ ([#156](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/156),
125
+ [#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)):
126
+
127
+ - a field or method straight after the history operator: `c[1].v` (CE10011),
128
+ `b[1].get_top()` (CE10010), `a[1].size()` (CE10011). The parenthesized
129
+ `(c[1]).v` is the valid spelling;
130
+ - the history of a field: a value field (`c.v[1]`, `(c.v)[1]`) and an
131
+ object's array, matrix or map field (`h.xs[1]`, `(h.xs)[1]`), CE10290;
132
+ - `==` / `!=` of references other than lines and labels (CE10123), and of a
133
+ reference with `na` (CE10187);
134
+ - an array's history where a number, a condition, a string or an element is
135
+ expected: an operator's operand, `nz`, `math.*`, a value slot of an array
136
+ function (`c.push(a[1])`, `array.new<float>(2, a[1])`), `log.*`'s message,
137
+ `label.new`'s text and `str.tostring` of a color array (CE10123); a scalar
138
+ variable or field (CE10173); an `if` or `while` condition (CE10101);
139
+ `array.from`, and `str.format` of a color array (CE10122); a bare statement
140
+ at the top level (CE10009).
141
+
142
+ Refused by name, where TradingView compiles the script; none of these
143
+ compiled under 1.0.0:
144
+
145
+ - the history of an object or a drawing inside a `request.security`
146
+ expression (TradingView reads the requested timeframe's objects, which
147
+ PineForge does not keep), and the history of a `chart.point` variable whose
148
+ fields the script changes (PineForge holds a point as a value)
149
+ ([#156](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/156));
150
+ - an array or matrix history read whose earlier lowering did not compile,
151
+ but for the two gaps below
152
+ ([#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)).
153
+
154
+ ### Not covered
155
+
156
+ - A typed method's receiver at a call site that skips bars counts calls,
157
+ where TradingView keeps one slot per chart bar: from the third call on,
158
+ `this[2]` reads three bars further back
159
+ ([#156](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/156)).
160
+ - The history of a function's array or matrix parameter or local, of a call's
161
+ result and of a selection is not kept (TradingView keeps one per call). Such
162
+ a read keeps 1.0.0's lowering where that compiled, and is refused otherwise
163
+ ([#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)).
164
+ - Two kinds of history read keep the C++ they had, which does not compile: an
165
+ element function's value of a string array's history where the earlier
166
+ lowering is kept (in a function, a method, a loop or a block `var`), such
167
+ as `f() => str.length(array.first(s[1]))`; and the history of a variable or
168
+ a call that the analyzer does not type as an array or a matrix (a method's
169
+ or `matrix.row`'s new array, a selection of arrays, a tuple's element, an
170
+ array of drawings)
171
+ ([#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)).
172
+ - PineForge holds no `na` array: a variable bound to a history before the
173
+ variable has one holds an empty array where TradingView's is `na`, and one
174
+ the script also tests with `na()` is refused
175
+ ([#157](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/157)).
176
+ - As in 1.0.0, these do not compile: an int from `matrix.rows()`,
177
+ `columns()`, `elements_count()` or `strategy.wintrades` given to a `float`
178
+ field; `matrix.sum(m1, m2)` and other matrix results used without a
179
+ declared type; a method called on an operator expression
180
+ (`(close * 2).m()`). `str.tostring` of an array is not lowered.
181
+
182
+ ### Documentation
183
+
184
+ - The README, the changelog and the docs describe the 1.0.0 release
185
+ ([#154](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/154)),
186
+ and the README calls no version the latest
187
+ ([#155](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/155)).
188
+ PyPI shows each release's README as its description, so 1.0.1's PyPI page
189
+ shows the README of the `v1.0.1` tag; 1.0.0's keeps the one it was uploaded
190
+ with.
191
+
192
+ ## 1.0.0 — 2026-09-30
193
+
194
+ This is the 1.0 release note. It covers the changes merged to `main`
26
195
  since 0.10.4 (2026-09-06), through
27
- [#152](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/152). The
28
- release lane sets the version and date after the matching engine release is
29
- ready. Codegen `1.0.0` supports only engine `v1.0.0`; `1.0.0-rc.1` supports
30
- only engine `v1.0.0-rc.1`. Until then, `main` builds only against engine
31
- `main`. The notes of 0.10.4 and earlier releases are on the
196
+ [#152](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/152);
197
+ [#153](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/153)
198
+ then updated the documentation. Codegen `1.0.0` supports only engine
199
+ `v1.0.0`; `1.0.0-rc.1` supports only engine `v1.0.0-rc.1`. The notes of
200
+ 0.10.4 and earlier releases are on the
32
201
  [GitHub releases page](https://github.com/pineforge-4pass/pineforge-codegen-oss/releases).
33
202
 
34
203
  ### Compatibility and execution
@@ -243,3 +412,10 @@ only engine `v1.0.0-rc.1`. Until then, `main` builds only against engine
243
412
  pairing, contribution checks, and release-note policy. Classify the package
244
413
  as Production/Stable for the 1.0 release
245
414
  ([#140](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/140)).
415
+
416
+ ## 1.0.0-rc.1 — 2026-09-30
417
+
418
+ The release candidate for 1.0.0. Its changes since 0.10.4 are the ones listed
419
+ under 1.0.0; 1.0.0 changed only the version after it. It shipped as PyPI
420
+ `1.0.0rc1`, on npm dist-tag `next` and as a GitHub prerelease, and supports
421
+ only engine `v1.0.0-rc.1`.
@@ -47,12 +47,13 @@ before treating a run as complete.
47
47
 
48
48
  ## Engine pairing
49
49
 
50
- Codegen `main` is developed and tested against engine `main`; its generated
51
- C++ does not compile against any engine release yet. On the 0.x line the two
52
- version lineages are independent: the released codegen 0.10.4 pairs with
53
- engine `v0.13.1`, the pair the
50
+ Codegen `main` is developed and tested against engine `main`. Codegen 1.0.1
51
+ pairs with engine `v1.0.1`, the pair the
54
52
  [`pineforge-release`](https://github.com/pineforge-4pass/pineforge-release)
55
- image `v0.1.25` ships.
53
+ image `1.0.1` ships, and codegen 1.0.0 with engine `v1.0.0`, the pair of the
54
+ image `1.0.0`. On the 0.x line the two version lineages are independent:
55
+ the last 0.x release, codegen 0.10.4, pairs with engine `v0.13.1`, the pair
56
+ the `pineforge-release` image `0.1.25` ships.
56
57
 
57
58
  From 1.0.0 on, a released codegen `X.Y.Z` is supported only with engine tag
58
59
  `vX.Y.Z`, using that release's generated headers and `libpineforge.a`.
@@ -114,6 +115,6 @@ publishing is a separate release operation.
114
115
  engine.
115
116
  - Keep [CHANGELOG.md](CHANGELOG.md) current for user-visible changes. Its
116
117
  release-note policy applies to both stable and prerelease tags.
117
- - The README describes `main` against the latest release and becomes the PyPI
118
- page of the next one: when a version is tagged, update its "Releases and
119
- this README" section, its engine-pairing table and its release markers.
118
+ - The README describes the latest release and becomes the PyPI page of the
119
+ next release: when a version is tagged, update its "Releases and this
120
+ 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.0.0
3
+ Version: 1.0.1
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
@@ -234,12 +234,19 @@ runtime.
234
234
 
235
235
  In the maintainers' parity baseline of 2026-09-29
236
236
  (`pineforge-parity-baseline-20260929-engine-35db01c8`, evidence snapshot
237
- `47cec517…`), `main` of this repository (70c2b4a) with engine `main`
238
- (35db01c8) graded 7,905 of 7,989 TradingView probes excellent and the other 84
239
- strong, with none below strong and no engine errors; 17 more probes are held
240
- out as TradingView-side anomalies. A probe is a
237
+ `47cec517…`), this repository at 70c2b4a with engine 35db01c8
238
+ graded 7,905 of 7,989 TradingView probes excellent and the other 84
239
+ strong, with none below strong; 17 more probes are held out as
240
+ TradingView-side anomalies. A probe is a
241
241
  strategy exported from TradingView with its trade list and replayed trade for
242
- trade on the same bars. These are `main` results, not a release's. The
242
+ trade on the same bars. The baseline predates the 1.0.0 and 1.0.1 releases.
243
+ The 1.0.0 releases changed no grade: codegen 1.0.0 has the code of 70c2b4a,
244
+ and engine `v1.0.0` includes 35db01c8. The 1.0.1 code was graded before it
245
+ merged: this repository at 67892cd, the code of codegen 1.0.1, with engine
246
+ b2a578ce, whose library source is `v1.0.0`'s, graded the same 7,989 probes
247
+ with no probe changing tier (baseline
248
+ `pineforge-parity-baseline-20261001-codegen-67892cda`). Engine `v1.0.1`
249
+ changes only documentation since `v1.0.0`. The
243
250
  engine's [validation scoreboard](https://github.com/pineforge-4pass/pineforge-engine#validation-scoreboard)
244
251
  describes how a probe is graded.
245
252
 
@@ -248,39 +255,53 @@ and trade your own account with your own capital at no cost. See
248
255
  [License](#license) for the line between personal and commercial use.
249
256
 
250
257
  See the [changelog](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/main/CHANGELOG.md)
251
- for the unreleased changes on `main` and the release-note policy.
258
+ for the changes in each release from 1.0.0 on and the release-note policy.
252
259
 
253
260
  - **Pure Python, zero runtime dependencies** — `transpile()` and
254
261
  `transpile_full()` are the supported Python entry points.
255
262
  - **Located diagnostics** — the support checker rejects unsupported Pine with
256
- a `file:line:col` location before any C++ is emitted, and on `main`
263
+ a `file:line:col` location before any C++ is emitted, and
257
264
  `transpile_full()` returns warnings for supported scripts with documented
258
265
  approximations.
259
266
 
260
267
  ## Releases and this README
261
268
 
262
- <!-- Release lane: when a version is tagged, update this section, the Install
263
- note, the Engine pairing table and every "0.10.4" / "on `main`" marker. -->
269
+ <!-- Release lane: before a release is tagged, add it to the Engine pairing
270
+ table and update every line that names `1.0.1` or `v1.0.1` as the current
271
+ release or pair (this section's version and date, the baseline paragraph at
272
+ the top, the engine `src/source/` link, the `@pf-trace` note, the clone
273
+ command and its example output, "This section describes …", the timing note)
274
+ and every "on `main`" marker; lines saying what changed in a release stay.
275
+ PyPI shows the README as it is at the tag. The Install note and the
276
+ hosted-server line name no version. -->
277
+
278
+ This README ships with each release as its package description on PyPI
279
+ (`pineforge-codegen`); releases from 0.7.0 on are also on npm as
280
+ `@pineforge/codegen-pyodide`. It describes 1.0.1 (2026-10-02) and what changed
281
+ since 0.10.4. The
282
+ [PyPI release history](https://pypi.org/project/pineforge-codegen/#history)
283
+ lists every release; the
284
+ [changelog](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/main/CHANGELOG.md)
285
+ covers 1.0.0 on and links the notes of earlier releases. A source install
286
+ reports the version in `VERSION`, which the release workflow sets when it tags
287
+ a release.
264
288
 
265
- This README describes `main`, which is ahead of the latest release and not yet
266
- released. The latest release is **0.10.4** (2026-09-06), on PyPI as
267
- `pineforge-codegen` and on npm as `@pineforge/codegen-pyodide`. Its README is
268
- at the [`v0.10.4` tag](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/v0.10.4/README.md).
269
- A source install of `main` also reports version 0.10.4: the release workflow
270
- sets the version when it tags a release.
289
+ ### Upgrading from 0.10.4
271
290
 
272
- This README marks where 0.10.4 is known to differ from `main`; the changelog is
291
+ 0.10.4 (2026-09-06) was the last 0.x release. Its README is at the
292
+ [`v0.10.4` tag](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/v0.10.4/README.md).
293
+ This README marks where 0.10.4 is known to differ from 1.0.0; the changelog is
273
294
  the complete list. The differences a user meets first:
274
295
 
275
296
  - 0.10.4's C++ derives `GeneratedStrategy` from `BacktestEngine` in
276
- `<pineforge/engine.hpp>`; `main`'s derives it from
297
+ `<pineforge/engine.hpp>`; 1.0.0's derives it from
277
298
  `pineforge::source::PineStrategyHost`. The two need different engines (see
278
299
  [Engine pairing](#engine-pairing)).
279
300
  - 0.10.4 has no `libraries=` argument, no `diagnostics` key in
280
301
  `transpile_full()`'s result and none of the [input limits](#limits).
281
- - 0.10.4 recovers from some syntax errors and still returns C++; `main` raises
302
+ - 0.10.4 recovers from some syntax errors and still returns C++; 1.0.0 raises
282
303
  a located `CompileError` instead.
283
- - Many scripts that 0.10.4 refuses transpile on `main`, and some lower
304
+ - Many scripts that 0.10.4 refuses transpile with 1.0.0, and some lower
284
305
  differently; the [changelog](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/main/CHANGELOG.md)
285
306
  lists them.
286
307
 
@@ -288,7 +309,7 @@ the complete list. The differences a user meets first:
288
309
 
289
310
  This repository owns **Pine → C++ translation only**. It turns a Pine v6 script
290
311
  into a `GeneratedStrategy`: the indicator math plus the `strategy.entry` /
291
- `exit` / `close` / … calls, emitted on `main` on the engine's
312
+ `exit` / `close` / … calls, emitted on the engine's
292
313
  `pineforge::source::PineStrategyHost` with code that attaches the engine's Pine
293
314
  execution adapter.
294
315
 
@@ -296,8 +317,8 @@ It does **not** own execution semantics. Order lifecycle, bracket legs,
296
317
  fill-price and slippage rules, `process_orders_on_close` / `calc_on_order_fills`,
297
318
  margin revival and trail/stop behaviour — everything TradingView parity depends
298
319
  on at run time — live in the engine's source-adapter runtime
299
- ([`src/source/`](https://github.com/pineforge-4pass/pineforge-engine/tree/main/src/source)
300
- on engine `main`), which maps them onto the engine's Pine-agnostic kernel. See
320
+ ([`src/source/`](https://github.com/pineforge-4pass/pineforge-engine/tree/v1.0.1/src/source)
321
+ in engine `v1.0.1`), which maps them onto the engine's Pine-agnostic kernel. See
301
322
  the engine's [architecture notes](https://github.com/pineforge-4pass/pineforge-engine#architecture-kernel-vs-parity).
302
323
 
303
324
  ---
@@ -308,11 +329,10 @@ the engine's [architecture notes](https://github.com/pineforge-4pass/pineforge-e
308
329
  pip install pineforge-codegen
309
330
  ```
310
331
 
311
- This installs the latest release, 0.10.4. Requires Python ≥ 3.11. No runtime
332
+ This installs the latest release. Requires Python ≥ 3.11. No runtime
312
333
  dependencies.
313
334
 
314
- To get `main`, which this README describes, install from source (this is also
315
- the development setup):
335
+ To get `main`, install from source (this is also the development setup):
316
336
 
317
337
  ```bash
318
338
  git clone https://github.com/pineforge-4pass/pineforge-codegen-oss.git
@@ -340,7 +360,7 @@ cpp = transpile(pine)
340
360
  print(cpp) # complete C++ source string
341
361
  ```
342
362
 
343
- On `main` the output `#include`s `<pineforge/source/pine_strategy_host.hpp>`,
363
+ The output `#include`s `<pineforge/source/pine_strategy_host.hpp>`,
344
364
  `<pineforge/ta.hpp>`, …; its `GeneratedStrategy` derives from
345
365
  `pineforge::source::PineStrategyHost` and compiles into a `.so` exposing the
346
366
  engine's documented C-ABI. 0.10.4's output includes `<pineforge/engine.hpp>`
@@ -357,22 +377,22 @@ transpile(
357
377
  *,
358
378
  check_support: bool = True, # run the support checker before codegen
359
379
  filename: str = "<input>", # name used in error locations
360
- libraries: Mapping[str, str] | None = None, # imported Pine libraries (main only)
380
+ libraries: Mapping[str, str] | None = None, # imported Pine libraries (new in 1.0.0)
361
381
  ) -> str
362
382
  ```
363
383
 
364
384
  Returns the generated C++ source as a string. Raises
365
- `pineforge_codegen.errors.CompileError` on a rejected construct and, on `main`,
385
+ `pineforge_codegen.errors.CompileError` on a rejected construct and, since 1.0.0,
366
386
  on a syntax error or an input limit (0.10.4 recovers from some syntax errors
367
- and has no input limits). It does not return nonfatal warnings; on `main`, use
387
+ and has no input limits). It does not return nonfatal warnings; use
368
388
  `transpile_full()` to inspect them.
369
389
 
370
- `libraries` exists on `main` only. It maps an import path to the library's
390
+ `libraries` is new in 1.0.0. It maps an import path to the library's
371
391
  source (`{"user/name/version": source_text}`), and each import the script uses
372
392
  is inlined from it. With `libraries=None` (the default) the sources are read
373
393
  through the script's own requests manifest when the environment names one
374
394
  (`$PINEFORGE_PINE_LIBRARIES` with `$PINEFORGE_REQUESTS_ROOT`); otherwise an
375
- import is refused by name, as in 0.10.4. On `main`, an import whose alias is
395
+ import is refused by name, as in 0.10.4. Since 1.0.0, an import whose alias is
376
396
  `ta`, `math` or `str` and that names only that namespace's built-ins needs no
377
397
  source.
378
398
 
@@ -384,17 +404,17 @@ transpile_full(
384
404
  *,
385
405
  check_support: bool = True,
386
406
  filename: str = "<input>",
387
- libraries: Mapping[str, str] | None = None, # main only
407
+ libraries: Mapping[str, str] | None = None, # new in 1.0.0
388
408
  ) -> dict
389
409
  ```
390
410
 
391
- On `main` it returns `{"cpp": str, "inputs": list[dict], "strategyParams": dict,
411
+ It returns `{"cpp": str, "inputs": list[dict], "strategyParams": dict,
392
412
  "diagnostics": list[Diagnostic]}` on success (0.10.4 returns the first three
393
413
  keys). `inputs` is the input manifest; its `title` is the actual override key.
394
414
  `diagnostics` contains nonfatal warnings. A rejected script raises
395
415
  `CompileError` with its diagnostics. The Pyodide package ships `gate/glue.py`'s
396
416
  `transpile_json(source) -> str`, whose JSON success and error envelopes carry
397
- the same manifest and, on `main`, the same warnings. See the
417
+ the same manifest and, since 1.0.0, the same warnings. See the
398
418
  [1.0 public contract](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/main/docs/PUBLIC_CONTRACT.md)
399
419
  for the exact fields, severity values, and input key rules. There is no
400
420
  installed CLI or exit-code contract.
@@ -440,11 +460,11 @@ transpile(src, filename="my_strategy.pine")
440
460
  # raises e.g. my_strategy.pine:12:5: ...
441
461
  ```
442
462
 
443
- Not every request for outside data is refused on `main`. A
463
+ Not every request for outside data is refused. A
444
464
  `request.financial()` whose value reaches only plots, alerts, tables or logs
445
465
  transpiles with a warning and reads `na`; 0.10.4 refuses it. The
446
466
  [changelog](https://github.com/pineforge-4pass/pineforge-codegen-oss/blob/main/CHANGELOG.md)
447
- lists what `main` reads, warns about or refuses for such requests.
467
+ lists what 1.0.0 reads, warns about or refuses for such requests.
448
468
 
449
469
  ### Skip the support checker
450
470
 
@@ -488,7 +508,7 @@ fields, such as `// @pf-trace gap=close - e` or
488
508
  `// @pf-trace body=math.abs(close - open)`. A `ta.*` call written in the
489
509
  pragma itself is not computed: `// @pf-trace rsi=ta.rsi(close, 14)` records
490
510
  `na` on every bar, and its C++ carries an `/* unsupported: ta.rsi */` marker.
491
- Both 0.10.4 and `main` behave this way.
511
+ 0.10.4, 1.0.0 and 1.0.1 all behave this way.
492
512
 
493
513
  ### Advanced: run the pipeline stages directly
494
514
 
@@ -519,7 +539,7 @@ quick-start strategy.
519
539
 
520
540
  ## Limits
521
541
 
522
- These limits are on `main` only; 0.10.4 has none of them. They turn a crash or
542
+ These limits are new in 1.0.0; 0.10.4 has none of them. They turn a crash or
523
543
  a hang on untrusted source into a `CompileError` with a Pine `file:line:col`
524
544
  location. Where TradingView documents a limit, PineForge's is at least as
525
545
  large. Exceeding one does not return partial C++, and `check_support=False`
@@ -531,9 +551,11 @@ does not bypass them.
531
551
  | Nesting depth | 512 levels | None | 10 levels |
532
552
  | Transpilation time | 120 seconds | Two-minute compilation limit | 0.05 seconds |
533
553
 
534
- The last column was measured on 2026-09-29 with `main` (70c2b4a) on CPython
535
- 3.14 on an Apple M4 Max, over the engine corpus that engine `main` 35db01c8
536
- pins and this repository's `tests/gate-corpus`.
554
+ The last column was measured on 2026-09-29 with 70c2b4a (the same code as
555
+ 1.0.0) on CPython 3.14 on an Apple M4 Max, over the engine corpus that engine
556
+ 35db01c8 pins (as `v1.0.0` and `v1.0.1` do) and this repository's
557
+ `tests/gate-corpus`. On 2026-10-02, on CPython 3.14 on an Apple M4 Max, 1.0.1
558
+ transpiled each of those sources in at most 0.05 seconds.
537
559
 
538
560
  Nesting counts brackets, indented blocks, prefix operators, `?:` and
539
561
  `else if` chains, and the depth of the parsed syntax tree, in which an
@@ -548,7 +570,7 @@ located error.
548
570
 
549
571
  ## How it works
550
572
 
551
- On `main`, `transpile()` runs these passes, in order:
573
+ `transpile()` runs these passes, in order:
552
574
 
553
575
  ```
554
576
  pine source
@@ -569,7 +591,7 @@ block-local declaration or a per-call-site clone of a function that reads
569
591
  loop. 0.10.4 runs passes 1, 2, 4, 6 and 7 once, with only the bounded TA
570
592
  length rewrite of pass 5.
571
593
 
572
- On `main`, the emitted `GeneratedStrategy` does not execute orders itself: its
594
+ The emitted `GeneratedStrategy` does not execute orders itself: its
573
595
  `strategy.*` calls go to the engine's Pine execution adapter, which it attaches
574
596
  in its constructor.
575
597
 
@@ -579,9 +601,10 @@ Generated C++ compiles only against the engine it was generated for:
579
601
 
580
602
  | Codegen | Engine | Status |
581
603
  | --- | --- | --- |
582
- | 0.10.4 (PyPI, 2026-09-06) | `v0.13.1` | The pair the `pineforge-release` image `v0.1.25` ships. Its C++ does not compile against engine `main`. |
583
- | `main` (unreleased) | `main` | Its C++ needs `pineforge/source/pine_strategy_host.hpp`, which no engine release has yet (`v0.13.1` does not). |
584
- | 1.0.0 and later (planned) | `vX.Y.Z` of the same version | See below. |
604
+ | 0.10.4 (PyPI, 2026-09-06) | `v0.13.1` | The last 0.x pair, which the `pineforge-release` image `0.1.25` ships. Its C++ does not compile against engine `v1.0.0`. |
605
+ | 1.0.0 (PyPI, 2026-09-30) | `v1.0.0` | The pair the `pineforge-release` image `1.0.0` ships. Its C++ needs `pineforge/source/pine_strategy_host.hpp`, which engine `v0.13.1` does not have. |
606
+ | 1.0.1 (PyPI, 2026-10-02) | `v1.0.1` | The pair the `pineforge-release` image `1.0.1` ships. Engine `v1.0.1` changes only documentation since `v1.0.0`; regenerate and relink all the same. |
607
+ | Later `X.Y.Z` releases | `vX.Y.Z` of the same version | See below. |
585
608
 
586
609
  On the 0.x line the engine and codegen versions are independent, and the
587
610
  [`pineforge-release`](https://github.com/pineforge-4pass/pineforge-release)
@@ -606,8 +629,8 @@ Pine as `strategy.pine`, write `strategy.generated.cpp` with the
606
629
  [file example](#transpile-a-file-to-a-cpp) above, then from the same directory:
607
630
 
608
631
  ```bash
609
- # main: the engine's main branch. For 0.10.4 add --branch v0.13.1.
610
- git clone https://github.com/pineforge-4pass/pineforge-engine.git
632
+ # 1.0.1 pairs with engine v1.0.1. For 0.10.4 use --branch v0.13.1.
633
+ git clone --branch v1.0.1 https://github.com/pineforge-4pass/pineforge-engine.git
611
634
  cd pineforge-engine
612
635
  cp ../strategy.generated.cpp tutorial/macd/generated.cpp # the tutorial's strategy slot
613
636
  bash tutorial/run.sh # needs cmake, a C++17 compiler and python3
@@ -616,7 +639,7 @@ bash tutorial/run.sh # needs cmake, a C++17 compiler and python3
616
639
  `run.sh` configures CMake once, builds `libpineforge.a` and
617
640
  `tutorial/macd/strategy.so`, and runs `tutorial/run.py`, which loads the `.so`,
618
641
  feeds it the bars and reads back the closed trades. For the quick-start SMA
619
- cross, `main` with engine `main` (35db01c8) prints:
642
+ cross, 1.0.1 with engine `v1.0.1` prints:
620
643
 
621
644
  ```
622
645
  MACD(12,26,9) on BTCUSDT 15m — 672 bars, 2026-04-29 18:15 → 2026-05-06 18:00 UTC
@@ -630,22 +653,22 @@ MACD(12,26,9) on BTCUSDT 15m — 672 bars, 2026-04-29 18:15 → 2026-05-06 18:00
630
653
  The `MACD(12,26,9)` label on the first line is fixed text in `run.py`,
631
654
  whatever strategy the `.so` holds, and `elapsed` varies by machine. 0.10.4
632
655
  with engine `v0.13.1` books 13 trades on the same bars. The difference is
633
- order sizing: `main` gives an omitted
656
+ order sizing: 1.0.0 gives an omitted
634
657
  `initial_capital`, `default_qty_type` and `default_qty_value` TradingView's
635
658
  Pine v6 defaults (100,000, `strategy.percent_of_equity`, 100), where 0.10.4
636
659
  leaves the engine's own (1,000,000 and 1 contract). Declaring those in
637
- `strategy()` books the same 13 trades on `main`.
660
+ `strategy()` books the same 13 trades on 1.0.1.
638
661
 
639
- On `main`, generated strategies reset persistent Pine state before each new
662
+ Since 1.0.0, generated strategies reset persistent Pine state before each new
640
663
  batch or stream warmup through the engine's script-run preparation hook. Input
641
664
  settings survive a new run, and ticks within one stream preserve accumulated
642
665
  state. Regenerate the strategy C++ and rebuild compiled modules with matching
643
666
  engine headers and library to use this lifecycle; replacing only the runtime
644
667
  archive does not retrofit already compiled modules.
645
668
 
646
- On `main`, generated constructors do not configure order behavior from the
669
+ Since 1.0.0, generated constructors do not configure order behavior from the
647
670
  presence of `strategy.close` or `strategy.close_all` in the source. Older C++
648
- (0.10.4's included) assigns `script_has_strategy_close_`, which engine `main`
671
+ (0.10.4's included) assigns `script_has_strategy_close_`, which engine `v1.0.0`
649
672
  has removed; regenerate it before compiling there. Reachable close commands
650
673
  keep their ordinary runtime lowering.
651
674
 
@@ -655,8 +678,8 @@ transpiles and backtests a strategy for an AI agent. The
655
678
  [`pineforge-backtest-mcp`](https://github.com/pineforge-4pass/pineforge-backtest-mcp)
656
679
  Docker image is a local MCP server with `transpile_pine` and `backtest_pine`
657
680
  tools that runs on your machine.
658
- Both run the latest release pair (codegen 0.10.4 with engine `v0.13.1`), not
659
- `main`.
681
+ Both are built on the `pineforge-release` image, which ships a released codegen
682
+ and engine pair; their `engine_info` tool reports the image's version.
660
683
 
661
684
  ## Running tests
662
685
 
@@ -696,7 +719,7 @@ hosted/embedded use. Email **luis@4pass.com.tw** with your use case for a quote.
696
719
 
697
720
  ## Explicit Pine execution attachment
698
721
 
699
- This section describes `main` and engine `main`. The Pine execution adapter is
722
+ This section describes 1.0.1 and engine `v1.0.1`. The Pine execution adapter is
700
723
  the engine's full Pine execution runtime (`PineExecutionAdapter` and
701
724
  `PineStrategyHost` in the engine's `src/source/`): order lifecycle, bracket
702
725
  legs, fill-price and slippage rules, POOC / `calc_on_order_fills`, margin
@@ -719,9 +742,9 @@ Regenerate old generated C++ before using a new engine for Pine execution. C++
719
742
  generated before the source-layer cut
720
743
  ([#129](https://github.com/pineforge-4pass/pineforge-codegen-oss/pull/129)),
721
744
  0.10.4's included, derives from `BacktestEngine` and does not compile against
722
- engine `main`; old cap-only C++ does not attach the priority rule, and
745
+ engine `v1.0.1`; old cap-only C++ does not attach the priority rule, and
723
746
  metadata cannot silently restore it. Rebuild all modules against the
724
- new matching C++ layout (`engine_script_run_v19` on engine `main`); old
747
+ new matching C++ layout (`engine_script_run_v19` in engine `v1.0.1`); old
725
748
  fingerprint versions are not comparable. The extraction preserves Pine policy
726
749
  under explicit attachment; it does not implement the generic native
727
750
  child-activation scheduler or prove campaign neutrality. Compile-only corpus