@@ -896,20 +896,18 @@ fn connect_refuses_to_start_under_an_eviction_policy() {
896896 ) ;
897897}
898898
899- // ── migrate() / with_conn retry — mutation-testing coverage gaps (round: cargo-mutants) ───────
899+ // ── migrate() / with_conn retry: guards on two predicates in `store-valkey/src/lib.rs` ── ───────
900900//
901- // `cargo-mutants` against `store-valkey/src/lib.rs` found four real coverage gaps (no production
902- // bug — the existing logic is correct, but nothing in the suite would have caught it breaking):
903- // - `migrate()`'s `version >= SCHEMA_VERSION` early-return guard (mutating `>=` to `<` survived
904- // every existing test) — nothing exercised a SECOND `connect()` against an
905- // already-migrated namespace, which is exactly the case that guard exists to protect: without
906- // it, every reconnect would wipe the entire shared `busbar:*` keyspace.
907- // - `run()`'s `retry && is_connection_error(&e)` match guard (mutating it to `true`, `false`, or
908- // `retry || is_connection_error(&e)` all survived) — nothing exercised either half of the
909- // condition independently: a non-connection error under `retry: true` (must NOT retry) or a
910- // genuine connection-level error (must retry and transparently recover).
911-
912- /// Kills the `version >= SCHEMA_VERSION` -> `version < SCHEMA_VERSION` mutant: a second
901+ // The logic these pin is correct; what was missing was anything that would fail if it broke. Both
902+ // predicates are silent in normal operation and catastrophic when wrong:
903+ // - `migrate()`'s `version >= SCHEMA_VERSION` early return. If that comparison were inverted, a
904+ // SECOND `connect()` against an already-migrated namespace would wipe the entire shared
905+ // `busbar:*` keyspace on every reconnect.
906+ // - `run()`'s `retry && is_connection_error(&e)` match guard. Each half must hold on its own: a
907+ // non-connection error under `retry: true` must NOT be retried, and a genuine connection-level
908+ // error must be retried and transparently recovered.
909+
910+ /// Pins the `version >= SCHEMA_VERSION` early return against inversion: a second
913911/// `connect()` (fresh `ValkeyStore`, fresh internal `migrate()` call) against a namespace already
914912/// at the current schema version must be a pure no-op, not a full `busbar:*` wipe.
915913#[ test]
@@ -932,9 +930,9 @@ fn reconnecting_to_an_already_migrated_namespace_does_not_wipe_existing_data() {
932930 ) ;
933931}
934932
935- /// Kills the `true` and ` retry || is_connection_error(&e)` mutants: a deterministic
936- /// NON-connection error (`WRONGTYPE`, from issuing `LPUSH` against a string-valued key) under
937- /// `with_conn` (`retry: true`) must surface directly via the `"command"` error context, never
933+ /// Pins the `retry && is_connection_error(&e)` guard against a constant-true or `||` form. A
934+ /// deterministic NON-connection error (`WRONGTYPE`, from issuing `LPUSH` against a string-valued
935+ /// key) under `with_conn` (`retry: true`) must surface directly via the `"command"` error context, never
938936/// silently retry — a retry would issue the exact same doomed command again and report it via the
939937/// `"retry after reconnect"` context instead, which is what this test would see if the guard ever
940938/// stopped checking `is_connection_error` at all.
@@ -960,9 +958,9 @@ fn with_conn_does_not_retry_a_non_connection_error() {
960958 store. with_conn ( |c| c. del :: < _ , ( ) > ( & k) ) . unwrap ( ) ;
961959}
962960
963- /// Kills the `false` mutant : a genuine connection-level error (the server killing our connection
964- /// out from under us — the real-world case `with_conn`'s reconnect-and-retry exists for) must be
965- /// transparently recovered, not surfaced to the caller.
961+ /// Pins the retry half of the guard : a genuine connection-level error (the server killing our
962+ /// connection out from under us, the real-world case `with_conn`'s reconnect-and-retry exists for)
963+ /// must be transparently recovered, not surfaced to the caller.
966964#[ test]
967965fn with_conn_transparently_reconnects_after_the_connection_is_dropped ( ) {
968966 let Some ( store) = live_store ( ) else { return } ;
0 commit comments