Skip to content

Decode typed Polymarket evidence rows - #106

Merged
proerror77 merged 1 commit into
mainfrom
codex/polymarket-evidence-wire
Jul 17, 2026
Merged

proerror77 merged 1 commit into
mainfrom
codex/polymarket-evidence-wire

Conversation

@proerror77

@proerror77 proerror77 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Change contract

Decode current Polymarket evidence NDJSON into crate-private typed rows and fail closed on stale schemas, derived fields, and unknown fields before semantic verification.

Out of scope

Sealed-triplet semantic verification, public VerifiedPolymarketEvidence projections, research snapshot compilation, OSS selection/download, database import, runtime activation, and deployment.

Dependency or merge order

Base: main. Merge this decoder layer before the dependent semantic-verifier PR. The module remains private and has no runtime consumer in this layer; the narrowly scoped dead-code allowance is removed by the dependent PR.

Focused validation

  • cargo fmt --all -- --check
  • cargo metadata --locked --no-deps --format-version 1
  • cargo test --locked -p ploy-market-data (12 passed)
  • cargo clippy --locked -p ploy-market-data --all-targets --no-deps -- -D warnings
  • cargo check --locked -p ploy-research --bin monday-prediction-research
  • Exact-head code review: approved, no P0-P3 findings
  • Exact-head security review: low risk, no P0-P3 findings

Rollout / rollback impact

No public API or runtime path changes. Rollout only makes the private decoder available to the next stacked layer. Roll back by reverting this PR before or together with its dependent verifier PR.

Summary by CodeRabbit

  • New Features

    • Added support for parsing Polymarket evidence data across contracts, order books, references, trades, and settlements.
    • Supports monetary and numeric values provided as either JSON numbers or strings.
  • Bug Fixes

    • Invalid evidence rows are now rejected when they contain unsupported schemas, fields, or prohibited data.
    • Improved validation helps ensure imported market data is consistent and reliable.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 17, 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: 7889db4b-55a7-46ad-9479-fd03cc24f7d6

📥 Commits

Reviewing files that changed from the base of the PR and between 5435115 and 5596569.

📒 Files selected for processing (2)
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/wire.rs

📝 Walkthrough

Walkthrough

Adds an internal Polymarket evidence wire module that validates JSON row schemas, rejects unsupported fields, converts decimal values, and deserializes contract, book, reference, trade, and settlement rows into typed variants.

Changes

Evidence wire parser

Layer / File(s) Summary
Wire contracts and module wiring
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs, rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/wire.rs
Adds the internal wire module, fixed row schema, per-surface field allowlists, shared row context, and typed raw row structures.
Parsing and validation
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/wire.rs
Adds JSON frame parsing, schema and field validation, forbidden-key checks, decimal deserialization, surface-specific RawRow construction, and parser tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • proerror77/monday#96: Normalizes staging research data into canonical evidence rows consumed by the typed wire surfaces.

Sequence Diagram(s)

sequenceDiagram
  participant Frame
  participant parse_row
  participant serde_json
  participant RawRow
  Frame->>parse_row: JSON byte frame
  parse_row->>serde_json: Deserialize JSON value
  parse_row->>parse_row: Validate schema and allowed fields
  parse_row->>RawRow: Deserialize surface-specific row
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: decoding typed Polymarket evidence rows.
Description check ✅ Passed The description covers the contract, out of scope, merge order, validation, and rollback, with only the scope exception section omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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-evidence-wire

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 df5c348 into main Jul 17, 2026
26 checks passed
@proerror77
proerror77 deleted the codex/polymarket-evidence-wire branch July 17, 2026 19:05
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