Skip to content

Add deterministic QQQ research input bundle#47

Closed
Pigbibi wants to merge 2 commits into
mainfrom
codex/t2b3-qsp-input-bundle-v1-20260721
Closed

Add deterministic QQQ research input bundle#47
Pigbibi wants to merge 2 commits into
mainfrom
codex/t2b3-qsp-input-bundle-v1-20260721

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

T2B3 QSP Stage-1: deterministic QQQ research input bundle

  • Frozen acceptance contract: qsl_t2b3_deterministic_qqq_projection_acceptance_contract_v2_2026-07-21.md
  • Contract SHA-256: 22223aea8b94ab3157c7897eb883fb84c79fa4d6db271f6629bd47e4ca2b8e06
  • Exact base: ac3cb0b64024ae0eff0594aee8d477688bf320d2
  • Head: f4b505f550fd0876225165bd080a69edb53bb4ea
  • Strict file budget honored: src/quant_strategy_plugins/tqqq_research_input_bundle.py, tests/test_tqqq_research_input_bundle.py only.

Tests-first evidence

  • RED: python3 -m pytest -q tests/test_tqqq_research_input_bundle.py initially failed collection because the authorized module did not exist.
  • GREEN: focused suite passed 15; related PRESENT/security suites passed 65; full suite passed 138.

Validation gates

  • uv run --offline --extra test python -m pytest -q tests/test_tqqq_research_input_bundle.py — passed (15)
  • uv run --offline --extra test python -m pytest -q tests/test_tqqq_market_regime_control_present.py tests/test_strategy_plugin_runner.py — passed (65)
  • uv run --offline --extra test python -m pytest -q — passed (138)
  • uv run --offline --extra test ruff check . — passed
  • uv run --offline --extra test python -m compileall -q src tests — passed
  • uv run --offline --extra test python -m build — passed
  • git diff --check ac3cb0b64024ae0eff0594aee8d477688bf320d2...HEAD — passed
  • Two-file budget and diff secret-pattern check — passed

Tests used injected deterministic frames/bytes. Real provider/network market-data calls: 0. No real or synthetic runtime bundle, package, replay, evidence, or performance execution was performed.

Boundary

This is research-only immutable input publication plus a pure deterministic QQQ projection. external_context is exactly ABSENT; A/as-of is only the last complete provider-observed QQQ row, not an official XNAS-calendar claim. Failures are fail-closed and logically quarantined without repair/retry. T2/T3 remain evidence-only/no-order: no decision, position, order, capital, broker, leverage, optimization, cloud, or live scope is introduced.

Excluded scope

No existing provider/PRESENT producer, dependency, workflow, config, documentation, lockfile, generic data framework, UESP consumer, or third repository file changed.

Co-Authored-By: Codex <noreply@openai.com>

@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: f4b505f550

ℹ️ 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".

Comment thread src/quant_strategy_plugins/tqqq_research_input_bundle.py
Comment thread src/quant_strategy_plugins/tqqq_research_input_bundle.py
Comment thread src/quant_strategy_plugins/tqqq_research_input_bundle.py
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

🤖 Codex PR Review

🚫 Merge blocked: 2 serious issue(s) found in high-risk files

🚫 Blocking Issues

These issues must be fixed before this PR can be merged:

1. 🔴 [CRITICAL] Bug in src/quant_strategy_plugins/tqqq_research_input_bundle.py

MIN_AS_OF is hard-coded to the future date 2026-07-21, but this module's public entry points (build_input_bundle()/main()) are defined to publish the last complete provider-observed QQQ row. On Monday, July 20, 2026, the provider can only legitimately return 2026-07-20 or earlier, so every valid run fails _validate_rows() with T2B3_BUNDLE_PROVIDER_DATA_INVALID and no bundle can be published. (line 43)

Suggestion: Remove the future hard-coded floor, or make the minimum acceptable as_of an explicit caller-supplied contract input that is not later than the current expected publication date.

2. 🟠 [HIGH] Logic in src/quant_strategy_plugins/tqqq_research_input_bundle.py

The final-date validation only checks that no symbol is later than the last QQQ row; it never requires TQQQ, ^VIX, ^VIX3M, HYG, IEF, LQD, XLF, KRE, and TLT to also have a complete row on that same as_of. A partial provider response where QQQ has the newest session but an auxiliary symbol is one or more sessions stale is therefore accepted and published as READY, even though config.toml points market_regime_control at those symbols, so the current-session research input becomes silently inconsistent. (line 226)

Suggestion: Fail closed unless every requested symbol has a complete row for the final bundle as_of, and validate required fields on that row before publishing the manifest.


Review by Codex PR Review bot • PR

Co-Authored-By: Codex <noreply@openai.com>

@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: 72094b233d

ℹ️ 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".

Comment on lines +105 to +106
elif isinstance(value, date):
text = value.isoformat()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle datetime-like provider dates before serializing

download_price_history returns a pandas DataFrame whose as_of values are normalized pd.Timestamp objects (yfinance_prices.py:147). Timestamp is a datetime/date subclass, so this branch calls isoformat() and produces YYYY-MM-DDT00:00:00; the subsequent date.fromisoformat rejects that value. Consequently, the default provider path rejects every normal yfinance response as T2B3_BUNDLE_PROVIDER_DATA_INVALID before it can publish a bundle; the focused tests only use plain date values and do not exercise this path.

Useful? React with 👍 / 👎.

Comment on lines +56 to +58
prices = "prices.csv"
event_set = "geopolitical-deescalation"
benchmark_symbol = "QQQ"

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 Supply the crisis component's market symbol

When this embedded config is consumed, it leaves market_symbol unset while the enabled crisis component defaults it to SPY (crisis_context_research.py:27), but SPY is not among REQUESTED_SYMBOLS. The resulting input therefore has an all-missing market series: the QQQ-vs-market relative-return and financial-relative-return checks in build_crisis_context_features cannot activate, silently changing crisis-route results. Set market_symbol to an included series or include the intended market benchmark in the bundle.

Useful? React with 👍 / 👎.

Comment on lines +453 to +459
def strict_readback_bundle(
directory: str | Path,
*,
expected_manifest_sha256: str,
expected_commit: str,
expected_end_exclusive: str,
) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Verify bundle lineage in the PRESENT consumption path

The verifier is never called by a production consumer: repo-wide search finds it only in this module and its test, while tqqq_market_regime_control_present.run_present directly reads config.toml's prices.csv and hashes whatever bytes it finds. Thus, after publication, replacing all three bundle files with a consistently self-attested config/raw/manifest still produces a PRESENT package from the altered prices; its input hash merely records the tampered content. Wire this verification into the admitted PRESENT path with independently supplied manifest hash, commit, and end-date values before reading the input.

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