Skip to content

mcp_server/core/provenance.py: pre-existing mutation-coverage gap in grade_provenance/_build_reason/extract_* #389

Description

@cdeust

Context

Discovered 2026-08-08 while implementing #345 (write-time provenance hint
fix). scripts/mutation_check.sh mutates the whole target source file, not
just the diff's changed lines. Running it against
mcp_server/core/provenance.py (scoped to tests_py/core/test_provenance.py)
surfaced ~43 surviving mutants in functions #345's diff does NOT touch:

  • extract_commit_refs, extract_url_refs, extract_artifact_refs,
    has_citation_ref (regex-extraction boundary conditions)
  • _build_reason (grade/dead/uncheckable branch combinations)
  • grade_provenance (per-reference-type outcome combinations)
  • _ref_counts

This module (core/provenance.py, I6-D6) predates coding-standards.md §12's
mutation-testing requirement and appears to have never had a mutation-testing
pass run against it — the survivors are boundary/combination gaps in
tests_py/core/test_provenance.py's existing coverage (e.g. off-by-one
mutations on boundary comparisons, string-literal XX-marker mutations on
messages _build_reason never asserts verbatim, per-reference-type
combination gaps in grade_provenance).

Why deferred, not fixed in #345

#345's diff adds three new functions (_dead_ref_hint_root_missing/_implicit/ _explicit) and modifies _unverifiable_hint/write_time_hint only; it does
not touch grade_provenance, _build_reason, or the extract_* functions.
#345's own "Non-goals" section explicitly scopes it away from the grading
logic ("Not proposing to change the grading rule"). #345's PR fixes 100% of
the mutants introduced by ITS diff (verified 0 unregistered survivors in the
new/changed functions); this issue tracks the pre-existing gap it happened to
surface, per coding-standards.md §14.3 (legitimate deferral: genuinely outside
the change's blast radius).

Reproduce

scripts/mutation_check.sh "tests_py/core/test_provenance.py" mcp_server/core/provenance.py

Acceptance

0 surviving non-equivalent mutants across the whole file (or each survivor
documented in memory/mutation-equivalents.json), matching the standard
#345's diff was held to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions