Skip to content

Buffer and sync metrics#1963

Draft
cursor[bot] wants to merge 1 commit intotest/delta-buffering-simfrom
cursor/buffer-and-sync-metrics-5f9a
Draft

Buffer and sync metrics#1963
cursor[bot] wants to merge 1 commit intotest/delta-buffering-simfrom
cursor/buffer-and-sync-metrics-5f9a

Conversation

@cursor
Copy link
Contributor

@cursor cursor bot commented Feb 12, 2026

This pull request contains changes generated by a Cursor Cloud Agent

- DeltaBuffer.push: Only increment drops counter when pop_front()
  actually evicts an element. Fixes false positive drops at zero
  capacity where pop_front() returns None on empty deque.

- SyncComplete handler: Add record_write() call for replayed
  operations to match GossipDelta and apply_actions behavior.
  Ensures write metrics are consistent across all code paths.
@cursor
Copy link
Contributor Author

cursor bot commented Feb 12, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions
Copy link

Your PR title does not adhere to the Conventional Commits convention:

<type>(<scope>): <subject>

Common errors to avoid:

  1. The title must be in lower case.
  2. Allowed type values are: build, ci, docs, feat, fix, perf, refactor, test.

Copy link

@meroreviewer meroreviewer bot left a comment

Choose a reason for hiding this comment

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

🤖 AI Code Reviewer

Reviewed by 3 agents | Quality score: 100% | Review time: 144.9s

📝 1 nitpicks. See inline comments.


🤖 Generated by AI Code Reviewer | Review ID: review-5b66b860

// Evict oldest delta (front of queue)
let _evicted = self.deltas.pop_front();
self.drops += 1;
// Only increment drops if we actually evicted something
Copy link

Choose a reason for hiding this comment

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

📝 Nit: Edge case handling could be documented or prevented at construction

The pop_front().is_some() check only triggers when capacity == 0 (otherwise len >= capacity guarantees non-empty deque); consider adding a debug_assert or constructor validation for capacity > 0 rather than silently handling this edge case.

Suggested fix:

Add `debug_assert!(self.capacity > 0, "DeltaBuffer with zero capacity");` or validate in `new()`

@github-actions
Copy link

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions bot added the Stale label Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant