feat(collector): attest Binance L2 continuity - #264
Conversation
|
Warning Review limit reached
Next review available in: 37 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 Plus Run ID: 📒 Files selected for processing (3)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93352a6fec
ℹ️ 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".
| let lob_continuity = if schema == RAW_SCHEMA { | ||
| Some(summarize_lob_continuity(path, config.symbols.clone())?) |
There was a problem hiding this comment.
Preserve the pre-exclusion symbol scope while sealing
When a depth update for a symbol is archived before its REST snapshot returns -1121, Event::ExcludeSymbol removes that symbol and close_segment_at replaces the current segment's catalog with the reduced active-symbol list. This call then recomputes continuity against that reduced list, so the already-written diff triggers LOB continuity row symbol is outside its declared scope; rotation fails before compression and no artifact is sealed. Because WebSocket collection intentionally starts before snapshot requests, this ordering is possible during a delisting/catalog race. Seal the closing segment against its original scope, applying the exclusion only to the next segment.
Useful? React with 👍 / 👎.
| summary.last_source_time_ms = Some(clock.event_time_ms); | ||
| summary.observe_received_at(received_at_ns); | ||
| summary.observe_latency(source_latency_ms(received_at_ns, clock.event_time_ms)?); |
There was a problem hiding this comment.
Include intermediate diff states in depth extrema
The diff branch updates clocks and counts but never applies the bid/ask changes or calls observe_depth, so min_*_levels and max_*_levels describe only snapshots and checkpoints rather than the book throughout the segment. For example, if a one-bid snapshot is followed by a diff that adds a second bid and another that removes it before the closing checkpoint, the manifest reports max_bid_levels: 1 even though the replayed L2 book reached two levels. Maintain the per-symbol book while summarizing, or derive these extrema from the existing replay state.
Useful? React with 👍 / 👎.
Issue: #224 (first independent layer; does not close the issue)
Change contract
Publish a binance.lob_continuity.v1 summary in new Binance market-tape segment manifests and make the sealed verifier recompute and bind it to the raw L2 rows. The summary covers capture-session/reconnect boundary, declared and covered symbols, sequence gaps and source-time rollback evidence, source/received clocks and latency, update IDs, snapshot/checkpoint seeds, and bid/ask depth.
Out of scope
Dependency or merge order
None. This is the first #224 layer. A follow-up PR will wire the new strict verifier into the canonical shadow gate after this merges.
Focused validation
Rollout/rollback impact
New collectors emit the optional summary. Existing artifacts remain readable through the compatibility API; only the new strict API requires the contract. Rollback is this PR alone and does not alter production hosts.