Skip to content

test: randomize seeded detector coverage#27

Merged
Bing-su merged 2 commits into
mainfrom
fix/tests
Jun 10, 2026
Merged

test: randomize seeded detector coverage#27
Bing-su merged 2 commits into
mainfrom
fix/tests

Conversation

@Bing-su

@Bing-su Bing-su commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Replace fixed seeds in non-documentation tests with property-generated seeds across Rust and Python test suites. Preserve simulation semantics by checking seed-stable anomaly signals for FeatureSketch, mStream, OnlineIForest, and Forest attribution/imputation behavior.

Keep documentation example seeds fixed for reproducible examples.

Replace fixed seeds in non-documentation tests with property-generated seeds
across Rust and Python test suites. Preserve simulation semantics by checking
seed-stable anomaly signals for FeatureSketch, mStream, OnlineIForest, and
Forest attribution/imputation behavior.

Keep documentation example seeds fixed for reproducible examples.

Copilot AI 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.

Pull request overview

This PR updates the Rust and Python test suites to avoid relying on fixed RNG seeds by generating seeds via property-based testing (proptest/Hypothesis), while aiming to keep anomaly-signal assertions stable and reproducible via failure-reported seeds.

Changes:

  • Replaced fixed-seed unit/integration tests with property-generated seeds in Rust (proptest) and Python (Hypothesis).
  • Refactored Rust simulation tests into seed-parameterized assertion helpers invoked from proptests, improving failure diagnostics by printing the seeds.
  • Updated Python JSON roundtrip tests to use temporary directories within the property tests, and made detector/forest seed parameters optional (None => random).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/public_api_surface.rs Converts the public API smoke test to a proptest with generated seeds.
tests/onlineiforest_test.py Generates seeds via Hypothesis and adjusts JSON roundtrip test temp-path handling.
tests/onlineiforest_simulation.rs Converts the OnlineIForest simulation to proptest-driven randomized seed coverage with improved failure context.
tests/mstream_simulation.rs Converts mStream simulations to proptest-driven randomized seeds and strengthens some invariants.
tests/forest_test.rs Extends existing proptests to randomize forest seeds and adjusts attribution/imputation-related assertions.
tests/forest_test.py Switches multiple tests to Hypothesis-provided seeds and makes seed optional in helpers.
tests/featuresketch_test.py Switches selected tests to Hypothesis-provided seeds and updates JSON roundtrip temp-path handling.
tests/featuresketch_simulation.rs Converts FeatureSketch simulations to proptest-driven randomized seeds with improved failure context.

Comment thread tests/public_api_surface.rs
Comment thread tests/forest_test.rs
Comment thread tests/mstream_simulation.rs Outdated
Comment thread tests/featuresketch_simulation.rs
Comment thread tests/mstream_simulation.rs
Comment thread tests/onlineiforest_simulation.rs
Comment thread tests/forest_test.rs Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comment on lines +286 to +288
proptest! {
#![proptest_config(ProptestConfig::with_cases(32))]

Comment on lines +280 to +282
proptest! {
#![proptest_config(ProptestConfig::with_cases(32))]

Comment on lines +135 to +137
proptest! {
#![proptest_config(ProptestConfig::with_cases(32))]

Comment thread tests/forest_test.py
*,
input_dim: int,
seed: int,
seed: int | None = None,
@Bing-su Bing-su merged commit ee682ef into main Jun 10, 2026
12 checks passed
@Bing-su Bing-su deleted the fix/tests branch June 10, 2026 04:28
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.

2 participants