tisonkun opened a new pull request, #256: URL: https://github.com/apache/datasketches-rust/pull/256
## Summary This PR addresses a small set of release-facing issues found while auditing the crate for 0.5.0: - remove CPC inspection methods that were public only to support tests, and assert observable behavior instead; - reject truncated Count-Min images before allocating the counter table described by an untrusted header; - expose required Cargo features in docs.rs and document the error contracts of fallible public APIs; - include `LICENSE` and `NOTICE` in the crates.io archive and verify their synchronization during release preparation. This is follow-up hardening for #252. The changelog calls out the CPC API removal as a breaking change. ## Evidence and audit boundary Each change here has a concrete failure mode or caller-facing cost: - `#[doc(hidden)]` did not make the CPC inspection methods private; `cargo-semver-checks` exposed them as part of the public API, while integration tests were their only callers. - A 16-byte malformed Count-Min image could previously declare `1 << 29` buckets and cause allocation of roughly 4 GiB before deserialization noticed that the payload was missing. - The crate enables no sketch implementations by default, but generated documentation did not identify the feature required for each module even though `doc_cfg` support was already enabled. - Several public `Result`-returning constructors and update methods omitted the conditions callers must handle. - `cargo package --list` showed that the package-root layout omitted the repository's legal files from the published archive. The audit deliberately did **not** turn speculative concerns into commits. In particular, this PR does not change Count-Min overflow semantics, the generic `estimated_size` contract tracked by #193, `Display` behavior, KLL support, or broad test coverage. It also retains `CpcWrapper`'s preamble-only parsing after comparing it with the Java implementation; its documentation now states that contract directly. ## Commit structure 1. `refactor(cpc): remove test-only public inspection APIs` 2. `fix(countmin): validate payload before table allocation` 3. `docs: label feature-gated sketch modules` 4. `docs: state public deserialization error contracts` 5. `docs(theta): document update failures` 6. `build: include legal notices in the published crate` 7. `chore: normalize legal file whitespace` The final commit is intentionally separate: the legal files already contained trailing spaces and surplus final blank lines, which made the otherwise exact package-local copies fail `git diff --check`. ## Validation - `cargo x prepare-testdata` - `cargo x check` - `cargo x test` - `cargo x lint` - `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps` - `cmp LICENSE datasketches/LICENSE` - `cmp NOTICE datasketches/NOTICE` - `cargo package --list -p datasketches` - `cargo publish --dry-run --locked -p datasketches` - `git diff --check origin/main...HEAD` The publish dry-run packaged 102 files (1.9 MiB, 280.9 KiB compressed) and compiled the packaged crate successfully. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
