Skip to content

Lower price-less strategy.exit to the bracket-cancel command and read the first-tick predicate through its accessor (R4-D W5) - #130

Merged
luisleo526 merged 2 commits into
mainfrom
refactor/adapter-lowering-20260914
Sep 19, 2026
Merged

luisleo526 merged 2 commits into
mainfrom
refactor/adapter-lowering-20260914

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

Slice C (R4-D, adapter-to-native lowering) — codegen side, paired with pineforge-engine PR #254.

  • Price-less strategy.exit(id, from_entry, comment) now lowers to strategy_exit_cancel_bracket(exit_id, from_entry, comment) instead of strategy_close(id, comment); the from_entry id is no longer discarded. Priced exits and every other command route are unchanged.
  • barstate.isnew reads is_first_tick() instead of the protected member is_first_tick_ (contract P13); history_advances_new_bar() / security_series_slot_is_new() unchanged.
  • Every generated TU carries #ifndef PINEFORGE_HAS_NATIVE_LOWERING_V1 / #error / #endif after the engine includes (no fallback; the switched engine defines the macro in pineforge/source/pine_strategy_host.hpp).
  • Goldens regenerated; text-level tests added for both exit shapes, the accessor, the capability fence and the convert_to_account/symbol identity lowering. support_checker, signatures and the official surface are unchanged.

Verification (local): pytest -q 1932 passed / 581 skipped / 0 failed; git diff --check clean; Python-re scan over goldens: 0 protected-member references, 0 strategy_close( from price-less exits. The compile-backed suite runs against the engine PR #254 tree at integration; the composite Cloud Run sweep over the 4190-probe corpus follows on the final engine+codegen pair (one sweep per PR).

Evidence: tasks/r4-d/LANDING-W5-CODEGEN-REPORT.md in the campaign evidence directory. Requires the engine at or after PR #254 (L3a).

🤖 Generated with Claude Code

https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm

luisleo526 and others added 2 commits September 15, 2026 09:46
… the first-tick predicate through its accessor (R4-D W5)

Lower price-less strategy.exit to strategy_exit_cancel_bracket with from_entry and comment preservation.

Require PINEFORGE_HAS_NATIVE_LOWERING_V1 in every generated translation unit, route barstate.isnew through is_first_tick(), and regenerate generated-output goldens and exact byte pins.

Contract: §4; §2 P13; amendment A22.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm
Adds a "What this owns" note: this repo does Pine->C++ translation only,
emitting the GeneratedStrategy (indicator math + strategy.* calls) on the
engine's PineStrategyHost with code that attaches the engine's Pine execution
adapter. Execution/fill/bracket/margin and TradingView parity live in the
engine's source-adapter runtime (src/source/), not here. Updates "How it works"
and "Explicit Pine execution attachment" to describe the adapter as the engine's
full Pine execution runtime that codegen attaches, against a matching ABI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSmYixVAp4NqWpBZxkrLPT
@luisleo526
luisleo526 marked this pull request as ready for review September 19, 2026 15:21
@luisleo526
luisleo526 merged commit 89645d6 into main Sep 19, 2026
9 checks passed
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