Skip to content

test: remove redundant and implementation-coupled coverage - #337

Merged
tisonkun merged 4 commits into
apache:mainfrom
tisonkun:codex/test-contract-audit
Nov 8, 2026
Merged

tisonkun merged 4 commits into
apache:mainfrom
tisonkun:codex/test-contract-audit

Conversation

@tisonkun

@tisonkun tisonkun commented Nov 7, 2026

Copy link
Copy Markdown
Member

The test suite currently treats specific allocation sizes, centroid layouts, and floating-point rounding choices as stable behavior, and repeats several scenarios across equivalent generic instantiations. This change removes those constraints and consolidates coverage around observable contracts. Production behavior is unchanged.

Changes

  • Remove exact estimated_size() byte counts, allocator-capacity and buffer-reuse expectations, and fixtures used only to inspect inline policy storage. These APIs provide implementation-dependent estimates. Keep the overfull-deserialization regressions that detect unbounded memory growth.
  • Consolidate frequencies update and merge tests instead of repeating the same algorithm for integer and string keys. Remove the separate growth module and duplicate growth round trip. Keep a shorter non-Clone collision regression that checks stream weight and frequency bounds without requiring a particular purge median or survivor count.
  • Remove T-digest output checksums, fixed tie ordering, and byte-level searches for particular merged centroids. Check mixed-input collection through weight, extrema, and median accuracy. Consolidate large-weight rounding cases around ordered queries, bounded quantiles, and nonnegative PMF mass. Retain the documented unchanged result for collecting one nonempty input.
  • Fold REQ sorted-view rank checks into the existing public query reference test. Remove redundant private sorted-view examples, immutable-read smoke tests, and assertions about power-of-two compaction levels. Retain snapshot ownership and Send + Sync checks. Remove two Count-Min update scenarios already covered by update-and-bounds and halving tests.

Cross-language fixtures, malformed-input rejection, overflow handling, distinct serialization codecs, error bounds, and public numerical-stability regressions remain covered. No new test framework or shared fixture layer is introduced. This tests-only change does not require a changelog entry.

Size

22 files changed: 72 lines added, 1,330 removed; net reduction of 1,258 lines. There are 57 fewer test functions.

Validation

  • cargo x prepare-testdata
  • cargo x check
  • cargo x test
  • cargo x lint

All commands pass. A temporary mutation that writes incorrect frequencies rehash probe distances still fails the simplified collision test at the public frequency-bound assertion; the original implementation was restored before the full checks.

Remove tests that require exact backing-array sizes, allocator capacities, buffer reuse thresholds, or inline policy storage from estimated_size(). The public APIs promise a memory estimate, not a stable layout or allocation strategy, so these assertions reject valid implementation changes.

Keep behavior checks in the surrounding reset and capacity tests. Retain the deserialization regressions that bound memory growth after overfull input images; those detect unbounded resource use rather than a specific allocation size.

Remove the padded policy fixture used only by the layout assertions. This change deletes 269 lines without adding replacement test machinery. Integration test targets compile successfully.
Remove repeated numeric and string scenarios for the same generic update and merge implementation, redundant one-item and derived-row equality checks, and the separate growth test module. Existing exact-mode updates, borrowed-string updates, merges, and serialization round trips already exercise those behaviors.

Retain the colliding non-Clone key regression as one update test that checks total stream weight and frequency bounds against the input counts. Do not pin the purge median, exact retained key count, or byte-for-byte stability after an otherwise equivalent round trip. Keep ownership, overflow, empty-state, and distinct serialization codecs covered.

The frequencies integration tests pass. A temporary mutation that writes incorrect rehash probe distances still fails the simplified collision test, demonstrating that the public-contract assertions detect the original regression risk. This commit removes 324 net lines.
…yout

Remove fixed serialized checksums, stable tie-order expectations, and tests that locate a particular merged centroid by decoding output bytes. These assertions freeze compression choices that are not part of the public contract and make valid algorithm changes look like regressions.

Keep mixed compressed and buffered collection coverage using total weight, extrema, and median accuracy. Consolidate large-weight rounding cases into monotonic, finite-range quantile and CDF checks with nonnegative PMF mass instead of requiring particular rounded center values. Drop scalar interpolation scenarios already exercised by the existing scalar-and-batch reference tests.

Retain cross-language snapshots, malformed-image rejection, overflow checks, signed-zero query semantics, extreme-value regressions, and the documented unchanged result for collecting a single nonempty input. No production implementation changes. cargo x check, cargo x test, and cargo x lint pass.
Remove REQ sorted-view unit tests that repeat existing public empty-state and distribution-query coverage. Exercise both direct sketch rank and sorted-view rank against the same exact-mode reference values in the integration test.

Remove shared-reference smoke tests and a four-thread read smoke test that add no behavior coverage beyond the existing immutable calls and Send + Sync assertions. Keep owned-snapshot and argument-validation contracts. Check iterator weights by their sum and item range instead of prescribing power-of-two compaction levels.

Remove Count-Min single-key and repeated-update scenarios already covered by update-and-bounds and halving tests. The Count-Min numeric overflow and precision regressions remain. cargo x check, cargo x test, and cargo x lint pass.
@tisonkun
tisonkun merged commit c23ee3e into apache:main Nov 8, 2026
10 checks passed
@tisonkun
tisonkun deleted the codex/test-contract-audit branch November 8, 2026 01:31
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.

1 participant