Skip to content

Fix mutation baseline by making heuristics::text doctests compile#73

Draft
leynos wants to merge 1 commit into
mainfrom
fix-mutation-baseline
Draft

Fix mutation baseline by making heuristics::text doctests compile#73
leynos wants to merge 1 commit into
mainfrom
fix-mutation-baseline

Conversation

@leynos

@leynos leynos commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Closes #66.

Three doctests in src/heuristics/text.rs imported items via lag_complexity::heuristics::text, but the module was declared pub(crate), so plain cargo test --all-features failed with E0603 while CI stayed green (make test passed --all-targets, which skips doctests). The scheduled cargo-mutants workflow validates its unmutated baseline with plain cargo test --all-features, so the baseline failed before any mutants ran.

Changes

  • src/heuristics/mod.rs: promote heuristics::text from pub(crate) to pub. The module's functions were already pub, #[must_use]-annotated, and documented with examples written against the public path, so publishing the module keeps the examples as real, runnable doctests rather than demoting them to ignore prose. The issue lists this as an acceptable resolution, and the crate is pre-1.0.
  • src/heuristics/text.rs: add #[must_use] to weighted_count, satisfying the pedantic must_use_candidate lint now that the function is externally visible.
  • Makefile: the test target now also runs cargo test --doc --all-features, closing the blind spot permanently — --all-targets will never again mask a doctest that plain cargo test (as run by cargo-mutants) compiles.

Validation

  • cargo test --all-features (doctests included): three consecutive green runs; all 18 doctests pass, including the three previously failing ones (normalize_tokens, weighted_count, substring_count_regex).
  • make test (including the new doctest step), make typecheck, make check-fmt, make markdownlint: green.
  • make lint: Clippy green. The locally installed Whitaker suite reports pre-existing unwrap_or_else findings in tests/ambiguity_heuristic.rs and tests/lagc_args.rs — files untouched by this diff; CI pins whitaker-installer 0.2.5 and is green on main, so these are a local toolchain-vintage discrepancy, not introduced here.
  • The issue Flaky proptest: possessive_proper_noun_anchors_pronoun fails on generated input (name=Alice, pronoun=It, verb=her) #68 proptest flake did not trip during any of the runs.

The three doctest examples in src/heuristics/text.rs import items via
lag_complexity::heuristics::text, but the module was declared
pub(crate), so the examples failed to compile under plain
`cargo test --all-features`. CI never noticed because `make test`
passed --all-targets, which skips doctests entirely, while the
scheduled cargo-mutants workflow validates its baseline with plain
`cargo test` and therefore failed before exercising any mutants.

Promote heuristics::text to a public module: its functions were
already `pub` with documentation written against the public path, and
publishing them keeps the examples as real, runnable doctests rather
than ignored prose. Add `#[must_use]` to weighted_count to satisfy
the pedantic must_use_candidate lint on the newly visible function.

Also run `cargo test --doc --all-features` from the `test` Makefile
target so the gap between --all-targets and plain `cargo test` cannot
recur unseen.

Closes #66.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8545e833-2aa6-4fd4-8eb0-9ed45a85cbce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-mutation-baseline

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doctests in src/heuristics/text.rs fail under plain cargo test, blocking the mutation baseline

1 participant