Skip to content

Add final trusted TQQQ snapshot acceptance - #222

Closed
Pigbibi wants to merge 1 commit into
mainfrom
codex/qsl-p2-tqqq-final-trust-boundary-acceptance-20260730
Closed

Add final trusted TQQQ snapshot acceptance#222
Pigbibi wants to merge 1 commit into
mainfrom
codex/qsl-p2-tqqq-final-trust-boundary-acceptance-20260730

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the descriptor-backed trusted TQQQ snapshot package while preserving bounded bytes, external SHA-256 anchors, authenticate-before-parse ordering, FIFO/device/symlink/TOCTOU fail-closed behavior, strict JSON, and non-transferable lifecycle semantics
  • make the verified pandas _normalized_prices(..., require_exact_columns=True, ...) result the single source of canonical snapshot sessions; receipt membership uses only its frozenset[str]
  • admit the raw os.fspath(snapshot_dir) without normpath, resolve, or realpath; reject any .. component, trailing separator, or trailing /. before open

Tests-first evidence

On the audit-only PR #221 exact head f2d813e7edbe15094c62e62f453e9ca150dd5b5d, the two frozen regression tests both failed with DID NOT RAISE:

  • pandas implicit-index/session split was accepted
  • symlinked-ancestor/../snapshot was lexically collapsed and accepted

On fresh main, the new capability test module was RED because the trusted package did not exist. The complete candidate then passed:

  • PYTHONPATH=src python3 -m pytest -q tests/test_tqqq_r1_snapshot.py tests/test_tqqq_trusted_snapshot_package.py — 67 passed
  • PYTHONPATH=src python3 -m pytest -q — 612 passed, 3 skipped
  • python3 -m ruff check src/us_equity_snapshot_pipelines/tqqq_trusted_snapshot_package.py tests/test_tqqq_trusted_snapshot_package.py — passed
  • python3 -m compileall -q src tests — passed

Scope and compatibility

Exactly two new files; no dependency, workflow, schema, configuration, provider/data/replay, or live behavior changes. Snapshot roots containing .., a trailing separator, or trailing /. are now intentionally unsupported and fail closed. size=0.

This initial head is the complete immutable final candidate for the single high-risk review/CI gate; no remediation or review rerun is permitted.

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: 0e6f3fe2a9

ℹ️ 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 +464 to +469
prices = tqqq_r1_snapshot._normalized_prices(
pd.read_csv(
BytesIO(members["prices.csv"]),
dtype={tqqq_r1_snapshot.PRICE_FIELD: "string"},
),
require_exact_columns=True,

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 Reject CSV rows that trigger an implicit index

When each data row contains four fields under the three-column header, pd.read_csv silently treats the leading field as an implicit index, while _normalized_prices(..., require_exact_columns=True) still sees exactly the three named columns. If the shifted session column contains all receipt sessions—for example, shifted rows for both 2010-01-04 and 2010-01-05—the later membership check also passes, so the loader accepts and returns raw prices.csv bytes that violate the three-column snapshot contract. Explicitly reject implicit indexes or otherwise validate every row's raw field count before accepting the snapshot.

Useful? React with 👍 / 👎.

Comment on lines +709 to +710
manifest["session"] != receipt["session"]
or manifest["session"] not in calendar["sessions"]

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 Validate every snapshot date against the calendar evidence

When the authenticated snapshot contains an extra weekday that is absent from the authenticated XNYS calendar, the package is still accepted as long as the single receipt session appears in both artifacts. The snapshot validator only excludes weekends, so this permits holiday or otherwise non-exchange observations to enter the trusted price history without calendar verification; require all verified_sessions to be contained in the calendar evidence rather than checking only manifest["session"].

Useful? React with 👍 / 👎.

frozenset[str],
]:
try:
names = tuple(sorted(os.listdir(directory_fd)))

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 Bound snapshot directory enumeration

When an untrusted snapshot directory contains a very large number of entries, os.listdir materializes every name and sorted duplicates that work before the verifier can reject the unexpected layout. This bypasses the module's otherwise bounded-input design and can exhaust memory or CPU without possessing any valid hash anchor. Enumerate incrementally and stop after more than the four expected members rather than loading the entire directory.

Useful? React with 👍 / 👎.

Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Fail-closed terminal evidence for immutable head 0e6f3fe2a9fec432b23477f6d1739cc76b595d07:

  • required CI test: SUCCESS, workflow run 30507630320
  • sole exact-head GitHub Codex App review: PRR_kwDOR_7pX88AAAABHvl_aQ
  • current unresolved P1 threads: PRRT_kwDOR_7pX86U9qXx (implicit-index CSV rows), PRRT_kwDOR_7pX86U9qXy (snapshot dates not fully bound to calendar evidence), PRRT_kwDOR_7pX86U9qX0 (unbounded snapshot directory enumeration)
  • head/base unchanged; changed-file scope remains exactly two files

The permanent stop rule requires P2_NEGATIVE_TERMINAL_FINAL: this PR is not accepted and is being closed unmerged. No patch, remediation, thread reply/resolution, review/rerun, merge, reslice, Pre-P3, or P3 action is authorized.

@Pigbibi Pigbibi closed this Jul 30, 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

Development

Successfully merging this pull request may close these issues.

1 participant