Skip to content

test: pin the comparison-safety classifier, which mutation testing found open - #67

Merged
webdevsamran merged 1 commit into
mainfrom
test/comparability-safety
Sep 9, 2026
Merged

test: pin the comparison-safety classifier, which mutation testing found open#67
webdevsamran merged 1 commit into
mainfrom
test/comparability-safety

Conversation

@webdevsamran

Copy link
Copy Markdown
Owner

aihwbench/comparability.py decides whether two benchmark results may be compared at all. It is the mechanism behind this project's central claim — that a number from one runtime and a number from another differ only in what they measured.

Mutation testing scored it 45.5%: 12 of 22 mutants survived.

Three survivors were safety-relevant

Line Mutation What it would have allowed
assert_comparable == != The guard raises for comparable results and permits incomparable ones — allowing exactly what it exists to block
_same mixed-None FalseTrue A run that never recorded its seed compares strictly against one that did — a published comparison between two different experiments
_same both-None andor A single None means identical

The first is the single most consequential line in the module, and nothing constrained it.

All three are now pinned, along with every field in _STRICT being load-bearing rather than decorative, and _CONDITIONAL downgrading rather than blocking.

The remaining seven are equivalent mutants — verified, not assumed

  • The continue guards inside both diff loops are unreachable. strict_diffs is built with _same, and _same(None, None) is True, so a path where both sides are missing never enters the loop. Measured: zero such paths. That code is defensive in appearance only.
  • Mutating _same's or to and is behaviour-preserving: a one-None comparison falls through to bool(None == value), which is already False.

So the module is at 15 of 15 killable mutants. Reporting the raw 68.2% alongside that rather than only the flattering number — a mutation score is a diagnostic, not a target.

Verification

Gate Result
ruff / ruff format --check clean, 111 files
mypy clean, 73 source files
pytest 424 passed
coverage 70.85% against the 68% floor

…und open

aihwbench/comparability.py decides whether two benchmark results may be
compared at all. It is the mechanism behind this project's central claim --
that a number from one runtime and a number from another differ only in what
they measured. Mutation testing scored it 45.5%: 12 of 22 mutants survived.

Three survivors were safety-relevant rather than cosmetic:

- `assert_comparable`'s `classification == NOT_COMPARABLE` could be inverted.
  The guard would then raise for comparable results and silently permit the
  incomparable ones -- the function allowing exactly what it exists to block,
  with the suite green. This is the single most consequential line in the
  module and nothing constrained it.

- `_same`'s mixed-None branch returns False (a present value is not the same
  as a missing one). Flipping it to True survived, which would make a result
  that never recorded its seed compare "strictly" against one that did. The
  published comparison would then be between two different experiments.

- `_same`'s both-None check could become `or`, making a single None mean
  "identical".

All three are now pinned, along with every field in `_STRICT` being
load-bearing rather than decorative, and `_CONDITIONAL` downgrading rather than
blocking.

Score is 68.2% (15/22). The remaining seven are equivalent mutants, verified
rather than assumed:

- The `continue` guards inside both diff loops are unreachable. `strict_diffs`
  is built with `_same`, and `_same(None, None)` is True, so a path where both
  sides are missing never enters the loop -- measured: zero such paths. That
  code is defensive in appearance only.
- Mutating `_same`'s `or` to `and` is behaviour-preserving, because a one-None
  comparison falls through to `bool(None == value)`, which is already False.

So the module is at 15 of 15 killable mutants. Reporting the raw number
alongside that rather than the flattering one: a mutation score is a
diagnostic, not a target.

Verified: ruff, ruff format, mypy (73 files), 424 tests pass, coverage 70.85%
against the 68% floor.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@webdevsamran
webdevsamran merged commit cf7720e into main Sep 9, 2026
23 checks passed
@webdevsamran
webdevsamran deleted the test/comparability-safety branch September 9, 2026 11:15
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.

1 participant