feat(collector): bound completion backfill to explicit markets - #166
Conversation
|
Warning Review limit reached
Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
f175a91 to
7d89bf2
Compare
7d89bf2 to
b86302d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b86302d1b4
ℹ️ 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".
| if !self.config.market_ids.is_empty() | ||
| && !self.config.market_ids.contains(market_id) | ||
| { | ||
| continue; |
There was a problem hiding this comment.
Account for symbols before applying the market allowlist
When the allowlist covers only a subset of config.symbols—for example, BTC-only IDs while the CLI retains its default seven symbols—this continue prevents the other successfully discovered symbols from entering discovered_target_symbols. The subsequent missing_symbols check therefore reports ETH/SOL/etc. as absent and collect-reference --once exits with a DataCompletenessError even though every requested market ID was found. Track symbol discovery before this filter or scope the completeness check to the allowlisted markets.
Useful? React with 👍 / 👎.
| if self.market_ids.iter().any(|market_id| { | ||
| market_id.is_empty() || market_id.trim() != market_id | ||
| }) { |
There was a problem hiding this comment.
Reject embedded whitespace before pruning recovered state
For an ID containing internal whitespace, such as 2959 141 or an embedded tab, trim() leaves the string unchanged and validation succeeds despite the whitespace-free contract. Startup then treats this malformed value as an active allowlist and can persist a checkpoint with all recovered markets pruned before discovery eventually reports the ID as missing. Reject any char::is_whitespace() occurrence so malformed input fails before state mutation.
Useful? React with 👍 / 👎.
Change contract: polymarket-raw-ops collect-reference accepts an explicit market-id allowlist and fails closed if Gamma discovery omits any requested market. When the allowlist is active, recovered collector state and trade-ID dedupe state are scoped to those markets, so an isolated historical completion backfill cannot retain unrelated markets.
Acceptance evidence: Linux CI must prove the CLI accepts the allowlist, whitespace IDs are rejected, the missing-requested-market counterexample fails closed, and recovered unrelated state is pruned; then an isolated ECS backfill for the eight BTC 5m market IDs must emit trade-completion proof without changing the live collector.
Out of scope: live collector cutover, state-limit changes, polling-rate changes, evidence publication, snapshot generation, evaluator changes, 15m/1h, and Live/Paper.
Dependency or merge order: #167 merged first. This PR was replayed unchanged onto main commit 0de5c6f and must pass CI on that base before merge.
Focused validation: existing Linux collector-focused checks and CI lanes on head b86302d; remote blob re-read confirms only the two collector files changed and the test-to-implementation stack is unchanged.
Rollout/rollback impact: Opt-in CLI only; no service unit changes. Rollback is reverting this PR or omitting --market-id.
TDD status: the first commit defines the CLI and fail-closed contract; the second implements it and adds the recovered-state and input-sanitization counterexamples.