Skip to content

Emit GeneratedStrategy on pineforge::source::PineStrategyHost (R4-C source-layer cut, paired with engine) - #129

Merged
luisleo526 merged 3 commits into
mainfrom
refactor/source-host-20260914
Sep 14, 2026
Merged

luisleo526 merged 3 commits into
mainfrom
refactor/source-host-20260914

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

Paired codegen half of the engine R4-C source-layer cut (roadmap slice B). Generated behaviour is unchanged: this PR only re-targets the generated class at the explicit source host.

Landing 1 (this head)

  • #include <pineforge/source/pine_strategy_host.hpp> replaces the engine include.
  • class GeneratedStrategy : public pineforge::source::PineStrategyHost.
  • The bar callback is emitted as on_source_bar(const Bar&) override (the host's on_bar is final and forwards).
  • Constructor writes, set_strategy_override, the cap/priority attach block and the run/stream emission are unchanged here (landing 4 moves them onto the declared PineStrategyConfig/adapter surface).
  • Golden diff = exactly three substitutions; support_checker, signatures, official-surface tests unchanged.

Verification: full pytest with the compile-backed suites pointed at the engine L1 include tree: 2813 passed, 2 skipped.

Still to come on this branch

Landing 4 (config initializer + adapter override + risk setters) after the engine transfer lands; then ONE composite Cloud sweep (engine head + this head) with zero-diff readback, snapshot and the actual pr-gate before this PR is marked ready. No R4 credit is claimed by this slice.

🤖 Generated with Claude Code

https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm

…e on_source_bar hook (R4-C L1)

Change only the L1 generated-source include, base class, and callback hook; preserve constructor writes, the cap/priority bridge, strategy overrides, and run/stream emission (contract §0.2; §5 L1).

Regenerate the checked golden and refresh textual/hash pins that intentionally cover the generated output; add the one requested base-class documentation sentence (contract §5 L1; amendments A8 and A27).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm
…tters (R4-C L4)

Route the 13 constructor facts through PineStrategyConfig and configure_pine_strategy, route the ten runtime override keys and every supported dynamic risk key through the source-host API, and refresh the golden/output pins for the intentionally changed generated boilerplate (contract §5; amendments A5, A8, A13, A20, A21, A22, A32).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm
@luisleo526

Copy link
Copy Markdown
Contributor Author

L4 landed: head 8a8f330. The generated constructor now builds one pineforge::source::PineStrategyConfig cfg{} (same 13 facts, same order) and makes exactly one configure_pine_strategy(cfg) call before any metadata; set_strategy_override fills a source::StrategyOverrides (10 keys, same conversions) and calls the host entry once; strategy.risk.* statements emit the six explicit source-host setters (max_intraday_filled_ordersset_pine_risk_max_intraday_filled_orders((int)expr), the old integer-assignment attach). run_backtest/stream emission, visit_call.py, support_checker, signatures, official-surface tests unchanged. Golden: +40/−27, all inside the constructor/override/risk blocks.

pytest: 1926 passed offline; 2816 passed / 2 skipped with the compile-backed suites against the engine source-layer headers (incl. 314 corpus compiles). Fable final review and the composite Cloud sweep (engine 6e9b908 + this head) follow before ready.

…d compile-backed tests (R4-C L5)

Add text pins for Pine risk-direction encoding and percent/cash setter arguments.

Add generated C++ runtime probes for short-only entry rejection and sticky percent max-drawdown behaviour.

Contract rules: A33, A34; FINAL REVIEW P0-1/P1-1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016iF71UAEuQ7F6eqWgecAHm
@luisleo526

luisleo526 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

L5 landed: head 763d2eb (tests only, +123 lines). Pins the emitted Pine direction convention (.shortset_pine_risk_direction(-1), .long1, .all0) and the percent-flag argument (true only for strategy.percent_of_equity), plus two compile-backed runtime probes proving a short-only policy drops a long entry and that percent-then-cash keeps the sticky percent interpretation — both against the engine L5 head 2c964db (the engine-side mapping/sticky-flag repairs from the final review). Full pytest with compile-backed suites: 2820 passed / 2 skipped.

@luisleo526

Copy link
Copy Markdown
Contributor Author

Engine half merged as ab9714b (PR #253). Final pair evidence: composite sweep exp-native-r4-c-1938fe0-20260914 4190/4190 zero trade/grade/metadata/coverage differences, actual pr-gate FAIL target.not-positive (expected neutral), baseline stable; this head 763d2eb compile-backed against the engine head: 2820 passed. Marking ready and squash-merging.

@luisleo526
luisleo526 marked this pull request as ready for review September 14, 2026 12:25
@luisleo526
luisleo526 merged commit de42333 into main Sep 14, 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