fix(collector): exclude noncausal Polymarket research trades - #113
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughPolymarket trade normalization now parses source, received, and recorded timestamps, excludes noncausal trades, and computes evidence availability from received and recorded times. Tests add pending-trade construction and validate filtering, completeness, and malformed timestamp behavior. ChangesPolymarket timestamp causality
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PendingTrade
participant trade_rows
participant TimestampClocks
participant EvidenceRow
PendingTrade->>trade_rows: provide trade_ts, received_at, recorded_at
trade_rows->>TimestampClocks: parse timestamp values
TimestampClocks-->>trade_rows: return clocks
trade_rows->>EvidenceRow: emit causal trade with latest availability timestamp
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Change contract: Normalized Polymarket research evidence omits a canonical trade whenever either received_at or the envelope recorded_at precedes trade_ts, while malformed clocks and zero-causal-trade event coverage still fail closed.
Out of scope: Fixing the raw collector stamping source, relaxing the semantic verifier, changing ECS/reference-recovery, deployment, or republishing immutable evidence.
Dependency or merge order: Depends only on main. Merge before republishing the real Linux evidence artifact; the raw collector clock-source fix remains a separate focused PR.
Focused validation: TDD counterexamples cover each noncausal clock independently, malformed recorded_at despite a noncausal received_at, and an event whose only trade is noncausal. cargo test -p hft-collector --lib: 153 passed, 2 ignored. cargo clippy -p hft-collector --lib -- -D warnings, cargo fmt --check -p hft-collector, and git diff --check pass. Real Linux raw replay changed 24,121 rows to 23,233 by omitting exactly 888 noncausal trades while retaining 4 events and 2,180 books; new deterministic content SHA-256 is c1f46cc6bc464d771a20dcda0dae6be3b363480b61bc62ca48cc6e3937d72382.
Rollout/rollback impact: New evidence publications become stricter; existing immutable artifacts are unchanged. Roll back by reverting this PR and do not publish the resulting weaker artifact. The downstream verifier remains unchanged and fail closed.
Summary by CodeRabbit