Skip to content

Fix engine execution cases and selected-capacity admission for 1.12.0 - #824

Closed
luisleo526 wants to merge 1 commit into
mainfrom
fix/engine-batch-1
Closed

luisleo526 wants to merge 1 commit into
mainfrom
fix/engine-batch-1

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Include #797, #804, #817, #801, #816 and #820: closed-trade cache placement, fill-time drawdown halt and flatten, reversal exit sizing and its class cases, selected-capacity admission, and the percent default quantity cap.

Document the intentional replacement of these earlier descriptions:

Re-anchor the remaining documentation citations and move the private-fixture registration evidence anchor from line 3470 to the actual token at line 3476. Preserve its row, predicate and reason; no new parity result or closed surface is claimed.

Closes #803, closes #804, closes #805.

This is the 1.12.0 batch-1 train as one commit (supersedes #822 and #808), so that every documentation deletion it makes is named in its own message.

🤖 Generated with Claude Code

Include #797, #804, #817, #801, #816 and #820: closed-trade cache placement, fill-time drawdown halt and flatten, reversal exit sizing and its class cases, selected-capacity admission, and the percent default quantity cap.

Document the intentional replacement of these earlier descriptions:

- docs/design/native-feature-parity.md, introduced by 91d65ad: the old `update_risk_state(bar.close)` once per script bar at the close mark description is obsolete after #804. The cell now describes the fill-time peak, closing-fill threshold, halt latch and immediate flatten. Preserve MG10-a and MG10-b as HISTORICAL, measured on engine f5e929d, before the #804 change, with their values, claim status and grade unchanged.
- docs/pages/memory-management.md, introduced by ba14721: "Storage is private: a global ordinal chooses one four-way set" no longer describes placement below the cap after #797 (653be41). Row n owns slot n while retained rows fit the cap; above it the existing four-way sets apply. Crossing the cap invalidates hot rows while retaining allocated pages.
- docs/pages/memory-management.md, introduced by 69cddc9: "Page growth preserves entries through the 64/128/256 boundaries." is replaced by the current 256-slot page-boundary rule, which preserves entries through every page boundary within the cap.

Re-anchor the remaining documentation citations and move the private-fixture registration evidence anchor from line 3470 to the actual token at line 3476. Preserve its row, predicate and reason; no new parity result or closed surface is claimed.

Closes #803, closes #804, closes #805.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Retain the decoy outside the install location; delete no file.
configure_decoy.rename(root / "retained-configure-decoy")
self.run_command(["cmake", "--install", str(build)])
binary = check_install(configure_prefix, chosen_sha, True)
configure()
build_all()
self.run_command(["cmake", "--install", str(build)])
binary = check_install(configure_prefix, chosen_sha, False)
import subprocess
import sys
import tempfile
import unittest
while position < len(data):
count = os.write(input_write, data[position:position + 4096])
position += count
except BrokenPipeError:
position += count
except BrokenPipeError:
pass
except BaseException as error:
total += len(chunk)
if total >= len(HEADER):
resume.set()
except BaseException as error:
self.assertGreater(count, 0)
written[0] += count
pending = pending[count:]
except BaseException as error:
if not chunk:
break
forwarded.append(chunk)
except BaseException as error:

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; formal verification proved 0 of 10 changed function(s) (10 not verified).

Formal verification. PR-changed functions: 0/10 verified (0 proven, 0 may-equivalent, 0 distinguished) · 10 not verified (10 unsupported).

Not verified on this run: resize (unsupported), cancel\_reversal\_exit\_owners (unsupported), default\_sizing\_cash (unsupported), on\_applied (unsupported), place\_entry (unsupported), pooc\_fee\_units (unsupported), reset\_for\_run (unsupported), retire\_in\_position\_exits\_at\_flat (unsupported), update\_risk\_state (unsupported), on\_native\_applied (unsupported).


Graphify review — findings

Adds the pineforge-selected-admit helper, installed with a JSON manifest at fixed bin/ and share/pineforge/ paths. An install-time script writes the manifest (version, git SHA, spec and catalog hashes, stage list), so it has to describe the exact executable installed beside it. The stage list falls back to ["selected"] when stage_source.cpp is absent. Changes strategy semantics. A percent-of-equity default quantity is capped at 100% when both margins are 0. Named exits placed with a reversing strategy.entry are sized from the new entry's own quantity. strategy.risk.max_drawdown is now tested at closing fills, where a breach closes all positions, cancels pending orders and blocks later entries. Places closed-trade cache rows by ordinal while a run fits the cache, so reads make one probe and only touched pages are committed. Past capacity it falls back to four-way sets and drops the cached rows when the run crosses the boundary.

Worth a look

  • Concurrent installs can publish a manifest for a different executable — cmake/PineForgeSelectedAdmitManifest.cmake:8 · Escalate · medium
    • unverified hypothesis — survived the adversarial refute pass; needs human review

Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 4490 functions depend on the 4216 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: native_run_spec_digest() — 17 callers, 3 callees
  • new: parse() — 6 callers, 8 callees
  • worse: find() — 10 callers, 4 callees
  • new: check_install() — 5 callers, 5 callees
  • worse: run_driver() — 1 callers, 15 callees
  • new: grid_neighbours() — 5 callers, 3 callees
  • new: expect_byte_refusal() — 4 callers, 3 callees
  • new: render_result() — 1 callers, 11 callees
  • …and 13 more — each is listed as a finding

Verification — 4490 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 4385 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

1420 of 1420 test file(s) selected (100%) via static blast radius.

Escalated to a full run for safety (noncode-change, uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.

  • benchmarks/tests/test_aggregate.py — full-run-safety
  • benchmarks/tests/test_check_provenance.py — full-run-safety
  • benchmarks/tests/test_compare.py — full-run-safety
  • benchmarks/tests/test_public_names.py — full-run-safety
  • benchmarks/tests/test_run_all.py — full-run-safety
  • benchmarks/tests/test_run_strategy_feeds.py — full-run-safety
  • docker/pineforge_sink_finalize_test.py — full-run-safety
  • docker/pineforge_sink_replay_rq_test.py — full-run-safety
  • docker/pineforge_sink_replay_test.py — full-run-safety
  • docker/pineforge_sink_to_json_test.py — full-run-safety
  • docker/quota_columns_test.py — full-run-safety
  • docker/quota_convert_test.py — full-run-safety
  • docker/quota_finalize_test.py — full-run-safety
  • docker/replay_rq_engine_test.py — full-run-safety
  • docker/run_json_artifact_window_test.py — full-run-safety
  • docker/run_json_bin_test.py — full-run-safety
  • docker/run_json_bounded_transport_test.py — full-run-safety
  • docker/run_json_bulk_equity_fuzz_test.py — full-run-safety
  • docker/run_json_bulk_equity_test.py — full-run-safety
  • docker/run_json_codes_test.py — full-run-safety
  • docker/run_json_converter_metadata_test.py — full-run-safety
  • docker/run_json_converter_session_test.py — full-run-safety
  • docker/run_json_diagnostics_test.py — full-run-safety
  • docker/run_json_equity_scan_test.py — full-run-safety
  • docker/run_json_fused_test.py — full-run-safety
  • docker/run_json_harnesses_test.py — full-run-safety
  • docker/run_json_metrics_only_test.py — full-run-safety
  • docker/run_json_misc2_test.py — full-run-safety
  • docker/run_json_misc_test.py — full-run-safety
  • docker/run_json_pfbar_test.py — full-run-safety
  • docker/run_json_provenance_test.py — full-run-safety
  • docker/run_json_quota_supervisor_test.py — full-run-safety
  • docker/run_json_replay_test.py — full-run-safety
  • docker/run_json_selected_sink_test.py — full-run-safety
  • docker/run_json_sink_lexical_test.py — full-run-safety
  • docker/run_json_sink_summary_test.py — full-run-safety
  • docker/run_json_sink_test.py — full-run-safety
  • docker/run_json_sink_vectors_test.py — full-run-safety
  • docker/run_json_spool_work_test.py — full-run-safety
  • docker/run_json_stringio_test.py — full-run-safety
  • docker/run_json_symbol_feeds_test.py — full-run-safety
  • docker/run_json_syminfo_test.py — full-run-safety
  • docker/run_json_trade_scan_test.py — full-run-safety
  • docker/run_json_window_budget_test.py — full-run-safety
  • docker/run_json_wrapper_work_test.py — full-run-safety
  • include/pineforge/native_run_spec.hpp — full-run-safety
  • scripts/derive_corpus_feeds_self_test.py — full-run-safety
  • scripts/fingerprint_self_test.py — full-run-safety
  • scripts/run_corpus_self_test.py — full-run-safety
  • scripts/test_abi_receipt_skips.py — full-run-safety
  • … and 1370 more

non-code file(s) changed (CHANGELOG.md, CMakeLists.txt, ci/cr150-source-bounds.yaml, ci/cr150-source-sites.json, cmake/PineForgeSelectedAdmitManifest.cmake …) → running the full suite for safety (a code graph can't see config/fixture/data deps)

changed code file(s) with no mapped test (CHANGELOG.md, docs/adr/0001-kernel-adapter-boundary.md, docs/ci.md, docs/design/arena-bound.md, docs/design/consumed-partial-exit-fold.md …) — a coverage gap or a missing link — running the full suite rather than only the selected tests

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Docs that may be stale (advisory)

…and 10 more.

Formal verification

Could not verify: Could not verify resize.

The verifier did not have enough to check resize, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify cancel\_reversal\_exit\_owners.

The verifier did not have enough to check cancel\_reversal\_exit\_owners, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify default\_sizing\_cash.

The verifier did not have enough to check default\_sizing\_cash, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify on\_applied.

The verifier did not have enough to check on\_applied, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify place\_entry.

The verifier did not have enough to check place\_entry, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify pooc\_fee\_units.

The verifier did not have enough to check pooc\_fee\_units, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify reset\_for\_run.

The verifier did not have enough to check reset\_for\_run, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify retire\_in\_position\_exits\_at\_flat.

The verifier did not have enough to check retire\_in\_position\_exits\_at\_flat, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify update\_risk\_state.

The verifier did not have enough to check update\_risk\_state, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

Could not verify: Could not verify on\_native\_applied.

The verifier did not have enough to check on\_native\_applied, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: unsupported: member function — receiver/self (`this`) not synthesizable from the simple-type literal pools — abstaining rather than guessing a receiver

· 17 grounded finding(s) anchored inline below; 4 more finding(s) on lines outside this diff (see the check run).


} // namespace

int main() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — main()

fans out to 11 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

CHECK(got.open_at_end == expected.open_at_end);
}

void check_exits(const Scenario& spec, const std::vector<Bar>& bars, const Observed& got) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — check_exits()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

CHECK(old_rows == 1);
}

void check_exits(const Scenario& spec, const std::vector<Bar>& bars, const Observed& got) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — check_exits()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

got.final_units, got.error.c_str());
}

void run_case(const Scenario& spec) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — run_case()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

CHECK(got.open_at_end == expected.open_at_end);
}

void check_exits(const Scenario& spec, const std::vector<Bar>& bars, const Observed& got) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — check_exits()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

}
}

void empty_source_and_auxiliary_headers_are_charged() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — empty_source_and_auxiliary_headers_are_charged()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

check_primary_prefix(run, 1);
}

void expect_byte_refusal(Run& run, std::uint64_t limit, std::uint64_t used,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — expect_byte_refusal()

high coupling complexity (Ca·Ce = 12).

Grounded coupling-delta finding (deterministic), not an LLM guess.

return true;
}

inline DecodeStatus decode_descriptor(std::string_view bytes, Stage stage,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — decode_descriptor()

fans out to 9 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

return j.finish();
}

inline std::string render_result(const Outcome& out) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — render_result()

fans out to 11 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

return sc::DriverReason::InternalError;
}

inline Outcome execute_stage_source(const Descriptor& d, const Seam& seam = Seam{}) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — execute_stage_source()

fans out to 6 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

@luisleo526

Copy link
Copy Markdown
Collaborator Author

Superseded by #825: the same batch without #820, which returns in the next batch.

@luisleo526 luisleo526 closed this Nov 11, 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

1 participant