pineforge-codegen 1.9.0__tar.gz → 1.10.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.
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/CHANGELOG.md +124 -1
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/CONTRIBUTING.md +10 -5
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/PKG-INFO +1 -1
- pineforge_codegen-1.10.0/VERSION +1 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/docs/PUBLIC_CONTRACT.md +35 -0
- pineforge_codegen-1.10.0/docs/ci.md +126 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/__init__.py +50 -4
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/base.py +1442 -28
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/call_handlers.py +66 -7
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/contracts.py +11 -0
- pineforge_codegen-1.10.0/pineforge_codegen/analyzer/operators.py +276 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/types.py +261 -91
- pineforge_codegen-1.10.0/pineforge_codegen/analyzer/value_bindings.py +359 -0
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/array_field_width.py +441 -0
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/ascii.py +101 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/base.py +117 -25
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/bool_text.py +337 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/capabilities.py +8 -19
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/closed_trade_fold.py +399 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/collection_history.py +2 -1
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/color_constants.py +89 -0
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/constant_fold.py +338 -0
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/constant_values.py +173 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/drawing.py +21 -19
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/emit_top.py +71 -34
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/endless_for.py +507 -0
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/for_loops.py +17 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/graph_journal.py +3 -11
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/helpers.py +49 -1
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/host_members.py +2 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/input.py +16 -47
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/order_shapes.py +70 -2
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/security.py +1944 -77
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/strategy_declaration.py +184 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/tables.py +17 -8
- pineforge_codegen-1.10.0/pineforge_codegen/codegen/timeframe_values.py +370 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/types.py +1236 -193
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/visit_call.py +264 -122
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/visit_expr.py +205 -66
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/visit_stmt.py +400 -51
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/collection_history.py +26 -15
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/cpp_allowlist.py +18 -0
- pineforge_codegen-1.10.0/pineforge_codegen/cpp_names.py +17 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/diagnostics_catalog.json +86 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/errors.py +17 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/external_requests.py +3 -2
- pineforge_codegen-1.10.0/pineforge_codegen/function_overloads.py +337 -0
- pineforge_codegen-1.10.0/pineforge_codegen/intrinsic_binding.py +50 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/lexer.py +140 -22
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/library_inline.py +10 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/library_modules.py +2 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/limits.py +6 -0
- pineforge_codegen-1.10.0/pineforge_codegen/loop_types.py +468 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/method_binding.py +48 -3
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/parser.py +179 -98
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/pine_spelling.py +18 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/security_contexts.py +136 -27
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/signatures.py +153 -27
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/support_checker.py +47 -17
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/symbols.py +33 -2
- pineforge_codegen-1.9.0/VERSION +0 -1
- pineforge_codegen-1.9.0/pineforge_codegen/codegen/constant_fold.py +0 -131
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/.gitignore +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/LEGAL.md +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/LICENSE +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/README.md +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/docs/codegen-coverage-gaps.md +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/docs/pine-cap-activation.md +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/__init__.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/diagnostics.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/analyzer/tables.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/ast_nodes.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/block_locals.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/builtin_keywords.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/__init__.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/checked_settings.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/helpers_syminfo.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/history_sharing.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/id_sites.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/run_stops.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/session_market.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/ta.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/codegen/tv_number_format.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/diagnostic_codes.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/finite_ta_length.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/library_v5.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/matrix_overloads.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/pine_libraries.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/pragmas.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/request_discovery.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/request_feed_inventory.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/session_reads.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/timeframe_token_cli.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/tokens.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pineforge_codegen/tv_input_choices.py +0 -0
- {pineforge_codegen-1.9.0 → pineforge_codegen-1.10.0}/pyproject.toml +0 -0
|
@@ -20,7 +20,130 @@ 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 (
|
|
23
|
+
## Unreleased (next release)
|
|
24
|
+
|
|
25
|
+
- An affine chart loop proved endless is stopped with the loop-time error when
|
|
26
|
+
its result reaches an effect. Omission is limited to an unused loop statement
|
|
27
|
+
with no calls, whose writes have no readers except self-updates, a break
|
|
28
|
+
condition or one further unused variable declaration. Other flagged loops
|
|
29
|
+
stop when their result is read in a shape not measured, where TradingView
|
|
30
|
+
may drop them. Endless loops in functions, methods and `request.security`
|
|
31
|
+
still never end here while TradingView stops them; data-dependent endless
|
|
32
|
+
loops still hang.
|
|
33
|
+
- Pine v6 calls refuse a positional argument after a named argument with
|
|
34
|
+
`PF-E2074` at that positional expression. The check also covers strategy
|
|
35
|
+
declarations, unused functions and v6 library bodies before lowering.
|
|
36
|
+
- A v6 counted loop whose start has positive int check evidence now refuses a
|
|
37
|
+
float-typed step during translation with `PF-E2079` at the step expression
|
|
38
|
+
and the hint "Use an int step or a float counter." An unknown start with
|
|
39
|
+
a positively float step still selects a float counter.
|
|
40
|
+
- Counted loops can read their own counter in the end and step expressions,
|
|
41
|
+
including when it shadows an outer binding and inside a `request.security`
|
|
42
|
+
helper. The counter now wins over an outer same-named variable. The step is
|
|
43
|
+
read once at counter 0. TradingView measurements establish that direction
|
|
44
|
+
is fixed from the start and the first end read at counter 0, then an end
|
|
45
|
+
that reads this counter is read again at the start before the first
|
|
46
|
+
continuation test. The v6 end also refreshes between iterations. A non-positive
|
|
47
|
+
v6 step stops the run instead of being converted into a positive step.
|
|
48
|
+
This changes generated C++ for explicit-step loops; regenerate and
|
|
49
|
+
relink affected strategies.
|
|
50
|
+
- A v6 counted loop uses a float counter when its start has positive float
|
|
51
|
+
evidence, or when its start is unknown and its step has positive float
|
|
52
|
+
evidence, including inside a `request.security` helper. A start whose value
|
|
53
|
+
has positive int evidence keeps an int counter. Without float evidence, the
|
|
54
|
+
existing int route is unchanged; v5 library loops keep their existing
|
|
55
|
+
int-counter route.
|
|
56
|
+
Counter-family inference follows declaration sources in a dedicated query,
|
|
57
|
+
independently of shared expression and storage inference.
|
|
58
|
+
A division in a loop start keeps its fraction unless it is a constant
|
|
59
|
+
division with an exact integer result, which keeps the int route. The float-step
|
|
60
|
+
refusal follows TradingView's check type (a division of two ints is int).
|
|
61
|
+
- Float-counter loops accumulate the counter by repeated double addition.
|
|
62
|
+
TradingView's measured loop-end rule admits a counter whose excess beyond
|
|
63
|
+
the end, computed as one double subtraction in the loop's direction, is
|
|
64
|
+
strictly below `1e-10`. The named value `kTvFloatStepEnd` is emitted only
|
|
65
|
+
for float-counter loops. Measured on TradingView at the 0.3 scale (counted
|
|
66
|
+
up to a 9.999e-11 shortfall, not counted from 1.0e-10) and at counter
|
|
67
|
+
magnitudes of about 1, 1e3, 1e6 and 1e9; no magnitude-independent constant
|
|
68
|
+
is claimed; not a constant TradingView publishes.
|
|
69
|
+
`0.0 to 0.3 by 0.1` counts four iterations;
|
|
70
|
+
`0.0 to 2999.9999999999 by 1000.0` counts three.
|
|
71
|
+
A positive infinite step exits after one iteration with a finite end
|
|
72
|
+
and needs no non-finite-step guard.
|
|
73
|
+
- Known loop gaps: a float counter passed to
|
|
74
|
+
an untyped helper truncates here, while TradingView passes the fractional
|
|
75
|
+
value (accumulating `twice(x)` from 0.0 to 1.0 by 0.25 gives 2 here and 5
|
|
76
|
+
on TradingView). `array.from(x)` can also truncate a float counter through
|
|
77
|
+
inferred `array<int>` storage. An unknown start from an untyped parameter
|
|
78
|
+
with a positively float step now selects a float counter, independently
|
|
79
|
+
of shared parameter inference. For `f(x)` containing
|
|
80
|
+
`for v = x to 1.0 by 0.25`, TradingView refuses `f(0)` with CE10106 and
|
|
81
|
+
accepts `f(0.0)`. PineForge accepts and runs both with a float counter
|
|
82
|
+
because this inference cannot distinguish their call-argument types;
|
|
83
|
+
refusing the unknown start would also refuse the valid float-argument call.
|
|
84
|
+
Block-local/enclosing-counter bindings and stops inside `request.security`
|
|
85
|
+
have no TradingView tape.
|
|
86
|
+
- A Pine v6 function or method reading a later local without an earlier
|
|
87
|
+
visible binding is refused during analysis at the read (`PF-E2075`),
|
|
88
|
+
using the same declaration-order rule as later globals (`PF-E2053`).
|
|
89
|
+
Reading a loop counter or `for ... in` binder after its loop without
|
|
90
|
+
another visible binding is now refused at translate time (`PF-E2054`);
|
|
91
|
+
these reads were previously accepted.
|
|
92
|
+
TradingView accepts a namespace call after an expired block local with the
|
|
93
|
+
same name; PineForge's analysis no longer refuses it, but code generation
|
|
94
|
+
still rejects some such calls (a known gap).
|
|
95
|
+
|
|
96
|
+
## 1.9.1 — 2026-10-31
|
|
97
|
+
|
|
98
|
+
- Translation checks the generated C++ against a fixed allowlist and refuses a
|
|
99
|
+
script whose output contains a construct outside it, with a fixed reason and
|
|
100
|
+
no script text in the message (diagnostic codes `PF-E5053` through
|
|
101
|
+
`PF-E5079`). The allowlist now also refuses namespace, mount and
|
|
102
|
+
thread-creation names (`unshare`, `setns`, `clone`, `clone3`, `mount`,
|
|
103
|
+
`umount`, `umount2`, `pivot_root`, `chroot`, `prctl`, `seccomp`,
|
|
104
|
+
`pthread_create`, `thrd_create`, `__clone`, `thread`, `jthread`, `async`),
|
|
105
|
+
and an authored identifier spelled like one of these is renamed with the
|
|
106
|
+
usual escape prefix. A script that uses none of these names and no
|
|
107
|
+
non-ASCII text translates to the same C++ as before, except for the timestamp
|
|
108
|
+
change below.
|
|
109
|
+
- Every generated timestamp and time-field lambda that takes a timezone asks
|
|
110
|
+
the engine whether the zone is accepted before it sets the process timezone;
|
|
111
|
+
a rejected zone is read as UTC instead of being set. The generated C++ of
|
|
112
|
+
every script that uses such a lambda changes by that one term, and the built
|
|
113
|
+
strategy calls an engine library function (declared in the engine since 1.8.0),
|
|
114
|
+
so it must be linked against the paired engine library.
|
|
115
|
+
- Identifiers, strings and comments in generated C++ are spelled in ASCII:
|
|
116
|
+
non-ASCII identifier characters become encoded tokens and string bytes become
|
|
117
|
+
octal escapes, with the same bytes at run time. A script with non-ASCII text
|
|
118
|
+
generates different C++ text.
|
|
119
|
+
- The fallback renderer for a runtime technical-analysis length expression no
|
|
120
|
+
longer rewrites text inside a string literal. It substituted identifier-shaped
|
|
121
|
+
words everywhere in the expression, so a literal that spelled an input
|
|
122
|
+
variable's name or a known string constant's name received that value's
|
|
123
|
+
rendering and could close the literal early; it now substitutes identifier
|
|
124
|
+
tokens only. The fallback is not reached by any script accepted so far, so no
|
|
125
|
+
translated output changes.
|
|
126
|
+
- A string literal inside the length argument of a technical-analysis call is
|
|
127
|
+
no longer rewritten when the call sits in a user function. The function's
|
|
128
|
+
parameter substitution and local-variable expansion replaced identifier-shaped
|
|
129
|
+
words everywhere in the argument text, so `ta.sma(close, mode == "fast" ? fast : 10)`
|
|
130
|
+
inside `smooth(int fast)` called as `smooth(5)` compared `mode` with `"5"`
|
|
131
|
+
instead of `"fast"` and chose the wrong length. Both now substitute outside
|
|
132
|
+
string literals only, and so do the three earlier passes of the fallback
|
|
133
|
+
renderer (`timeframe.` members, `math.` members and the words `and`, `or`,
|
|
134
|
+
`not`), which changed the text of a literal such as `"buy and hold"`
|
|
135
|
+
(the fallback renderer). A script
|
|
136
|
+
without a string literal in such an argument generates the same C++ as before.
|
|
137
|
+
- A script that loops over every closed trade on every bar to sum profits
|
|
138
|
+
under entry-id or profit conditions now generates a resumable fold: settled
|
|
139
|
+
closed trades are folded once into prefix sums and only the unsettled tail is
|
|
140
|
+
folded again each bar, in the plain loop's order, so every accumulated value
|
|
141
|
+
is identical bit for bit. The per-bar work grows with the trades closed at
|
|
142
|
+
the newest exit time and the trades closed since the previous bar, not with
|
|
143
|
+
the number of closed trades. A script that does not match the loop shape
|
|
144
|
+
generates the same C++ as before.
|
|
145
|
+
|
|
146
|
+
## 1.9.0 — 2026-10-30
|
|
24
147
|
|
|
25
148
|
- Generated closed-trade text comparisons against a NUL-free string literal
|
|
26
149
|
call the engine's in-place closed-trade comparison members, introduced in
|
|
@@ -196,11 +196,16 @@ declare the environment fails at npm.
|
|
|
196
196
|
engine.
|
|
197
197
|
- Keep [CHANGELOG.md](CHANGELOG.md) current for user-visible changes. Its
|
|
198
198
|
release-note policy applies to both stable and prerelease tags.
|
|
199
|
-
- CI
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
maintainer
|
|
203
|
-
|
|
199
|
+
- Pull request CI requires a non-draft, same-repository PR to `main`, with
|
|
200
|
+
repository write permission for its author, actor and rerunning actor (or a
|
|
201
|
+
fixed allowed bot). Fork PRs, including documentation-only PRs, do not enter
|
|
202
|
+
GKE. A maintainer can push the branch to this repository and open a PR from
|
|
203
|
+
it. Every admitted diff runs the full test matrix and differential gate.
|
|
204
|
+
See [CI admission and check mapping](docs/ci.md) for the hosted authorization
|
|
205
|
+
and result jobs, pod permissions, and operator setup.
|
|
206
|
+
- `test.yml` runs only on push to `main` and manual dispatch. Its `workflow-lint`,
|
|
207
|
+
`package-files` and `pytest` jobs use `gke-8cpu-16gb-amd64`; `authz`, `changes`
|
|
208
|
+
and `test-check` use `ubuntu-24.04`.
|
|
204
209
|
- The README describes the latest release and becomes the PyPI page of the
|
|
205
210
|
next release: when a version is tagged, update its "Releases and this
|
|
206
211
|
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.
|
|
3
|
+
Version: 1.10.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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.10.0
|
|
@@ -457,6 +457,17 @@ or generation error; its `diagnostics` attribute carries `Diagnostic` objects.
|
|
|
457
457
|
1.5.0) notes; use `transpile_full()` to read them. The `diagnostics` of a
|
|
458
458
|
`CompileError` can carry them beside its errors.
|
|
459
459
|
|
|
460
|
+
A counted-loop counter is visible in its loop's end and step expressions
|
|
461
|
+
and its body, but not after the loop. A `for ... in` binder is local to the
|
|
462
|
+
loop body. Reading either outside its scope raises analyzer `PF-E2054` at
|
|
463
|
+
the identifier, unless an enclosing declaration or builtin supplies that
|
|
464
|
+
name. Reassigning a name with no visible declaration retains `PF-E2020`.
|
|
465
|
+
|
|
466
|
+
`transpile()`, `transpile_full()` and `transpile_with_request_inventory()` check
|
|
467
|
+
the generated C++ allowlist even with `check_support=False` and raise
|
|
468
|
+
`CompileError` with at most 20 fixed reasons at `filename:1:1` when it reports
|
|
469
|
+
findings.
|
|
470
|
+
|
|
460
471
|
`libraries` maps a Pine library's import path to its source
|
|
461
472
|
(`{"user/name/version": source_text}`); each import the script uses is inlined
|
|
462
473
|
from it before the support check. With `None`, the default, the sources are
|
|
@@ -464,6 +475,12 @@ read through the script's own requests manifest when `$PINEFORGE_PINE_LIBRARIES`
|
|
|
464
475
|
and `$PINEFORGE_REQUESTS_ROOT` name one. An import with no source is refused by
|
|
465
476
|
name, except one whose alias is `ta`, `math` or `str` and that names only that
|
|
466
477
|
namespace's built-ins, which is a no-op.
|
|
478
|
+
Library imports are supported only when the library source is supplied;
|
|
479
|
+
otherwise compilation fails with the diagnostic above.
|
|
480
|
+
Unresolved imports carry a hint about supplying or inlining the library source:
|
|
481
|
+
`PF-E2040` without a resolver reason, `PF-E2041` with one. The message text and
|
|
482
|
+
named arguments are unchanged. `PF-E2018` and `PF-E2019` remain catalog entries
|
|
483
|
+
for the forms without a hint.
|
|
467
484
|
|
|
468
485
|
`transpile_full()` runs the same translation once and returns these keys on
|
|
469
486
|
success:
|
|
@@ -621,6 +638,24 @@ argument.
|
|
|
621
638
|
|
|
622
639
|
## Diagnostic codes
|
|
623
640
|
|
|
641
|
+
Pine v6 call arguments must put all positional arguments before named
|
|
642
|
+
arguments. `PF-E2074` is a fatal analyzer diagnostic at the first positional
|
|
643
|
+
expression that follows a named argument in the same call. It covers calls
|
|
644
|
+
and strategy declarations before argument rewriting or unused-code removal,
|
|
645
|
+
including v6 library bodies, and remains enforced with `check_support=False`.
|
|
646
|
+
Nested calls have independent argument lists; all-named calls may name
|
|
647
|
+
parameters in any order. Imported v5 libraries retain their existing policy.
|
|
648
|
+
|
|
649
|
+
Callable value reads follow declaration order. A Pine v6 function or method
|
|
650
|
+
reading a later local without an earlier visible binding reports `PF-E2075`
|
|
651
|
+
at that identifier; a later direct global retains `PF-E2053`. Earlier outer
|
|
652
|
+
bindings remain visible before a local shadow is declared.
|
|
653
|
+
|
|
654
|
+
A Pine v6 `for` loop whose counter start has positive int evidence reports
|
|
655
|
+
`PF-E2079` for a float-typed step. This fatal analyzer diagnostic points at the
|
|
656
|
+
step expression, with the hint "Use an int step or a float counter."
|
|
657
|
+
Unknown starts are not refused by this diagnostic.
|
|
658
|
+
|
|
624
659
|
Every `Diagnostic` (in `transpile_full(...)["diagnostics"]`, in a
|
|
625
660
|
`CompileError`'s `diagnostics`, and in the glue envelopes) carries the stable
|
|
626
661
|
`code` and `args` introduced in 1.2.0. Since 1.5.0 it also carries
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Pull request CI
|
|
2
|
+
|
|
3
|
+
`gke-pr.yml` runs pull request tests on GKE runner pods after a hosted admission
|
|
4
|
+
job accepts the exact head. It uses `pull_request_target` against `main`, so
|
|
5
|
+
GitHub executes the workflow definition from the base repository. Candidate
|
|
6
|
+
workflow files are fetched as data and checked by the base tree's
|
|
7
|
+
`tests/test_gke_pr_admission.py`; the hosted jobs never check out candidate code.
|
|
8
|
+
|
|
9
|
+
Admission requires an open, non-draft PR from this repository, with a non-fork
|
|
10
|
+
head and `main` as its base. The author, original actor and rerunning actor each
|
|
11
|
+
need `admin`, `maintain` or `write` repository permission. The fixed
|
|
12
|
+
`dependabot[bot]` and `pineforge-app[bot]` exceptions match the existing authz
|
|
13
|
+
policy. A missing identity, failed API lookup, unexpected permission or stale
|
|
14
|
+
event head refuses admission. The original `test.yml` authz job remains hosted
|
|
15
|
+
on push and dispatch and retains its author permission fallback.
|
|
16
|
+
|
|
17
|
+
Before setting `allowed=true`, admission reads the immutable head's recursive
|
|
18
|
+
Git tree, refuses truncation, symlinks, submodules, unsafe names and oversized
|
|
19
|
+
inputs, then runs pinned actionlint with the base configuration and the base
|
|
20
|
+
security rules. Only workflow/action files, the actionlint configuration and
|
|
21
|
+
`package.json` cache metadata are fetched. Directory entries are skipped;
|
|
22
|
+
regular blobs are limited to 100 files, 1 MiB each and 4 MiB total, with decoded
|
|
23
|
+
lengths checked against the tree.
|
|
24
|
+
The scanner bounds lines at 4,096 characters, files at 20,000 lines and
|
|
25
|
+
structure at 40 levels. It refuses ambiguous YAML structure, duplicate keys,
|
|
26
|
+
anchors, aliases, tags, merge keys, dynamic runner expressions, grouped runner
|
|
27
|
+
mappings, unsupported flow values and control characters. Ordinary quoted text,
|
|
28
|
+
GitHub expressions in environment values, and script block contents are kept
|
|
29
|
+
separate from routing structure.
|
|
30
|
+
|
|
31
|
+
Every admitted PR, including a documentation or workflow change, runs the full
|
|
32
|
+
matrix and differential checks. There is no cheap-skip classifier to trust.
|
|
33
|
+
The hosted result requires each prerequisite to succeed, rechecks live PR and
|
|
34
|
+
actor identity, and posts the `gate` status to the immutable event head. A
|
|
35
|
+
failure, skip, cancellation, missing output, stale head or refusal fails the
|
|
36
|
+
result. Status publication failure also fails the job.
|
|
37
|
+
|
|
38
|
+
| Previous PR context | Current context |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| Test / authz | Test / authz stays on `ubuntu-24.04` for push and dispatch |
|
|
41
|
+
| Test / changes | GKE PR / admit; Test / changes stays on `ubuntu-24.04` for push and dispatch |
|
|
42
|
+
| Test / workflow-lint | Test / workflow-lint uses `gke-8cpu-16gb-amd64` on push and dispatch; GKE PR / workflow-lint checks the candidate |
|
|
43
|
+
| Test / package-files | GKE PR / package-files; Test / package-files uses `gke-8cpu-16gb-amd64` on push and dispatch |
|
|
44
|
+
| Test / pytest (3.11, 3.12, 3.13, 3.14) | GKE PR / pytest, with the same versions; Test / pytest uses `gke-8cpu-16gb-amd64` on push and dispatch |
|
|
45
|
+
| Test / test-check | GKE PR / test-check stays hosted; Test / test-check stays on `ubuntu-24.04` for push and dispatch |
|
|
46
|
+
| Pyodide Gate / preflight-docs | GKE PR / admit |
|
|
47
|
+
| Pyodide Gate / differential | GKE PR / differential |
|
|
48
|
+
| Pyodide Gate / pytest (3.11, 3.12, 3.13, 3.14) | The shared GKE PR / pytest matrix |
|
|
49
|
+
| Pyodide Gate / gate and the `gate` commit status | GKE PR / gate and the same `gate` commit status, hosted |
|
|
50
|
+
|
|
51
|
+
The shared pytest matrix runs the same command as both former PR matrices.
|
|
52
|
+
The differential leg retains Python 3.14, Node 22, the Pyodide selftest,
|
|
53
|
+
dependency audit and full gate. Package metadata and entity checks run on every
|
|
54
|
+
admitted diff, as does the workflow/App-environment guard.
|
|
55
|
+
|
|
56
|
+
All pod jobs use the bare scalar `gke-8cpu-16gb-amd64`. The image supplies the
|
|
57
|
+
engine toolchain, Python 3.12 with venv, git, git-lfs, jq, curl, actionlint,
|
|
58
|
+
shellcheck and gh. Pinned setup actions supply the other Python versions and
|
|
59
|
+
Node/npm 22. The pod jobs have only `contents: read`, persist no checkout
|
|
60
|
+
credentials, receive no secret, OIDC permission or environment, and use no
|
|
61
|
+
Actions cache. Hosted admission has read-only contents permission; only the
|
|
62
|
+
hosted result can write statuses.
|
|
63
|
+
|
|
64
|
+
An Actions runtime/cache token is still available to PR code on a runner.
|
|
65
|
+
Consequently the policy also refuses Actions cache restore/save steps and
|
|
66
|
+
setup cache inputs throughout the workflow/action data it checks: trusted jobs
|
|
67
|
+
must never restore cache entries a PR could write. Differential artifacts are
|
|
68
|
+
diagnostics for that run; the result does not download or trust them.
|
|
69
|
+
Node setup explicitly sets `package-manager-cache: false` in admission and
|
|
70
|
+
the retained gate workflow. The unchanged promotion Node setup is admitted
|
|
71
|
+
only while `package.json` has no `packageManager` or
|
|
72
|
+
`devEngines.packageManager` opt-in. Adding such metadata requires disabling
|
|
73
|
+
that remaining setup default in a separate base change first.
|
|
74
|
+
|
|
75
|
+
`test.yml` has only push-to-main and dispatch triggers: `workflow-lint`,
|
|
76
|
+
`package-files` and `pytest` use `gke-8cpu-16gb-amd64`; `authz`, `changes` and
|
|
77
|
+
`test-check` use `ubuntu-24.04`. Pull-request checks use `gke-pr.yml` admission.
|
|
78
|
+
The existing App-environment guard keeps its authorization dependency and
|
|
79
|
+
blocking step. Workflow lint uses the checked-in actionlint configuration
|
|
80
|
+
and the exact checkout head.
|
|
81
|
+
`gate.yml` retains only its hosted schedule and dispatch
|
|
82
|
+
legs. Those trusted routes require a separate runner admission entry before
|
|
83
|
+
they can move. PyPI/npm publication and baseline promotion remain hosted.
|
|
84
|
+
|
|
85
|
+
The only `pull_request_target` workflow is `gke-pr.yml`.
|
|
86
|
+
`promote-baseline.yml` runs on pushes to `main` and manual dispatch from `main`.
|
|
87
|
+
Manual dispatch validates `merge_commit` and `head_sha` as lowercase 40-hex, `pr_number` as a positive decimal, `pr_url` for this repository and number, and `merged_at` as `YYYY-MM-DDTHH:MM:SSZ`.
|
|
88
|
+
It checks the numbered PR and paginated commit associations with `gh`, requiring one merged PR on `main` whose merge, head, and merge time match the inputs.
|
|
89
|
+
API errors, empty responses, mismatches, and multiple associations refuse dispatch.
|
|
90
|
+
If dispatch refuses, re-read the values from the merged pull request page or
|
|
91
|
+
`gh pr view <n> --json mergeCommit,headRefOid,mergedAt,url`, then dispatch again from `main`.
|
|
92
|
+
Never edit the workflow to get past a refusal.
|
|
93
|
+
Promotion paginates the pushed commit's associated PRs and requires exactly one
|
|
94
|
+
closed, merged PR with that merge commit and base `main`; zero or multiple
|
|
95
|
+
matches skip promotion green. It rereads that PR's full record, binds its gated
|
|
96
|
+
head, merge commit, author, merger, number, URL and merge time, then checks
|
|
97
|
+
authorization and tree equality. Codegen still requires the `gate` context
|
|
98
|
+
to succeed on that head (the trusted reporter's status, else a success
|
|
99
|
+
check-run) and no failing newest check-run per app and name. The hosted runner,
|
|
100
|
+
release environment and WIF workflow-path/main-ref binding remain in place;
|
|
101
|
+
the workflow checks out and runs no PR code.
|
|
102
|
+
|
|
103
|
+
Runner-group and merge-authority configuration are operator work outside this
|
|
104
|
+
repository change. Enable only
|
|
105
|
+
`pineforge-4pass/pineforge-codegen-oss/.github/workflows/gke-pr.yml@refs/heads/main`
|
|
106
|
+
for PR pods; do not enable a caller-controlled reusable workflow or a
|
|
107
|
+
`pull_request` workflow. Update consumers of the context mapping above before
|
|
108
|
+
relying on the new checks. Consumers should bind the workflow run's exact
|
|
109
|
+
path/ref, `pull_request_target` event and
|
|
110
|
+
`gke-pr #<PR number> <40-hex head SHA>` title to the current live PR head, then
|
|
111
|
+
require the newest matching run to conclude `success`. A missing, skipped,
|
|
112
|
+
cancelled or refused run is not success. A push after a live-state read can
|
|
113
|
+
leave only an old-head result; the consumer must recheck the current head.
|
|
114
|
+
|
|
115
|
+
Main's rules judge candidate workflows. A new runner label or a rule relaxation
|
|
116
|
+
therefore needs two changes: first expand the base checker/configuration
|
|
117
|
+
without using the relaxation in a workflow, then change the workflow.
|
|
118
|
+
Tightening a workflow must satisfy the base rules too. Bootstrap this workflow
|
|
119
|
+
on `main` and configure the runner entry before expecting it to run for later
|
|
120
|
+
PRs; its first adoption PR still needs independent CI evidence.
|
|
121
|
+
|
|
122
|
+
The checker and its mutation controls use only Python's standard library plus
|
|
123
|
+
pytest for the tests. File-reading modes list their inputs, refuse credential
|
|
124
|
+
paths and `*.env`, and reject symlinks before opening files. Full tests,
|
|
125
|
+
engine-enabled corpus compilation and the Pyodide gate must run in CI or on
|
|
126
|
+
the designated build box; a source inspection is not an execution verdict.
|
|
@@ -5,18 +5,26 @@ from collections.abc import Mapping
|
|
|
5
5
|
from .lexer import Lexer
|
|
6
6
|
from .parser import Parser
|
|
7
7
|
from .analyzer import Analyzer
|
|
8
|
+
from .analyzer.value_bindings import ValueBindings
|
|
8
9
|
from .codegen import CodeGen
|
|
10
|
+
from .cpp_allowlist import REASONS, check_generated_cpp
|
|
9
11
|
from .diagnostic_codes import diagnostics_catalog, render_diagnostic
|
|
10
|
-
from .errors import
|
|
12
|
+
from .errors import (
|
|
13
|
+
CodegenInvariantError, CompileError, Diagnostic, Level, Phase, SourceLocation,
|
|
14
|
+
)
|
|
11
15
|
from .external_requests import lower_no_data_requests
|
|
12
16
|
from .builtin_keywords import bind_builtin_keywords
|
|
13
17
|
from .finite_ta_length import expand_finite_choice_extrema_lengths
|
|
18
|
+
from .function_overloads import bind_scalar_overloads
|
|
14
19
|
from .library_inline import inline_libraries
|
|
15
20
|
from .limits import TimeBudget, check_ast_depth, check_source_size, ensure_recursion_headroom
|
|
21
|
+
from .method_binding import validate_call_argument_order
|
|
16
22
|
from .pragmas import extract_pf_trace_pragmas
|
|
17
23
|
from .request_discovery import discover_requests, request_sites
|
|
18
24
|
from .request_feed_inventory import build_request_feed_inventory
|
|
19
|
-
from .security_contexts import
|
|
25
|
+
from .security_contexts import (
|
|
26
|
+
specialize_method_security_payloads, specialize_security_contexts,
|
|
27
|
+
)
|
|
20
28
|
from .block_locals import rename_block_locals
|
|
21
29
|
from .support_checker import check_support as _support_diagnostics
|
|
22
30
|
from .support_checker import check_support_or_raise
|
|
@@ -39,6 +47,7 @@ def _parse_bounded(pine_source: str, filename: str, budget: TimeBudget | None =
|
|
|
39
47
|
budget=budget).parse()
|
|
40
48
|
check_ast_depth(ast, filename)
|
|
41
49
|
budget.check(phase=Phase.PARSER)
|
|
50
|
+
validate_call_argument_order(ast, filename=filename)
|
|
42
51
|
return ast, pragmas, budget
|
|
43
52
|
|
|
44
53
|
|
|
@@ -68,6 +77,7 @@ def _generate(pine_source: str, check_support: bool, filename: str,
|
|
|
68
77
|
ast, pragmas, budget = _parse_bounded(pine_source, filename, budget)
|
|
69
78
|
ast = inline_libraries(ast, pine_source, libraries=libraries,
|
|
70
79
|
filename=filename, budget=budget)
|
|
80
|
+
ast = bind_scalar_overloads(ast, budget=budget)
|
|
71
81
|
rename_block_locals(ast, renamed)
|
|
72
82
|
support_diagnostics = []
|
|
73
83
|
if check_support:
|
|
@@ -75,6 +85,7 @@ def _generate(pine_source: str, check_support: bool, filename: str,
|
|
|
75
85
|
if any(d.level == Level.ERROR for d in support_diagnostics):
|
|
76
86
|
raise CompileError(support_diagnostics)
|
|
77
87
|
budget.check(phase=Phase.ANALYZER)
|
|
88
|
+
ValueBindings(ast, filename, budget).resolve()
|
|
78
89
|
sites = request_sites(ast)
|
|
79
90
|
ast = lower_no_data_requests(ast)
|
|
80
91
|
ast = specialize_security_contexts(ast, filename=filename)
|
|
@@ -83,14 +94,37 @@ def _generate(pine_source: str, check_support: bool, filename: str,
|
|
|
83
94
|
budget.check(phase=Phase.ANALYZER)
|
|
84
95
|
ctx = Analyzer(ast, filename=filename, budget=budget,
|
|
85
96
|
session_clones=clones).analyze()
|
|
97
|
+
# Typed receiver dispatch is known only after analysis. Resolve method
|
|
98
|
+
# payload arguments with those bindings, then type the rewritten bodies.
|
|
99
|
+
if specialize_method_security_payloads(
|
|
100
|
+
ast, ctx.method_call_bindings, filename=filename):
|
|
101
|
+
del ctx
|
|
102
|
+
ast = bind_builtin_keywords(expand_finite_choice_extrema_lengths(ast))
|
|
103
|
+
check_ast_depth(ast, filename)
|
|
104
|
+
ctx = Analyzer(ast, filename=filename, budget=budget,
|
|
105
|
+
session_clones=clones).analyze()
|
|
86
106
|
budget.check(phase=Phase.ANALYZER)
|
|
87
107
|
# Attach after analysis: pragma expressions are not part of the
|
|
88
108
|
# program body, so the analyzer never inspects them; the codegen
|
|
89
109
|
# consumes them directly from the context to emit the on_bar tail
|
|
90
110
|
# ``if (trace_enabled_) { trace(...); ... }`` block.
|
|
91
111
|
ctx.pf_trace_pragmas = pragmas
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
try:
|
|
113
|
+
gen = CodeGen(ctx, budget=budget)
|
|
114
|
+
cpp = gen.generate()
|
|
115
|
+
except CodegenInvariantError as error:
|
|
116
|
+
node_kind = error.node_kind
|
|
117
|
+
location = getattr(error.node, "loc", None)
|
|
118
|
+
if location is None:
|
|
119
|
+
raise RuntimeError(
|
|
120
|
+
f"Internal error: AST node '{node_kind}' has no source "
|
|
121
|
+
"location for its missing value lowering."
|
|
122
|
+
) from error
|
|
123
|
+
raise CompileError([Diagnostic(
|
|
124
|
+
level=Level.ERROR, phase=Phase.CODEGEN, location=location,
|
|
125
|
+
message=f"Internal error: no value lowering for AST node '{node_kind}'.",
|
|
126
|
+
hint="Report this translator error to PineForge.",
|
|
127
|
+
)]) from error
|
|
94
128
|
budget.check(phase=Phase.CODEGEN)
|
|
95
129
|
apart = gen.block_locals_needing_names - renamed
|
|
96
130
|
if apart:
|
|
@@ -99,6 +133,18 @@ def _generate(pine_source: str, check_support: bool, filename: str,
|
|
|
99
133
|
continue
|
|
100
134
|
needed = gen.session_functions_needing_clones
|
|
101
135
|
if not needed:
|
|
136
|
+
findings = check_generated_cpp(cpp)
|
|
137
|
+
if findings:
|
|
138
|
+
raise CompileError([
|
|
139
|
+
Diagnostic(
|
|
140
|
+
level=Level.ERROR,
|
|
141
|
+
phase=Phase.CODEGEN,
|
|
142
|
+
location=SourceLocation(file=filename, line=1, col=1, end_col=1),
|
|
143
|
+
message=REASONS[finding.rule],
|
|
144
|
+
hint="Report this generated C++ allowlist failure to PineForge.",
|
|
145
|
+
)
|
|
146
|
+
for finding in findings[:20]
|
|
147
|
+
])
|
|
102
148
|
return gen, ctx, cpp, support_diagnostics, sites
|
|
103
149
|
# Only uncloned functions ask, so the set grows each time and the
|
|
104
150
|
# loop ends by the time every function that reads a flag at an
|