Background
Introduced in PR #346, RouteCacheKey::for_route_request canonicalizes route request JSON payloads before hashing. The current test suite covers only eight discrete coordinate cases and single structural examples.
Problem
Unexplored input combinations remain untested:
- Arbitrary JSON key orderings at all nesting depths
- All permutations of theme arrays (
themes, themeIds, interestThemeIds)
- Floating-point edge cases (precision boundaries at five decimal places, NaN, Infinity, subnormal values)
- Deeply nested objects with mixed coordinate and non-coordinate fields
Required work
Introduce proptest-based property tests in backend/src/domain/ports/cache_key.rs (or a companion file) with strategies that:
- Generate arbitrary
serde_json::Value objects with randomized key ordering at every nesting depth and assert the derived key is identical regardless of ordering.
- Generate all permutations of theme array values and assert key stability.
- Generate
f64 values across the full range and assert rounding to five decimal places is applied consistently.
- Assert that materially different payloads never produce the same key (collision resistance spot-check).
References
Background
Introduced in PR #346,
RouteCacheKey::for_route_requestcanonicalizes route request JSON payloads before hashing. The current test suite covers only eight discrete coordinate cases and single structural examples.Problem
Unexplored input combinations remain untested:
themes,themeIds,interestThemeIds)Required work
Introduce proptest-based property tests in
backend/src/domain/ports/cache_key.rs(or a companion file) with strategies that:serde_json::Valueobjects with randomized key ordering at every nesting depth and assert the derived key is identical regardless of ordering.f64values across the full range and assert rounding to five decimal places is applied consistently.References