Skip to content

feat(collector): attest Binance L2 continuity - #264

Merged
proerror77 merged 1 commit into
mainfrom
codex/cex-l2-continuity-224
Jul 23, 2026
Merged

feat(collector): attest Binance L2 continuity#264
proerror77 merged 1 commit into
mainfrom
codex/cex-l2-continuity-224

Conversation

@proerror77

Copy link
Copy Markdown
Owner

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

  • ECS/systemd deployment or production cutover
  • Host shadow-gate wiring and canonical OSS readback
  • Snapshot construction, evaluator/MCTS, or research logic
  • Historical artifact rewriting; old 7/18 artifacts remain accepted by the compatibility verifier

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

  • cargo test -p hft-data: 44 passed
  • cargo test -p hft-collector --lib: 200 passed, 2 ignored watchdog subprocess fixtures
  • cargo clippy -p hft-data --tests -- -D warnings
  • cargo clippy -p hft-collector --lib --tests -- -D warnings
  • rustfmt --check on the three changed Rust files
  • targeted counterexample: a manifest with rewritten latency and a fresh manifest SHA is rejected because it does not match sealed raw rows
  • two independent read-only reviews: no blockers

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.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@proerror77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: bee675fa-c42e-4a84-bfca-b79d529b7cf1

📥 Commits

Reviewing files that changed from the base of the PR and between dc38369 and 93352a6.

📒 Files selected for processing (3)
  • rust_hft/data-pipelines/core/src/binance_market_tape.rs
  • rust_hft/data-pipelines/core/src/binance_market_tape_artifact.rs
  • rust_hft/tools/collector/src/lob_archiver.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/cex-l2-continuity-224

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment on lines +574 to +575
let lob_continuity = if schema == RAW_SCHEMA {
Some(summarize_lob_continuity(path, config.symbols.clone())?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +137 to +139
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)?);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@proerror77
proerror77 merged commit 7c0a69e into main Jul 23, 2026
20 checks passed
@proerror77
proerror77 deleted the codex/cex-l2-continuity-224 branch July 24, 2026 08:44
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