Skip to content

Engine train B: gross-count grader (#878) and explicit preflight stage failures (#884) - #890

Open
luisleo526 wants to merge 9 commits into
mainfrom
train/engine-b-878-884
Open

luisleo526 wants to merge 9 commits into
mainfrom
train/engine-b-878-884

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Engine train B: two ready changes merged onto main as merge commits, without the partial-exit reservation and entry-quantity change that is held back for a fix.

Both members are byte-identical to their versions in #889 except CHANGELOG.md, which omits the held-back entries. #889 stays open for the held-back change.

Refs #836

🤖 Generated with Claude Code

luisleo526 and others added 9 commits November 15, 2026 22:25
The corpus grader compared trade counts as a net difference, so an unmatched
engine trade and an unmatched TradingView trade cancelled out. count_abs_delta
now adds every unmatched gated TradingView and engine trade, and excellent
requires it to be zero. The net difference stays available as
net_count_abs_delta; count_delta keeps the legacy relative difference for the
strong tier.

The pinned parity headline moves to excellent=301, strong=10, the regrade
measured in #836. All 312 pinned strategy trade outputs still match their
baseline hashes.
Bring the branch up to date with main before merging. No conflicts.
Tie the regrade totals to the population reported in #836 on 2026-11-11,
without presenting them as a new measurement or an activated baseline.
Keep the measured 312-reference parity expectation unchanged.

Reword these two historical sentences to add their dated population:

README.md: "The historical gross-count regrade recorded in [#836](#836) measured **7,959 excellent / 30 strong**: 24 probes moved from excellent to strong and none lower."

CHANGELOG.md: "Corrected the previously published parity grading: counting unmatched trades net instead of gross overstated the excellent tier by 10 of 312 reference probes (311 instead of 301) and by 24 of 7,989 graded probes on the recorded population."
Balanced unmatched trades can leave the two list sizes equal. Normalize the
canonical gross unmatched count by the larger compared population in both
aligned and zero-alignment paths. Strong grading and fragmented-FIFO metric
eligibility share that percentage and retain their existing thresholds.
The net count difference remains report-only.

Add real-tape boundary regressions with below-limit controls, and correct the
rescinded legacy-percentage expectations. Date the historical 24 movers and
7,959 excellent / 30 strong to the population reported on 2026-11-11.
Keep the existing 312-strategy headline pin pending the actual regrade.

Documentation provenance: intentionally replace or remove the following
sentences. The earlier Excellent/Strong definitions are included for the net
comparison with the preceding main revision. No other docs sentences are
removed by this change.

1. README.md: "The historical gross-count regrade recorded in [#836](#836) measured **7,959 excellent / 30 strong**: 24 probes moved from excellent to strong and none lower."

2. README.md: "- **strong** — ≥ 95% matched, difference in gated trade-list sizes below 6% of the larger count, entries within 0.1% and exits within 0.5% at p90;"

3. README.md: "The separate `net_count_abs_delta` (`net`) reports the difference in list sizes."

4. README.md: "The percentage metric, `count_delta`, retains the legacy relative difference in gated list sizes for the strong tier and other percentage comparisons."

5. README.md: "It can be zero when both sides have unmatched trades; that does not satisfy the excellent count gate."

6. README.md (earlier wording in the net comparison): "- **excellent** — the same number of trades, ≥ 99% of TradingView's trades matched, the distinct-entry identity check passed, entry and exit prices within 0.01% and PnL within 1% at the 90th percentile (trailing-stop scripts are graded on the *production* profile: exits within 0.02% and PnL within 1%, since a trail fill depends on TradingView's sub-bar path);"

7. README.md (earlier wording in the net comparison): "- **strong** — ≥ 95% matched, trade count within 6%, entries within 0.1% and exits within 0.5% at p90;"

8. CHANGELOG.md: "Corrected the previously published parity grading: counting unmatched trades net instead of gross overstated the excellent tier by 10 of 312 reference probes (311 instead of 301) and by 24 of 7,989 graded probes on the recorded population."

9. CHANGELOG.md: "The corpus grader counts every unmatched gated trade on either side as a gross mismatch for the excellent gate."

10. CHANGELOG.md: "One engine-only trade and one TradingView-only trade count as two mismatches, so equal list sizes cannot satisfy that gate."

11. CHANGELOG.md: "The count percentage and strong-tier rules retain their legacy calculation from the difference in gated list sizes (#836)."
Print each failed sub-step's name and exit status, then list every failed
binding stage in declaration order. Preserve raw child logs, exit codes,
and skip and advisory behavior when later independent checks pass.
The gross count percentage exposes an unchanged trade mismatch in
validation/mtf-triple-tf-macd-hist-confluence-01. Keep its actual Moderate
grade and allow only that full id at Moderate through aggregate reference
verification until #883 closes. Every other strategy retains the Strong
floor, and missing input or a lower tier still fails.

Pin the already measured 2026-11-16 reference result to 301 Excellent,
9 Strong, 1 Moderate and 1 declared anomaly. Explain the expectation
correction from 301/10/0 to 301/9/1 and keep the historical 2026-11-11
population and fact-rendered scoreboard distinct. Trades are unchanged;
baseline promotion requires its own verification.

Add CSV-driven tests of acceptance, rejection for other ids/categories,
removal of only the policy entry, missing/lower tiers and single-strategy
verification. The acceptance test uses the existing analyzer and aggregate
main on both the base and candidate. Tests are authored and unrun.

Refs: #836
      #883

README.md result cell reworded in this change (verbatim original):

"this repository's sweep of the v1.0.1 library: **311 excellent + 1 declared anomaly**; the <!-- pf:scoreboard.corpusProbes\|int -->309<!-- /pf --> of them in the measured population: **<!-- pf:scoreboard.scopes.corpus.excellent\|int -->309<!-- /pf --> excellent**"

Documentation provenance for preceding changes in this PR (verbatim originals;
these are earlier rewordings/deletions, not additional edits in this change):

1. README.md: "The historical gross-count regrade recorded in [#836](#836) measured **7,959 excellent / 30 strong**: 24 probes moved from excellent to strong and none lower."

2. README.md: "- **strong** — ≥ 95% matched, difference in gated trade-list sizes below 6% of the larger count, entries within 0.1% and exits within 0.5% at p90;"

3. README.md: "The separate `net_count_abs_delta` (`net`) reports the difference in list sizes."

4. README.md: "The percentage metric, `count_delta`, retains the legacy relative difference in gated list sizes for the strong tier and other percentage comparisons."

5. README.md: "It can be zero when both sides have unmatched trades; that does not satisfy the excellent count gate."

6. README.md: "- **excellent** — the same number of trades, ≥ 99% of TradingView's trades matched, the distinct-entry identity check passed, entry and exit prices within 0.01% and PnL within 1% at the 90th percentile (trailing-stop scripts are graded on the *production* profile: exits within 0.02% and PnL within 1%, since a trail fill depends on TradingView's sub-bar path);"

7. README.md: "- **strong** — ≥ 95% matched, trade count within 6%, entries within 0.1% and exits within 0.5% at p90;"

8. CHANGELOG.md: "Corrected the previously published parity grading: counting unmatched trades net instead of gross overstated the excellent tier by 10 of 312 reference probes (311 instead of 301) and by 24 of 7,989 graded probes on the recorded population."

9. CHANGELOG.md: "The corpus grader counts every unmatched gated trade on either side as a gross mismatch for the excellent gate."

10. CHANGELOG.md: "One engine-only trade and one TradingView-only trade count as two mismatches, so equal list sizes cannot satisfy that gate."

11. CHANGELOG.md: "The count percentage and strong-tier rules retain their legacy calculation from the difference in gated list sizes (#836)."
Brings in the current main so the change is verified against it. The
change itself is unchanged; the only overlapping file, CHANGELOG.md,
merges without conflict.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rain B

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment on lines +9435 to +9439
'import sys; findings = sys.argv[2:]; '
'sys.stdout.buffer.write(f"checked {len(findings)} anchors\\r\\n".encode()); '
'sys.stderr.buffer.write(("\\n".join(findings) + '
'f"\\n{len(findings)} broken anchors").encode() + b"\\xff"); '
'sys.exit(int(sys.argv[1]))',

from verify_corpus import MATCH_WINDOW_SECONDS, analyze_strategy
from test_verify_corpus_trail_profile import TRADE_COLUMNS, TRAIL_STRATEGY
import verify_corpus

@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.

No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.

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

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

Not verified on this run: run\_checks (vacuous: never exercised), \_print\_verification (unsupported), analyze\_strategy (vacuous: never exercised), main (vacuous: never exercised), report\_row (unsupported).


Graphify review — findings

Tightens corpus grading so every unmatched gated trade on either side counts as a gross mismatch: one engine-only and one TradingView-only trade are two mismatches, and the excellent tier now requires zero. Strong-tier grading and fragmented-FIFO eligibility use the same gross count divided by the larger gated trade count (zero for two empty pools), with thresholds unchanged. Repins the parity headline in check_corpus_parity.sh to 301 excellent / 9 strong / 1 moderate / 1 anomaly. The README and changelog document the regrade, including a dated Moderate floor exception for one validation strategy that ends when #883 closes, and they present the 2026-11-16 reference sweep as a recorded measurement.

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 — 1370 functions depend on the 1256 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: _analyze_tapes() — 9 callers, 6 callees

Verification — 1370 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: 1337 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

1438 of 1438 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 1388 more

non-code file(s) changed (CHANGELOG.md, README.md) → 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, README.md, scripts/check_corpus_parity.sh) — 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.

Formal verification

Could not verify: Could not verify run\_checks.

The verifier did not have enough to check run\_checks, 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: not verifiable here: def-time exec: NameError (name 'ROOT' is not defined) — the function cannot be defined in the harness because a name its module provides (decorator / default / annotation / import) did not resolve in the harness namespace; a harness artifact, not evidence about the edit

Could not verify: Could not verify \_print\_verification.

The verifier did not have enough to check \_print\_verification, 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: parameter `result` is annotated `VerificationResult` — outside the synthesizable primitive/collection set

Could not verify: Could not verify analyze\_strategy.

The verifier did not have enough to check analyze\_strategy, 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: not verifiable: all 9 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly NameError — names the real obstacle, not a sampling gap)

Could not verify: Could not verify main.

The verifier did not have enough to check main, 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: not verifiable: all 1 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly NameError — names the real obstacle, not a sampling gap)

Could not verify: Could not verify report\_row.

The verifier did not have enough to check report\_row, 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: method — first parameter is `self`, which needs a constructed instance (not synthesizable)

· 1 grounded finding(s) anchored inline below.

@@ -79,7 +102,10 @@ def _write_trades(

def _analyze_tapes(

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 — _analyze_tapes()

fans out to 6 callees (efferent coupling); 9 callers depend on it (afferent coupling).

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

This branch has not been deployed

No deployments
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