tisonkun commented on PR #221:
URL: 
https://github.com/apache/datasketches-rust/pull/221#issuecomment-5408952625

   Here is a suggested prompt for the coding agent. The key is to reason from 
the complete deserialized-state contract instead of patching each 
counterexample independently:
   
   > Read `CONTRIBUTING.md` in full. Review the complete REQ construction, 
update, merge, serialize, and deserialize paths, plus the pinned C++/Java 
compatibility fixtures and reference implementations. Do not modify code yet.
   >
   > First, enumerate every invariant that holds for a `ReqSketch` produced 
through safe Rust APIs and serialization. For every wire-controlled field, 
identify all downstream operations that rely on it and the concrete failure 
caused by violating it. Cover at least: header/RAW_ITEMS consistency; level 
count and `lg_weight`; the reachable relationship among `k`, `state`, 
`section_size_raw`, and `num_sections`; actual ordering whenever `is_sorted` is 
true; NaN/value assumptions; weighted retained count versus `n`; retained count 
versus nominal capacity; min/max consistency; and arithmetic/allocation bounds.
   >
   > Then implement one coherent validation boundary that rejects malformed 
images with `ErrorKind::InvalidData` before constructing a usable sketch. Avoid 
validation rules based only on global numeric ranges when fields are derived 
from other serialized state. Preserve every valid C++/Java fixture and Rust 
round trip.
   >
   > Add focused regression tests that start from canonical valid images and 
mutate exactly one invariant. Include boundary and neighboring cases, not only 
the reported examples. In particular cover false sorted claims, 
`k`/section-schedule mismatches, nonzero invalid section counts, weighted-count 
mismatch and overflow, and retained count at/above capacity. Ensure each test 
asserts the intended validation branch and error kind.
   >
   > Keep the implementation small: share algorithm constants instead of 
duplicating them, use a test helper for repeated `InvalidData` assertions, and 
do not add a changelog entry because REQ is still unreleased. Run `cargo x 
prepare-testdata`, `cargo x check`, `cargo x test`, and `cargo x lint`, and 
report the invariant table, implementation choices, compatibility evidence, and 
command results.
   


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