Skip to content

feat(research): verify immutable ready-event catalog - #348

Merged
proerror77 merged 4 commits into
mainfrom
codex/verified-event-catalog-319
Jul 26, 2026
Merged

feat(research): verify immutable ready-event catalog#348
proerror77 merged 4 commits into
mainfrom
codex/verified-event-catalog-319

Conversation

@proerror77

@proerror77 proerror77 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Change contract

Publish append-only, digest-keyed Polymarket BTC 5m event receipts. Ready is derived only after independently reopening and rehashing the evidence triplet and producer carrier; all validation failures produce typed Rejected receipts.

Acceptance evidence

Out of scope

Snapshot/cohort construction, Mission admission, evaluator/MCTS, database/catalog service, mutable latest pointers, and collector deployment.

Dependency / merge order

#336 and #337 are merged. This PR was rebased on main@b8670874 after independent #347 and #346 merges. Merge this before reworking #331/#322.

Rollout / rollback

Research-only fail-closed catalog API; no live execution or deployment path. Revert this one commit to remove the catalog contract.

Scope exception

874 non-generated lines exceed the 750-line assessment threshold, but artifact binding, verified evidence facts, receipt construction, and counterexample tests are one inseparable trust contract and cannot be safely rolled back independently. Explicit reviewer approvals: Codex standards reviewer review_standards_319; Codex spec reviewer review_spec_319.

Summary by CodeRabbit

  • New Features
    • Added a catalog for validating, classifying, and tracking Polymarket evidence receipts.
    • Added tamper-resistant evidence authentication using trusted SHA-256 checks.
    • Added evidence sequence, coverage, availability, and success-marker metadata.
    • Added filtering for receipts ready for supported research tasks.
  • Configuration
    • Updated research policy snapshot references for BTC and SOL five-minute market examples.
  • Tests
    • Added coverage for successful, partial, rejected, and mismatched evidence scenarios.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 23 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 Plus

Run ID: 26ec0209-5833-44b2-8d64-e9da2b7359f2

📥 Commits

Reviewing files that changed from the base of the PR and between 26de7d6 and 390a7f7.

📒 Files selected for processing (6)
  • 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/artifact.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/catalog.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/verified.rs
📝 Walkthrough

Walkthrough

Adds authenticated Polymarket evidence objects, _SUCCESS digests, candidate sequence metadata, and an in-memory catalog that classifies verified research events into Ready, Partial, or Rejected receipts. Mission configuration snapshot identifiers are also updated.

Changes

Polymarket evidence catalog

Layer / File(s) Summary
Evidence authentication and sealing
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/artifact.rs
Adds bounded, canonical-path evidence authentication and records the sealed triplet’s _SUCCESS SHA-256 digest.
Candidate metadata and sequence verification
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/verified.rs
Adds serializable sequence and coverage metadata, _SUCCESS digests, accessors, and sequence-gap computation to verified candidates.
Receipt catalog and classification
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/catalog.rs
Adds qualification parsing, evidence compatibility checks, availability calculation, deterministic receipt digests, Ready/Partial/Rejected classification, storage, filtering, and tests.
Public module wiring and mission anchors
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs, rust_hft/prediction-markets/config/research_missions/*.example.json
Exports the catalog module and updates BTC and SOL research mission snapshot identifiers.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

Possibly related PRs

  • proerror77/monday#98 — Publishes immutable evidence triplets using the same (data, manifest, _SUCCESS) structure.
  • proerror77/monday#209 — Adds verifier tooling expected to reuse the authenticated evidence and catalog surfaces.
  • proerror77/monday#338 — Generates and publishes candidate evidence triplets consumed by this verification flow.

Sequence Diagram(s)

sequenceDiagram
  participant Catalog
  participant Qualification
  participant EvidenceVerifier
  participant ReceiptStore
  Catalog->>Qualification: authenticate and parse qualification JSON
  Catalog->>EvidenceVerifier: seal and verify evidence triplet
  EvidenceVerifier-->>Catalog: return sequence, coverage, and digest metadata
  Catalog->>Catalog: classify qualification and evidence compatibility
  Catalog->>ReceiptStore: append receipt by receipt_sha256
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: verifying the immutable ready-event catalog.
Description check ✅ Passed The description covers the required contract, out-of-scope work, merge order, validation, rollback, and scope exception with sufficient detail.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/verified-event-catalog-319

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.

@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: 0f90b04249

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/artifact.rs (1)

478-484: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Avoid recomputing the SHA-256 for the returned digest.

The digest of bytes is already computed on Line 478 for the equality check, and after it passes it is provably equal to expected (and to the validated expected_sha256). Rehashing up to 4 MiB on Line 482 is redundant.

♻️ Reuse the validated digest
     Ok(AuthenticatedPolymarketEvidenceObject {
-        sha256: format!("{:x}", Sha256::digest(&bytes)),
+        sha256: hex_digest(expected),
         bytes,
     })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/artifact.rs`
around lines 478 - 484, Reuse the SHA-256 digest already computed for the
equality check in the artifact validation flow instead of calling
Sha256::digest(&bytes) again when constructing
AuthenticatedPolymarketEvidenceObject. After validation succeeds, derive the
returned sha256 string from the validated digest or expected value while
preserving the existing mismatch error and bytes field.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/catalog.rs`:
- Around line 286-307: Update classify and its caller verify_and_append so
carrier schema, empty verifier contract, missing contract, and invalid contract
count validation failures are converted into a typed Rejected receipt via
rejected_from_evidence(...), matching the existing unparseable-qualification
path instead of propagating the error from classify(...)?.

---

Nitpick comments:
In
`@rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/artifact.rs`:
- Around line 478-484: Reuse the SHA-256 digest already computed for the
equality check in the artifact validation flow instead of calling
Sha256::digest(&bytes) again when constructing
AuthenticatedPolymarketEvidenceObject. After validation succeeds, derive the
returned sha256 string from the validated digest or expected value while
preserving the existing mismatch error and bytes field.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: da3cd563-119c-40f5-9a43-a9ce24c3329d

📥 Commits

Reviewing files that changed from the base of the PR and between b867087 and 26de7d6.

📒 Files selected for processing (6)
  • 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/artifact.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/catalog.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/mod.rs
  • rust_hft/prediction-markets/crates/ploy-market-data/src/polymarket_evidence/verified.rs

@proerror77

Copy link
Copy Markdown
Owner Author

Follow-up hardening is in 6e139f0.

  • Typed Rejected receipts now cover semantic qualification failures; cross-wired requested market IDs reject.
  • Authenticated trade-completion identity is bound into the verified candidate and receipt; absent proof remains Partial.
  • Corroborated incomplete surfaces are Partial, while contradictory coverage remains rejected.
  • Verifier digest fields are constructor-only; producer SHA validation is canonical lowercase.
  • Candidate sealing already validates each source segment continuity; catalog no longer treats filtered event-row gaps as an independent terminal condition.

Kept out of this #319 contract: a new slot-alignment requirement and extra consistency rules for untrusted producer clock fields.

@proerror77
proerror77 force-pushed the codex/verified-event-catalog-319 branch from 13a66df to 390a7f7 Compare July 26, 2026 02:14
@proerror77
proerror77 merged commit fe48eab into main Jul 26, 2026
38 checks passed
@proerror77
proerror77 deleted the codex/verified-event-catalog-319 branch July 26, 2026 02:21
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