Skip to content

fix(market-data): accept zero-based source sequences - #215

Merged
proerror77 merged 1 commit into
mainfrom
codex/polymarket-zero-source-sequence
Jul 22, 2026
Merged

fix(market-data): accept zero-based source sequences#215
proerror77 merged 1 commit into
mainfrom
codex/polymarket-zero-source-sequence

Conversation

@proerror77

@proerror77 proerror77 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #214

Change contract

Treat source sequence 0 as a valid first record in canonical hourly Polymarket raw tapes while preserving typed-field, availability-clock, dataset-identity, and immutable-triplet verification.

A PRD is unnecessary because #214 specifies one small verifier behavior change with explicit acceptance and out-of-scope boundaries.

Out of scope

No collector changes, evidence recompilation, reference-fragment ordering changes, ResearchSnapshot/evaluator/MCTS behavior changes, or Paper/Live execution.

Dependency or merge order

Depends on merged #213. No stacked PR; this PR can merge independently after CI/review.

Focused validation

  • TDD red: metadata_source_sequence: 0 failed with contract provenance or availability clock is invalid before the fix.
  • cargo test -p ploy-market-data — 53 passed.
  • Counterexamples: both sequence fields remain required typed u64; invalid availability clocks and reversed dataset identities still fail.
  • cargo clippy -p ploy-market-data --lib --no-deps -- -D warnings — passed.
  • cargo check -p ploy-research --bin monday-prediction-snapshot --features db — passed.
  • cargo test -p ploy-research --lib checked_in_btc_and_sol_templates_pin_current_brief_and_rust_policy — passed.
  • Current policy snapshot: sha256:8da3878978b082f9087c0c7b513484eeb61fbcd8784af7a2de4fab8fc5034b24; the two mission pins are the required mechanical update because verified.rs is a policy-source input.
  • Matt code-review: Standards 0 findings; Spec 0 findings.

Rollout / rollback impact

Roll out the exact merged-main verifier image, then rerun the two-triplet ACK verifier Job for #173. Roll back by selecting the prior image digest. Existing immutable evidence is unchanged. Cloud exact-main acceptance remains pending until this PR merges and that image is published.

Summary by CodeRabbit

  • Bug Fixes

    • Improved contract verification to accept valid contracts with zero-based provenance sequence values.
    • Preserved validation of availability timestamps, source datasets, and required provenance fields to prevent invalid data from passing verification.
    • Added coverage for valid and invalid provenance scenarios.
  • Configuration

    • Updated search policy snapshots for Bitcoin and Solana five-minute research mission configurations.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 334ac3eb-70cf-4df2-b9b3-81e3ee7922a4

📥 Commits

Reviewing files that changed from the base of the PR and between 8296ba6 and 1010ee7.

📒 Files selected for processing (3)
  • rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json
  • rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/verified.rs

📝 Walkthrough

Walkthrough

The PR updates search policy snapshot identifiers for two Polymarket missions and changes contract verification to accept zero-based source sequences while preserving availability-clock, dataset, and deserialization validation.

Changes

Mission snapshot configuration

Layer / File(s) Summary
Refresh mission snapshot identifiers
rust_hft/prediction-markets/config/research_missions/polymarket-*.example.json
Updates the search_policy_snapshot_id values for the BTC and SOL five-minute mission configurations.

Polymarket provenance verification

Layer / File(s) Summary
Accept zero-based source sequences
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/verified.rs
Allows zero-valued source sequences in Contract::from_raw while retaining availability-clock validation and adds tests for accepted and invalid provenance data.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely describes the main verifier behavior change and matches the PR content.
Description check ✅ Passed The description includes the required change, out-of-scope, dependency, validation, and rollout sections, with only minor heading variation.
Linked Issues check ✅ Passed The verifier accepts zero-based source sequences, preserves fail-closed checks, and includes regression coverage for the reported contract row.
Out of Scope Changes check ✅ Passed The policy snapshot updates are tied to the verifier input and no unrelated collector, research, or execution changes appear present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/polymarket-zero-source-sequence

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
rust_hft/prediction-markets/config/research_missions/polymarket-btc-5m.example.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

rust_hft/prediction-markets/config/research_missions/polymarket-sol-5m.example.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proerror77
proerror77 merged commit eb07cf9 into main Jul 22, 2026
26 checks passed
@proerror77
proerror77 deleted the codex/polymarket-zero-source-sequence branch July 24, 2026 08:44
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.

Accept zero-based Polymarket source sequence in typed verifier

1 participant