Skip to content

fix(collector): retain completion segments missing metadata - #761

Merged
proerror77 merged 2 commits into
mainfrom
codex/pm-upload-identity-760
Aug 9, 2026
Merged

proerror77 merged 2 commits into
mainfrom
codex/pm-upload-identity-760

Conversation

@proerror77

@proerror77 proerror77 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Change contract

Treat a Polymarket trade-completion row without same-segment market metadata as retained noncanonical evidence instead of a contradictory identity. Continue to fail closed when present metadata disagrees with the completion symbol or market window.

Issue relationship

Closes #760

Out of scope

Timer/watchdog changes, raw tape rewriting or deletion, Gate/cutover changes, and production mutation.

Dependencies and merge order

None

Focused validation

  • Red before fix: cargo test -p hft-collector --lib --locked completion_without_segment_metadata_is_not_complete_or_canonical -- --nocapture failed with the production error.
  • Green after fix: the same regression test passes.
  • Existing rejects_trade_completion_identity_that_contradicts_metadata remains green and proves real contradictions fail closed.
  • cargo test -p hft-collector --lib --locked: 312 passed, 0 failed, 2 ignored.
  • cargo clippy -p hft-collector --lib --no-deps --locked -- -D warnings passed.
  • git diff --check passed.
  • Full workspace rustfmt remains blocked by pre-existing unrelated formatting drift; this PR does not reformat unrelated files.

Rollout and rollback

No direct production impact. Publication and runtime adoption remain blocked by #632. Roll back by reverting this single commit.

Scope exception

None

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation of trade-completion records to ensure they are matched with the correct market metadata.
    • Segments containing only trade-completion information are now correctly identified as incomplete when required market context is missing.
    • Prevented incomplete or inconsistent records from being treated as canonical data.

@coderabbitai

coderabbitai Bot commented Aug 9, 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: 30 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: ecbe60b4-8fe3-41e7-aeb6-4d4fc91459cb

📥 Commits

Reviewing files that changed from the base of the PR and between d73059b and ed440b7.

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

Walkthrough

The collector now checks completion identity mismatches only when metadata exists. A regression test verifies that completion-only tapes are non-canonical, incomplete, and require market metadata context.

Changes

Polymarket completion validation

Layer / File(s) Summary
Completion identity validation and regression coverage
rust_hft/tools/collector/src/polymarket_upload.rs
The identity check now preserves absent metadata as a valid context state while rejecting genuine mismatches. The regression test verifies manifest flags and replay scope for completion-only tapes.

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

Possibly related issues

  • proerror77/monday issue 587 — Both changes handle polymarket_trade_collection_complete records and collector metadata completeness.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: retaining completion segments that lack metadata.
Description check ✅ Passed The description includes all required sections and provides clear scope, validation, dependencies, and rollback details.
Linked Issues check ✅ Passed The change addresses issue #760 by retaining missing-metadata completions while preserving fail-closed contradiction handling and immutable raw tapes.
Out of Scope Changes check ✅ Passed The changes are limited to the collector fix and regression coverage, with no unrelated timer, tape, cutover, or production mutation work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 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-upload-identity-760

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.

@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

🤖 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/tools/collector/src/polymarket_upload.rs`:
- Around line 4048-4071: The test
completion_without_segment_metadata_is_not_complete_or_canonical should also
verify that completion evidence is retained in
manifest["trade_completions"]["market-1"]. Assert preserved fields including
condition_id and completion_sequence from valid_trade_completion_update(), while
keeping the existing noncanonical manifest assertions unchanged.
🪄 Autofix

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: b3f68c43-ab36-4dae-a710-8e48b897a565

📥 Commits

Reviewing files that changed from the base of the PR and between 2297430 and d73059b.

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

Comment thread rust_hft/tools/collector/src/polymarket_upload.rs
@proerror77
proerror77 marked this pull request as draft August 9, 2026 02:25
@proerror77

Copy link
Copy Markdown
Owner Author

Coordinator scope update: this independently validated uploader patch is preserved as Draft. No second writer or merge action is authorized while the active production-delivery lane is limited to #738, #747, #748, and #716.

@proerror77
proerror77 force-pushed the codex/pm-upload-identity-760 branch from 30c02b9 to ed440b7 Compare August 9, 2026 03:42
@proerror77
proerror77 marked this pull request as ready for review August 9, 2026 03:51
@proerror77
proerror77 merged commit 28e4341 into main Aug 9, 2026
47 checks passed
@proerror77
proerror77 deleted the codex/pm-upload-identity-760 branch August 9, 2026 03:52
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.

fix(polymarket): reconcile event-local completion identity in reference upload

1 participant