Skip to content

feat: add strict strategy evidence v2 promotion gate - #290

Merged
Pigbibi merged 1 commit into
mainfrom
codex/qsl-p0-qpk-strict-evidence-promotion-gate-fresh-reslice-20260805
Aug 4, 2026
Merged

feat: add strict strategy evidence v2 promotion gate#290
Pigbibi merged 1 commit into
mainfrom
codex/qsl-p0-qpk-strict-evidence-promotion-gate-fresh-reslice-20260805

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the packaged strategy_evidence_package.v2 schema and dependency-free canonical validator
  • route lifecycle and compatibility entry points through the same validator while preserving v1 caller shapes
  • fail closed on artifact identity, strict JSON, BacktestOrchestrator evidence, promotion acceptance, and all paper/shadow/live requests

Safety boundary

  • this slice can establish promotion_eligible; it always keeps live_ready=false, size_zero_required=true, and no_order=true
  • learning evidence stays non-promotable and P3 remains TERMINALLY_PARKED_NO_MEMBER
  • no provider, credential, runtime, deploy, config-sync, broker, order, paper, shadow, or live action

Validation

  • tests-first RED: 59 failed, 21 passed
  • focused: 88 passed
  • full pytest: 882 passed, 1 skipped, 42 subtests passed
  • unittest: 575 passed, 1 skipped
  • Ruff check and scoped format check
  • compileall with no retained pyc
  • offline build; wheel contains the v2 module and schema
  • all three CLI entry points agree for valid and invalid packages
  • CN/HK/US/Crypto caller-shape and candidate-wheel probes pass
  • exact 14-path scope, diff, secret, and untracked gates pass

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit 5d4bbd0 into main Aug 4, 2026
1 check passed
@Pigbibi
Pigbibi deleted the codex/qsl-p0-qpk-strict-evidence-promotion-gate-fresh-reslice-20260805 branch August 4, 2026 22:37

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a3c84daf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"cost_model",
"risk_report",
"kelly_readiness_report",
from quant_platform_kit.strategy_lifecycle.evidence_package_v2 import (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore src path setup for direct CLI runs

When this script is invoked directly from a source checkout without an editable install, this import runs before src is on sys.path, so python scripts/validate_strategy_evidence_package.py ... now exits with ModuleNotFoundError instead of validating anything. The sibling source-checkout wrapper adds ROOT / "src" before importing package code, and this script needs the same bootstrap or another standalone path to preserve the documented/tested direct CLI workflow.

Useful? React with 👍 / 👎.

Comment on lines +801 to +805
for field in _RESULT_NUMBER_FIELDS:
if field not in result:
continue
if field in {"observation_count", "param_version"}:
_finite_integer(result.get(field), f"{label}.{field}", issues, minimum=0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate result param_version before accepting v2 packages

If a v2 evidence package includes a tampered backtest.promotion_run.*.param_version, the dependency-free validator currently accepts values such as a string or 0: param_version is allowed in _RESULT_FIELDS, but it is absent from _RESULT_NUMBER_FIELDS, so this branch never visits it. That lets packages pass the Python/CLI gate even though the packaged schema requires param_version to be an integer with minimum 1.

Useful? React with 👍 / 👎.

Comment on lines +413 to +418
if (
root is None
or not isinstance(raw_path, str)
or not _valid_artifact_path(raw_path)
):
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail v2 validation when artifact roots are unavailable

When a v2 payload is validated through the raw-mapping APIs without base_dir (for example validate_evidence_package(payload) or validate_evidence_package_v2(payload)), root is None takes this continue path for every artifact, so the gate can return valid and even promotion_eligible without checking that the declared artifact files exist or that their bytes match the SHA-256 values. Since v2 promotion evidence is supposed to bind actual artifact bytes, the validator should fail closed or avoid promotion eligibility when it cannot perform those file checks.

Useful? React with 👍 / 👎.

"observation_count",
"run_duration_seconds",
}
_closed_object(result, label, required, _RESULT_FIELDS, issues)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require backtest result parameter identity

Because params and param_set_id are only allowed fields and are not part of the required result set, a v2 package can strip them from every backtest.promotion_run result and still pass validation. Those fields are emitted by BacktestResult.to_dict() and are the only structured binding between the promotion run metrics and the candidate parameter set, so accepting packages without them undermines the exact BacktestOrchestrator evidence identity check.

Useful? React with 👍 / 👎.

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