Repository navigation
test: pin behavior that mutation testing found unguarded - #63
Merged
Merged
Conversation
The suite reports 100% line and branch coverage, yet a mutation survey left four mutants alive. Pin the behavior each one could break: - getGameDisplay() returns the bound surface, not the display - drawText antialiases glyph edges - drawButton centers its label with floor division Note the antialiasing in the drawText docstring and the README, which only a test comment mentioned before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric, scored against the diff at 38e84e7 and CI run 41792331352. This is an inline review by the authoring session, not an independent one.
Do-not-auto-merge paths: none matched. Finding, accepted without change:
Verdict: ready to merge. This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage B (unit-test expansion). The suite already reports 100% line and branch coverage, so coverage could no longer identify gaps. A throwaway survey of 30 hand-written mutants of
graphik.pywas run instead, and 6 survived. Two of those are equivalent mutants. The other four map to three real gaps, each pinned here:getGameDisplay()returns the bound surface. Every existing test bound the display itself, so returningpygame.display.get_surface()went undetected. It would change the result for any instance bound to an off-screen surface.drawTextantialiases. PassingFalsetorenderleft every test green, although antialiasing was assumed only in test comments. The behavior is now also documented in thedrawTextdocstring and the README.drawButtoncenters its label with floor division, on both axes.README.mdgives the center asxpos + width // 2, but/passed the suite. The two differ by a pixel only with a fractional position and an odd size, and the new test uses that case. It compares against the documenteddrawTextcall pixel for pixel rather than hard-coding bounds, so font-rendering differences between pygame versions do not affect it.No production behavior is changed. The change to
graphik.pyis a docstring note only.Surviving mutants, judged equivalent:
is notto!=on the font session's display check (pygame.Surfacecompares by identity), andint(xpos) + (int(width)//2)for the label center (the same truncation is applied whenRect.centeris assigned).Test plan
python3 -m py_compile src/main/python/preponderous/graphik/graphik.pyfrom preponderous.graphik import GraphikSDL_VIDEODRIVER=dummy python3 -m pytest: 133 passed (130 before)Local validation used pygame 2.1.2 on Python 3.8, which is below the supported floor. CI is the check against current pygame versions.
Backlog
No tracking issue: the gaps were found during triage. Each open issue was skipped for a stated reason:
.github/workflows/edits, which are on the do-not-auto-merge list. Opening them as held PRs would block later dispatches.Not verified
The README's claim that
graphikis unpublished on PyPI, and its wiki link, could not be checked becausecurlis not permitted in this dispatch.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson