Skip to content

Add direct assertions for chutoro-benches discovery/probe and profiling-source return values #184

Description

@leynos

Context

Scheduled mutation-testing run 29561667528 (2026-07-17, main) is the first green run since the baseline flakiness fix in #169 landed. It scoped to chutoro-benches/, chutoro-core/ and related files changed in the preceding window and produced a clean baseline, then tested mutants against that baseline:

219 mutants tested in 20m: 10 missed, 36 caught, 173 unviable

All 10 survivors sit in the chutoro-benches benchmark-support/profiling harness. No survivors were reported outside chutoro-benches in this run.

Survivors (representative sample, all 10 listed)

  • chutoro-benches/src/criterion_support.rs:37 — replace is_benchmark_discovery -> bool with true
  • chutoro-benches/src/criterion_support.rs:101 — replace is_exact_benchmark_probe -> bool with true
  • chutoro-benches/src/criterion_support.rs:101 — replace is_exact_benchmark_probe -> bool with false
  • chutoro-benches/src/neighbour_scoring/benchmark_support.rs:86 — replace ^ with | in make_values
  • chutoro-benches/src/neighbour_scoring/benchmark_support.rs:86 — replace ^ with & in make_values
  • chutoro-benches/src/neighbour_scoring/build_profile.rs:95 — replace should_collect_build_profile -> bool with false
  • chutoro-benches/src/neighbour_scoring/build_profile.rs:205 — replace build_profile_report_target -> Option<ReportTarget> with None
  • chutoro-benches/src/neighbour_scoring/profiling.rs:87 — replace <impl DataSource for ProfilingSource<S>>::name -> &str with ""
  • chutoro-benches/src/neighbour_scoring/profiling.rs:87 — replace <impl DataSource for ProfilingSource<S>>::name -> &str with "xyzzy"
  • chutoro-benches/src/neighbour_scoring/profiling.rs:91 — replace <impl DataSource for ProfilingSource<S>>::metric_descriptor -> MetricDescriptor with Default::default()

Analysis

The survivors cluster into two related groups within the benchmark harness:

  1. Benchmark discovery/probe classification (criterion_support.rs, benchmark_support.rs): the predicates that decide whether a Criterion invocation is a discovery pass or an exact probe, and the make_values bit-flag construction, have no test asserting their return values directly — only end-to-end smoke coverage that happens not to distinguish true/false or ^/|/& outcomes.
  2. Profiling data source (build_profile.rs, profiling.rs): ProfilingSource::name, metric_descriptor, should_collect_build_profile, and build_profile_report_target are exercised by the harness but their concrete return values are never asserted, so mutating them to defaults, empty strings, or placeholder values goes undetected.

This is benchmark-support tooling rather than the core clustering algorithm, so risk is lower, but the harness is what gates performance regression detection, and an untested probe/discovery classifier can silently misclassify benchmark runs.

Proposed next step

Add direct unit assertions for:

  • is_benchmark_discovery and is_exact_benchmark_probe against representative Criterion argument vectors (both true and false cases).
  • make_values' use of XOR in bit construction (assert a case that would differ under OR/AND).
  • ProfilingSource::name and metric_descriptor return values.
  • should_collect_build_profile and build_profile_report_target against both enabled and disabled configuration.

No infrastructure changes are needed; this is pure test-coverage debt in chutoro-benches.

Rescope (2026-08-13)

The pure argument-taking variants have since gained real rstest coverage (criterion_support.rs:218-286: args_contain_flag, is_exact_benchmark_probe_args across true/false/embedded-substring cases, point_count_for_exact_probe_args, is_nextest_exact_benchmark_probe_args, should_short_circuit_exact_label_probe_args). The remaining unasserted survivors this issue now tracks:

  • is_benchmark_discoverycriterion_support.rs:36 (thin env-reading wrapper)
  • is_exact_benchmark_probecriterion_support.rs:100-101 (thin env-reading wrapper)
  • should_collect_build_profilebuild_profile.rs:95 (wraps the doctested _value variant with std::env::var)
  • build_profile_report_targetbuild_profile.rs:207 (same pattern)
  • make_values XOR logic — benchmark_support.rs:79-86 (no direct assertion; benchmark_support_tests.rs covers fixtures and report writing only)
  • ProfilingSource::name / metric_descriptorprofiling.rs:87,91 (profiling_source_tests.rs checks counters, batch stats, and snapshot reset only)

Note the four env-reading wrappers intersect with the injected-seam convention (#177): asserting them directly may be easiest via the same seam approach rather than mutating the process environment in tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lowBacklog work, hygiene, or technical debt planned opportunistically, without a strict deadline.testingTest coverage, test infrastructure, and verification tooling work.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions