Skip to content

codegen: var color state inside a request.security helper (Part of #229) - #255

Closed
luisleo526 wants to merge 3 commits into
mainfrom
cgi/229a
Closed

luisleo526 wants to merge 3 commits into
mainfrom
cgi/229a

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

codegen: var color state inside a request.security helper

A helper-local var of Pine type color evaluated by request.security was refused (#229, second pattern). It now keeps its state in the helper's double series: the packed 32-bit ARGB value is exactly representable, na is stored as NaN and read back as the ordinary color integer. The type is taken from the declaration (type hint, analyzed type, or a color-valued initializer), never from a name or a literal.

  • Unchanged: the epoch-width int64 refusal (PF-E3015, same text), varip, and collection / UDT / drawing state stay refused. The remaining non-scalar refusal has a new code PF-E3093 whose text also names color; PF-E3015 stays pinned and is used for the epoch-width case only.
  • AGENTS.md's helper var state row lists color.

Tests (red first, expected values from controls: a helper without var, the chart's own var color): the reporter's script, explicit and inferred declarations, transparency (alpha above 2^31), persistence when the next requested bar does not assign, na seed and reassignment, and the unchanged boundaries. Lab (CLOUD, paired engine main): red 10 failures on the old refusal, green 10644 passed / 0 failed (+ compile-corpus 312 earlier), raw-bytes comparison of 555 scripts identical to the base.

Part of #229 (the helper-parameter history half is a separate design, not in this PR).

🤖 Generated with Claude Code

luisleo526 and others added 3 commits October 26, 2026 11:38
…or half)

Red-first tests: the reporter's script must translate, explicit and
inferred color declarations are typed from the Pine type, the requested
value must match a helper without var, a color set on one requested bar
must persist when the next bar does not assign it, na colors must match
chart state, and epoch-width int, varip and collection state stay refused.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…color half)

A helper-local var of Pine type color now keeps its state in the helper's
double series: the packed 32-bit ARGB value is exactly representable, na is
preserved, and reads cast back to the ordinary color integer type. The type is
taken from the declaration (type hint, analyzed type, or color-valued
initializer), never from a name or a literal. The epoch-width int64 refusal
and the collection / UDT / drawing refusals are unchanged; their message for
non-int64 types now also names color (new code PF-E3093; PF-E3015 stays
pinned).

Part of #229

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…F-E3093; AGENTS.md lists colour (#229, var color half)

The boundary test (epoch-width int64, varip, collection stay refused) no longer
carries the colour positive control, which is its own test, and its collection
case asserts the new code PF-E3093 instead of matching the old sentence by
prefix. AGENTS.md's helper `var` state row names colour (packed exact 32-bit
ARGB in the double series, na as NaN, read back as int64_t).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
luisleo526 added a commit that referenced this pull request Oct 26, 2026
…ialization, request.currency_rate, helper-local var color, one-line field assignment) (#261)

## What

This branch carries five codegen fixes planned for 1.8.0. It is five merge commits on `main`, one per pull request, in this order, followed by one CHANGELOG commit.

| Merged pull request | Fix |
|---|---|
| #260 | A `calc_on_order_fills` recalculation after a fill no longer rolls back the state of a deferred `request.security` evaluation (a silent wrong value, for example after a late margin-call liquidation). |
| #259 | A persistent (`var`) UDT, array, map or matrix whose initializer reads an earlier computed value is initialized once, in statement order (Fixes #226). A `varip` declaration with the same dependency still reads the default; that gap is tracked in #258. |
| #254 | `request.currency_rate` raises its error only where the call is evaluated, not where it merely appears in a branch that never runs (Fixes #228). |
| #255 | `var color` state inside a `request.security` helper, explicit or inferred, with persistence, transparency and `na` (Part of #229). The refusal for any other unsupported helper-local `var` type has the new code `PF-E3093`. |
| #253 | A UDT field assignment as the body of a one-line function or method (Part of #230). |

The CHANGELOG commit puts all five entries in the planned 1.8.0 section, updates its summary and compatibility notes, and removes the separate planned-patch section one of the merged branches added.

## Scope and limits

- The five merge commits resolved no code conflict; the only textual conflicts were in `CHANGELOG.md`, replaced once by the last commit. The name-status against `main` is the union of the five pull requests' own files (28 files).
- Over the 555 corpus and fixture scripts the emitted C++ differs from `main` in 72 scripts, all from the #260 change and only inside `restore_script_state()`; the other 483 are byte-identical. The other four fixes change no script of the 555; their tests cover their shapes.
- The user-facing text of two diagnostics (`PF-E1088`, `PF-W1088`) is reworded and one code is added (`PF-E3093`); the catalog schema is unchanged.
- The second half of #229 (the history of a derived helper argument) and the `varip` gap (#258) are not in this branch; they follow as separate pull requests.

## Tests

- Full suite on the head of this branch with the paired engine: 10725 passed, 221 skipped (private fixtures and empty parameter sets, the same 221 as `main`), 0 failed.
- A parity sweep over the whole population (7989 graded probes): PASS, no regression and no improvement (hard gate: 1009 evaluated, no moves; coverage complete).
- Every pull request above keeps the tests it was reviewed with; this branch adds no test of its own.

Fixes #226, Fixes #228. Part of #229, Part of #230.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@luisleo526

Copy link
Copy Markdown
Contributor Author

Superseded by #261, which carried this fix into the 1.8.0 release.

@luisleo526 luisleo526 closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant