Skip to content

mutants::skip has no effect on the connect_parts.rs const initialiser #621

Description

@leynos

Context

Run 29634028880 (schedule, 2026-07-18, main post-PR #612) still reports two survivors that PR #612 explicitly tried to suppress as equivalent mutants:

src/client/connect_parts.rs:26:48: replace * with + in const initialiser
src/client/connect_parts.rs:26:48: replace * with / in const initialiser

The item is annotated:

// Equivalent mutant: a pre-allocation hint later min'd against the codec's
// max_frame_length, so `*`→`+`/`/` cannot change observable behaviour.
#[cfg_attr(test, mutants::skip)]
const INITIAL_READ_BUFFER_CAPACITY: usize = 64 * 1024;

Analysis

cargo-mutants' skip-attribute scope (book/src/attrs.md, cargo-mutants 27.1.0) only honours mutants::skip on: functions, impl blocks, trait blocks, mod blocks, whole files (#![mutants::skip]), and a specific list of expression kinds (match, struct literal, call, method-call, unary). A plain const value declaration is not in that list, and its initialiser — a binary multiplication expression — is not one of the covered expression kinds either (only match/struct-literal/call/method-call/unary are). The attribute is therefore silently ignored here: cargo-mutants still mutates the 64 * 1024 initialiser and reports the two survivors that #612 believed it had suppressed.

Checked against every other mutants::skip annotation added by #612 (src/message_assembler/budget.rs:27, src/server/runtime/backoff.rs:58, src/client/runtime.rs:107, src/push/queues/mod.rs:118, src/request/mod.rs:362) — all five sit directly above a fn/const fn item, which is a supported scope, and none of those five reappear as survivors in this run. connect_parts.rs:26 is the only skip placed on a plain const, and it is the only one still surviving.

Proposed next step

Either:

  1. Wrap the initialiser in a const fn (a supported skip scope) so the annotation takes effect, e.g. const fn initial_read_buffer_capacity() -> usize { 64 * 1024 }; or
  2. Drop the skip annotation (it has no effect) and instead add INITIAL_READ_BUFFER_CAPACITY to the mutation caller's exclude-globs/exclude_re filters, or accept the survivor with a short comment in the mutation-testing docs noting the attribute-scope limitation, so future harvests do not re-flag it as new.

Either way, the equivalent-mutant convention documented for #612 (cfg_attr(test, mutants::skip) plus a justification comment) should note that it does not apply to const value declarations or to binary-expression initialisers, to prevent the same mistake recurring elsewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglowAin't annoying anyone but the QA departmenttesting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions