Skip to content

fix(pm-parity): admit trade-completion records in shadow parity verification - #588

Merged
proerror77 merged 1 commit into
mainfrom
codex/pm-parity-completion
Aug 1, 2026
Merged

proerror77 merged 1 commit into
mainfrom
codex/pm-parity-completion

Conversation

@proerror77

@proerror77 proerror77 commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Change contract

Let verify-shadow-parity accept reference tapes containing polymarket_trade_collection_complete rows, so a Rust→Rust shadow gate can run. Refs #587.

The production Rust collector (since dc26acd) writes completion proofs for every finalized market; the parity KINDS allowlist only covered metadata/trades/settlements, so the first Rust→Rust gate died with invalid update kind. Completion proofs are per-lane polling bookkeeping emitted on independent schedules — admitted by the parser, excluded from the comparison window. Metadata/trade/settlement comparison semantics unchanged. Legacy→Rust gates never hit this because the legacy lane does not emit completion records.

Issue relationship

Refs #587

Out of scope

Dependencies and merge order

None.

Focused validation

  • cargo test -p hft-collector polymarket_parity:: — 29 passed, 0 failed.
  • Counterexample test: completion rows appended to both lanes still pass parity (trade_completion_rows_are_admitted_and_excluded_from_parity).

Rollout and rollback

Scope exception

None

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of Polymarket trade collection completion updates.
    • Completion records are now accepted without affecting parity comparison results.
    • Preserved existing handling for metadata, trades, and settlements.

…ication

Refs #587

The production Rust collector writes polymarket_trade_collection_complete
proofs for every finalized market, but the parity verifier's KINDS
allowlist only knew metadata/trades/settlements, so the first Rust->Rust
shadow gate died with 'invalid update kind'. Completion proofs are
per-lane polling bookkeeping emitted on independent schedules, not shared
market evidence: admit them in the tape parser but exclude them from the
comparison window. Legacy->Rust gates never hit this because the legacy
Python lane did not emit completion records.

Counterexample test: completion rows in both lanes still pass parity.
@coderabbitai

coderabbitai Bot commented Aug 1, 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 Plus

Run ID: 8d280a34-56f9-4e76-8e94-731ea37f95e2

📥 Commits

Reviewing files that changed from the base of the PR and between 5522d15 and 411aa4c.

📒 Files selected for processing (1)
  • rust_hft/tools/collector/src/polymarket_parity.rs

📝 Walkthrough

Walkthrough

The collector now accepts polymarket_trade_collection_complete tape updates. It admits these bookkeeping rows during parsing but excludes them from parity comparison data. A test validates completion records from both collector lanes.

Changes

Polymarket completion parity

Layer / File(s) Summary
Completion record parsing
rust_hft/tools/collector/src/polymarket_parity.rs
The collector accepts polymarket_trade_collection_complete updates and excludes completion rows from the parity comparison window.
Completion record parity test
rust_hft/tools/collector/src/polymarket_parity.rs
The test adds completion records with different lane-specific condition IDs and verifies that parity passes.

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

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% 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 clearly identifies the primary change: admitting trade-completion records in Polymarket shadow parity verification.
Description check ✅ Passed The description covers the change, issue relationship, scope, dependencies, validation, rollout, rollback, and scope exception.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/pm-parity-completion

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 enabled auto-merge (squash) August 1, 2026 20:21
@proerror77
proerror77 merged commit 01407ad into main Aug 1, 2026
44 checks passed
@proerror77
proerror77 deleted the codex/pm-parity-completion branch August 1, 2026 20:27
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