tisonkun opened a new pull request, #190:
URL: https://github.com/apache/datasketches-rust/pull/190

   ## Summary
   
   Validate the serialized Bloom `num_bits_set` cache against the decoded bit 
array.
   
   For every non-empty image, deserialization now computes the population 
count. The dirty sentinel (`u64::MAX`) continues to request a recount, while 
any other mismatched cached count returns `ErrorKind::InvalidData`.
   
   This prevents inconsistent metadata from making a non-empty bit array appear 
empty and causing `contains` to return a false negative.
   
   Closes #187.
   
   ## Regression coverage
   
   The new tests verify that:
   
   - a cached count of zero over a non-empty bit array is rejected,
   - non-zero undercounts and overcounts are rejected,
   - the dirty sentinel is accepted and recomputed, and
   - inserted values remain present after the dirty-image decode.
   
   The existing Java, C++, and Go snapshot suites pass unchanged.
   
   ## Relationship to other implementations
   
   Current Java, C++, and Go readers, like the previous Rust implementation, 
trust non-dirty cached counts and only recount the dirty sentinel:
   
   - Java heap reader: 
https://github.com/apache/datasketches-java/blob/4067ffefabbcd03944dc3617ff2948ab760f3b75/src/main/java/org/apache/datasketches/filters/bloomfilter/HeapBitArray.java#L57-L83
   - Java direct reader: 
https://github.com/apache/datasketches-java/blob/4067ffefabbcd03944dc3617ff2948ab760f3b75/src/main/java/org/apache/datasketches/filters/bloomfilter/DirectBitArrayR.java#L43-L54
   - C++ reader: 
https://github.com/apache/datasketches-cpp/blob/c22888581964fc490feee835766cc8c3adb722e0/filters/include/bloom_filter_impl.hpp#L286-L314
   - Go reader: 
https://github.com/apache/datasketches-go/blob/c558cc2d64f9a307c196a7adb0067eadd1b776f7/filters/bloom_filter_builder.go#L245-L269
   
   This PR intentionally makes Rust stricter. It does not change the wire 
format and accepts every internally consistent image, including the shared 
dirty-sentinel representation. It only rejects corrupted metadata that can 
violate the Bloom no-false-negative contract.
   
   ## Validation
   
   - `cargo x prepare-testdata`
   - `cargo x check`
   - `cargo x test`
   - `cargo x lint`
   


-- 
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]

Reply via email to