Skip to content

feat(polymarket): validate raw research segments - #89

Merged
proerror77 merged 1 commit into
mainfrom
codex/polymarket-research-normalizer
Jul 17, 2026
Merged

proerror77 merged 1 commit into
mainfrom
codex/polymarket-research-normalizer

Conversation

@proerror77

@proerror77 proerror77 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Change contract

Fail closed unless one staged crypto_expiry segment and one staged crypto_expiry_reference segment form canonical, content-addressed, unsuperseded artifact triplets that reproduce their producer manifests, stay inside their declared UTC-hour partitions, contain only their producer-owned event kinds, and satisfy the raw research policy; on success emit their deterministic identities.

Out of scope

Governed event selection or cross-segment joins; five-surface normalization; Parquet/materialization; deployment; trading or execution changes.

Dependency or merge order

Base: main. This validator layer is independently buildable and mergeable. Merge it before the selector/surfaces layer; no other PR is required first.

Focused validation

  • rustc +1.91 --version -> rustc 1.91.1
  • cargo +1.91 fmt -p hft-collector -- --check
  • cargo +1.91 test --locked -p hft-collector -> 156 passed, 2 ignored
  • cargo +1.91 clippy --locked -p hft-collector --lib --bin polymarket-raw-ops --features collector-binance --no-deps -- -D warnings
  • git diff --check origin/main...HEAD
  • Counterexamples cover same-length post-open source mutation, cross-UTC-hour rows, mixed dataset event kinds, tampered _SUCCESS, missing settlement or wrong reference policy, and adjacent SUPERSEDED markers; the positive fixture proves deterministic repeat validation.

The repository-wide collector all-target clippy command also reaches two unrelated pre-existing dead_code warnings in hft-collector (fallback_symbols and binance_spot_pairs). This PR does not absorb that main-branch cleanup; all changed library/CLI targets pass strict clippy, and GitHub Strict Clippy passes.

Scope assessment and atomic exception

3 changed files, 813 added non-generated lines, 0 deletions. The 771-line core consists of 528 implementation lines and 243 fixtures/counterexample-test lines; the remaining 42 lines are the minimal library export and opt-in CLI wiring. It contains no selector, normalizer, materializer, deployment, or execution content.

This exceeds the 750-line stop-and-assess threshold. Named reviewer validator_standards_review explicitly approved the atomic exception for exact head 7cec852dcd1e844e9a6f4a128876726f1749e7a0 after both P2 fixes, with no remaining P0-P2. The implementation and its fixtures/counterexamples are one Research/data trust-boundary contract: merging or rolling back the validator separately from the negative evidence would label paired raw inputs research-safe without the tests required to prove its fail-closed controls. Splitting the CLI/export glue would not bring the 771-line core below threshold. Selector and normalizer behavior remain separate PRs.

Rollout/rollback impact

The change adds an opt-in validation subcommand only; existing collectors, services, execution gates, and live trading state are unchanged. Roll back by reverting this PR as one unit; no data migration or runtime rollback is required.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@proerror77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ea0a286-66dc-495f-8c7c-8e3ddde791d9

📥 Commits

Reviewing files that changed from the base of the PR and between 04d548c and 7cec852.

📒 Files selected for processing (3)
  • rust_hft/tools/collector/src/bin/polymarket-raw-ops.rs
  • rust_hft/tools/collector/src/lib.rs
  • rust_hft/tools/collector/src/polymarket_research_import.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/polymarket-research-normalizer

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.

Comment thread rust_hft/tools/collector/src/polymarket_research_import.rs

@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: 8c2f4ae865

ℹ️ 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 rust_hft/tools/collector/src/polymarket_research_import.rs
Comment thread rust_hft/tools/collector/src/polymarket_research_import.rs
Comment thread rust_hft/tools/collector/src/polymarket_research_import.rs Outdated
@proerror77
proerror77 force-pushed the codex/polymarket-research-normalizer branch from 8c2f4ae to 9d4367a Compare July 17, 2026 09:39
@proerror77
proerror77 force-pushed the codex/polymarket-research-normalizer branch from 9d4367a to 7cec852 Compare July 17, 2026 09:46
@proerror77

Copy link
Copy Markdown
Owner Author

@codex review

Please re-review current head 7cec852d, including the UTC-hour and event-type fail-closed counterexamples.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 7cec852dcd

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

@proerror77
proerror77 merged commit dc2b821 into main Jul 17, 2026
23 checks passed
@proerror77
proerror77 deleted the codex/polymarket-research-normalizer branch July 17, 2026 10:02
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.

2 participants