Skip to content

Live runner: refuse compiled strategies a close-only stream cannot honour (capability receipt v1) - #332

Merged
luisleo526 merged 2 commits into
mainfrom
lv/f08-capabilities
Oct 4, 2026
Merged

luisleo526 merged 2 commits into
mainfrom
lv/f08-capabilities

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Summary

The native live runner can now prove, before it binds a ledger, that a compiled strategy library is eligible for its close-only stream. It refuses by name any library whose declarations that stream cannot honour. Before this change, a library that needed intrabar calculation or other non-close-only behaviour could run close-only and silently compute a different strategy.

  • Additive capability extension v1, per strategy, discovered with dlsym, like the checked-settings extension:
    • strategy_capabilities_api_version() returns 1;
    • strategy_capabilities_receipt(...) returns canonical JSON through the checked-settings buffer protocol;
    • the receipt lists the compiled execution declarations, the requested series and sites, the runtime requirements, and anything the analysis could not resolve;
    • the bytes are immutable across fresh and reused handles;
    • PF_ABI_VERSION, the kernel and every batch path are unchanged.
  • Runner admission policy. It admits only what an equivalence test proves and refuses everything else by name, before any ledger exists. Refused:
    • calc_on_every_tick, calc_on_order_fills, calc_on_every_history_tick, process_orders_on_close and use_bar_magnifier when true;
    • non-default fill assumptions;
    • every request.*, including request sites whose data is not pinned;
    • auxiliary or native security feeds, FX curves and recorded series;
    • the bar-state builtins whose meaning differs between history and realtime: barstate.islast, barstate.islastconfirmedhistory, last_bar_index, last_bar_time, barstate.isrealtime, timenow. This includes display-only use;
    • any declaration the analysis could not resolve to a literal.
      The receipt is bound into the deployment identity, so a changed receipt on resume is refused. A legacy library without the extension warns and runs, under the same policy as checked settings.
  • Docs. docs/strategy-capabilities.md and runner/README.md say exactly what is refused and why, with a link to "Backtest vs live". Refusing requests and POOC is deliberately conservative; shapes that the stream equivalence tests prove can be admitted in a later change.

Verification

  • Runner end-to-end tests driven by codegen-emitted libraries, one per refused declaration and per admitted class: each refusal happens before the ledger exists.
  • A batch-vs-stream equivalence test for every admitted class.
  • A test that a changed receipt alone moves the deployment identity, and that the routing wrap is applied last.
  • A check that the generated fixtures still match fresh codegen output.
  • Corpus parity 312/312, 0 moved.
  • Engine bundles (pineforge/verify) and a coordinated parity sweep with the paired codegen change (pineforge/parity).
  • Three independent reviews: BLOCK, then fixes; MERGE-WITH-FIXES, then fixes; then MERGE.

🤖 Generated with Claude Code

luisleo526 and others added 2 commits October 4, 2026 17:56
Add an optional versioned capability receipt and conservative pre-ledger admission. Record compiled execution declarations and analyzed request/feed requirements, refuse unsupported or unresolved requirements by name, and bind receipt bytes before the routing identity wrap.

Cover generated-library refusals, receipt protocol and determinism, legacy warning compatibility, changed-receipt recovery and admitted-class batch/stream equivalence. Document display-only builtin refusal and the unchanged conservative request and POOC policy.

This additive extension belongs to the next release. Record it under Unreleased without changing the released notes, base C ABI version, kernel, matching, margin or default batch computation.
A legacy example library without a capability receipt now prints the
documented warning at startup; the routing test parses the remaining stderr
lines as delivery-error JSON, so it must skip that line like the checked
settings warning.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@luisleo526
luisleo526 merged commit f3bf9f0 into main Oct 4, 2026
17 checks passed
@luisleo526
luisleo526 deleted the lv/f08-capabilities branch October 4, 2026 12:18
luisleo526 added a commit that referenced this pull request Oct 5, 2026
* docs: release notes and version scoping for v1.2.0

CHANGELOG: the Unreleased section becomes 1.2.0 (2026-10-05), a minor
release that adds the compiled execution-capabilities extension to the C
ABI (PF_CAPABILITIES_API_VERSION, strategy_capabilities_api_version,
strategy_capabilities_receipt). One bullet per change since v1.1.0 with
its PR (#328, #330, #331, #332, #333, #334, #335, #336, #337, #338 and the
session-clock change, written #VCP until its PR number exists), the
recipe additions under State hashes (#328, #330, #335; domain tags and
epoch unchanged), Report keys (docker/run_json.py is byte-identical to
v1.1.0's, so no key changes) and Migration.

Version scoping: README, install and public-contract pages name v1.2.0
and codegen 1.2.0; "since the next release" and "fixed on main" in the
capabilities guide and the runner guide become 1.2.0 and 1.1.0 (#325).
Lines that state what an earlier release shipped stay.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs: 1.2.0's grades from the facts tokens, #339, and codegen's license

- CHANGELOG: the session-clock change is #339 (merged as 52292db), in place
  of the #VCP token of 3082fbd; the "What a script author sees" bullet of
  3082fbd now states release 1.2.0's grades (registry baseline
  pineforge-parity-baseline-20261005-engine-52292db9: 7,970 excellent / 19
  strong of 7,989, none below strong) instead of the main scoreboard at
  6b77f06.
- README: the release sentence names 1.2.0 and renders releases[1.2.0], and
  the main scoreboard renders the same baseline, from pineforge-release
  facts/facts.json at 0c2f6838 (the facts export for the 1.2.0 release).
- README, LEGAL.md, docs/pages/index.md: pineforge-codegen is under the
  PineForge Source License 1.1 from its release 1.2.0; releases up to 1.1.0
  keep the PolyForm Noncommercial terms they shipped with.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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