Skip to content

Testing features#75

Merged
itsibitzi merged 10 commits into
mainfrom
sc-20250725-required-features
Jul 30, 2025
Merged

Testing features#75
itsibitzi merged 10 commits into
mainfrom
sc-20250725-required-features

Conversation

@itsibitzi
Copy link
Copy Markdown
Contributor

Motivation

There are some features we need exposed from the geo_filters crate to support internal usage.

Changes

  • Added or exposed various functions to help users of the library that need to test behaviours based on geofilters: pseudorandom_filter, iter_ones, from_ones.
  • Added serde dependency for SimHashes so people who are serializing structures which use a SimHash can do that without wrapping out types or anything.
  • Moved the deterministic test RNG to use rand_chacha since it is in our dependency tree now (it was before, but it wasn't being used anywhere, I suspect a copy-pasta gone awry). And this will allow test seeds to be reused across all versions of the Rust standard library.

Copilot AI review requested due to automatic review settings July 29, 2025 13:12
@itsibitzi itsibitzi requested a review from a team as a code owner July 29, 2025 13:12
Copy link
Copy Markdown
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 exposes testing features from the geo_filters crate to support internal usage and improves test determinism. The changes make testing utilities available through feature flags and add serialization support.

  • Exposed testing functions (pseudorandom_filter, iter_ones, from_ones) via test-support feature
  • Added serde support for SimHash to enable serialization of structures containing SimHash
  • Migrated from StdRng to ChaCha12Rng for deterministic test seeding across Rust versions

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/geo_filters/Cargo.toml Added test-support and serde features with dependencies
crates/geo_filters/src/test_rng.rs Migrated from StdRng to ChaCha12Rng for deterministic seeding
crates/geo_filters/src/diff_count/sim_hash.rs Made constants public and added serde support
crates/geo_filters/src/diff_count.rs Exposed testing functions and moved helper methods from tests
crates/geo_filters/src/config/lookup.rs Updated test functions to use ChaCha12Rng
crates/geo_filters/src/config.rs Updated test functions to use ChaCha12Rng
Comments suppressed due to low confidence (2)

crates/geo_filters/src/diff_count.rs:344

  • [nitpick] The parameter name 'ones' is ambiguous. Consider renaming it to 'set_bits' or 'indices' to clarify that it represents the positions of bits to set.
    pub fn from_ones(config: C, ones: impl IntoIterator<Item = C::BucketType>) -> Self {

crates/geo_filters/src/diff_count.rs:361

  • [nitpick] The parameter name 'items' is unclear in this context. Consider renaming it to 'num_items' or 'item_count' to better indicate it represents the number of items to generate in the filter.
    pub fn pseudorandom_filter(config: C, items: usize) -> Self {

Comment thread crates/geo_filters/src/diff_count/sim_hash.rs
@itsibitzi itsibitzi force-pushed the sc-20250725-required-features branch from e9de04e to 9e717e7 Compare July 30, 2025 14:00
@itsibitzi itsibitzi enabled auto-merge July 30, 2025 14:00
@itsibitzi itsibitzi merged commit 3e95c46 into main Jul 30, 2025
7 checks passed
@itsibitzi itsibitzi deleted the sc-20250725-required-features branch July 30, 2025 14:04
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