Store correctness contract test suite#212
Merged
milindsrivastava1997 merged 5 commits intomainfrom Mar 20, 2026
Merged
Conversation
Defines a run_contract_suite() function that tests every observable
behaviour of a Store implementation:
- Empty-store edge cases (range query, exact query, earliest timestamp)
- Single insert: range query hit/miss, exact query hit/miss (wrong start,
wrong end)
- Batch insert: count correctness, chronological ordering guaranteed
- Partial range filtering (windows outside query range excluded)
- Aggregation-ID isolation (inserts into agg 1 not visible to agg 2)
- Earliest-timestamp tracking: global minimum, per agg-ID
- Cleanup — CircularBuffer: oldest window evicted, newest 8 retained
- Cleanup — ReadBased: evicted after threshold reads, unread window kept
- Concurrency: 8-thread concurrent inserts (no data loss),
8-thread concurrent reads (each returns full result set)
Two test entry points exercise both existing implementations:
contract_per_key — LockStrategy::PerKey (reference)
contract_global — LockStrategy::Global
Adding a new Store implementation requires only a new #[test] function
that calls run_contract_suite() with the new factory.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ltaSet exclusion - Add SerializableToSink import so clone-fidelity tests compile on concrete types - Clone fidelity tests for all 11 accumulator types: SumAccumulator, MinMaxAccumulator, DatasketchesKLLAccumulator, IncreaseAccumulator, MultipleSumAccumulator, MultipleMinMaxAccumulator, SetAggregatorAccumulator, DeltaSetAggregatorAccumulator, CountMinSketchAccumulator, CountMinSketchWithHeapAccumulator, HydraKllSketchAccumulator - Three keyed-entry tests: grouping by key, coexistence of keyed/unkeyed, multiple keys per window - DeltaSetAggregator cleanup exclusion test - Concurrency tests: concurrent inserts (8 threads) and concurrent reads Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
95a5de9 to
cf25142
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
milindsrivastava1997
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
store_correctness_testsmodule that defines a contract test suite — a singlerun_contract_suitefunction called from two#[test]entry points — one for eachLockStrategy. Any futureStoreimplementation can be validated by callingrun_contract_suitewith its factory.Coverage (33 sub-tests per strategy = 66 assertions total)
Empty-store edge cases
NoneSingle insert
NoneNoneBatch inserts
Partial-range filtering
Aggregation-ID isolation
Earliest-timestamp tracking
Cleanup policies
CircularBuffer: evicts oldest windows when count exceeds thresholdCircularBuffer: newest windows are retained after evictionReadBased: evicts windows after the configured read-count thresholdReadBased: windows below the threshold are retainedDeltaSetAggregator exclusion
DeltaSetAggregator-typed agg IDs bypass cleanup entirely, even when the circular-buffer policy would otherwise evictKeyed (label-grouped) entries
KeyByLabelValueskey are grouped correctly in query resultsClone fidelity (all 11 accumulator types)
Each test inserts an accumulator into the store, queries it back, calls
clone_boxed_core(), and assertsserialize_to_json()output is identical:SumAccumulatorMinMaxAccumulatorDatasketchesKLLAccumulator(k=200)IncreaseAccumulatorMultipleSumAccumulatorMultipleMinMaxAccumulatorSetAggregatorAccumulatorDeltaSetAggregatorAccumulatorCountMinSketchAccumulatorCountMinSketchWithHeapAccumulatorHydraKllSketchAccumulatorConcurrency
Test plan
cargo test -p query_engine_rust store_correctness— 2 tests pass (PerKey + Global), 66 sub-assertions eachcargo fmt --all— no formatting issues🤖 Generated with Claude Code