Skip to content

Conversation

@aneubeck
Copy link
Collaborator

There was some "unexpected" behaviour in BitVec.
It took as argument a size, but then replaced it (sometimes) with the larger bit position?!?
I removed that hack and fixed the calling places.

Copilot AI review requested due to automatic review settings July 25, 2025 06:30
@aneubeck aneubeck requested a review from a team as a code owner July 25, 2025 06:30
@aneubeck aneubeck changed the base branch from main to sc-20250724-geofilter-deterministic-tests July 25, 2025 06:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes deterministic sizing behavior in BitVec by removing logic that would sometimes replace the intended size with the largest bit position. The changes ensure BitVec maintains its specified size consistently and updates all calling code to work with this corrected behavior.

Key changes:

  • Removed conditional size replacement logic in BitVec::from_bit_chunks that created non-deterministic behavior
  • Fixed GeoDiffCount construction and bit manipulation logic to handle the corrected BitVec sizing
  • Introduced a test harness for deterministic random number generation across all tests

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/geo_filters/src/test_rng.rs Adds new test harness for seeded RNG with panic recovery
crates/geo_filters/src/lib.rs Imports the new test_rng module for test builds
crates/geo_filters/src/distinct_count.rs Updates tests to use new RNG harness
crates/geo_filters/src/diff_count/bitvec.rs Removes size replacement logic and unused parameter
crates/geo_filters/src/diff_count.rs Fixes bit manipulation logic and updates tests
crates/geo_filters/src/config/lookup.rs Updates tests to use new RNG harness
crates/geo_filters/src/config.rs Updates test estimation function to use new RNG harness
Comments suppressed due to low confidence (1)

crates/geo_filters/src/diff_count.rs:523

  • [nitpick] Running the same test 1000 times with different random seeds may be excessive and could significantly slow down test execution. Consider reducing this to a more reasonable number like 10-100 iterations.
        for _ in 0..1000 {

/// be EMPTY instead.
pub fn from_bit_chunks<I: Iterator<Item = BitChunk>>(
mut chunks: Peekable<I>,
chunks: Peekable<I>,
Copy link

Copilot AI Jul 25, 2025

Choose a reason for hiding this comment

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

The chunks parameter is no longer used after removing the peek operation. Consider removing the Peekable wrapper and use I directly since the parameter is only passed to iter_ones which can handle a regular iterator.

Suggested change
chunks: Peekable<I>,
chunks: I,

Copilot uses AI. Check for mistakes.
@itsibitzi
Copy link
Contributor

Following a discussion on Slack with Alex I've cherry-picked these changes onto my branch. Going to close this PR.

@itsibitzi itsibitzi closed this Jul 25, 2025
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.

3 participants