Skip to content

test: pin the public gameDisplay attribute on both constructor paths - #49

Merged
dmccoystephenson merged 2 commits into
mainfrom
test/pin-game-display-attribute
Oct 9, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
test/pin-game-display-attribute

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle, scoped to the Graphik constructor contract.

  • Adds test_game_display_attribute_is_the_bound_surface, parametrized over the supplied-display and default-display constructor paths.
  • The gameDisplay attribute is read directly by consumers (Apex sizes its layout off graphik.gameDisplay.get_size()), so its name is part of the public contract. Before this change no test referenced it: every existing test went through getGameDisplay().
  • Test-only change. graphik.py, the README, and the version source are untouched.

Evidence the test guards something

With self.gameDisplay temporarily renamed to self._gameDisplay in graphik.py, the existing 58 tests all still passed and only the two new cases failed:

FAILED ...::test_game_display_attribute_is_the_bound_surface[supplied_display]
FAILED ...::test_game_display_attribute_is_the_bound_surface[default_display]
2 failed, 58 passed

With the source restored, the suite is 60 passed.

Test plan

  • python3 -m py_compile src/main/python/preponderous/graphik/graphik.py
  • Import smoke test of preponderous.graphik.graphik
  • python3 -m pytest — 60 passed, headless (conftest forces SDL_VIDEODRIVER=dummy)
  • Mutation check above: the new test fails when the attribute is renamed

Deferred issues

All four open issues were skipped this cycle, which is why it was spent on test expansion:

No tracking issue — gap found during triage.

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

dmccoystephenson and others added 2 commits October 9, 2026 02:40
Consumers such as Apex read graphik.gameDisplay directly rather than
calling getGameDisplay(), so the attribute name is part of the public
contract. No existing test referenced it: renaming it to a private name
left the whole suite green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (single intrinsic pass; anchored on CI and a mutation check):

  • Scope: PASS — the diff touches only src/test/python/preponderous/graphik/test_graphik.py (one new test, +18 lines). No production, doc, or version file was changed.
  • Tests-new: PASS (n/a) — no new public method was added.
  • Tests-fix: PASS (n/a, mutation substitute) — no bug fix is involved. Instead, self.gameDisplay was temporarily renamed to self._gameDisplay in graphik.py. The result was 2 failed and 58 passed, and only the new cases failed. With the source restored, the result was 60 passed.
  • Sibling structure: PASS — the new test sits beside the other constructor tests, uses pytest.mark.parametrize with ids= as neighbouring tests do, and opens with the same explanatory comment style.
  • Sibling renames: PASS (n/a) — nothing was renamed.
  • Docs: PASS — the README already lists Graphik(gameDisplay=None) and getGameDisplay(). The README does not describe the attribute as a separate surface, and this PR does not change that. No doc row is affected.
  • Issue resolution: PASS (n/a) — there is no Closes #N. The gap was found during triage.
  • Manual validation: PASS — locally, py_compile, the import smoke test, and pytest all passed (60 tests). CI "Compile and test" passed on 3.9, 3.10, 3.11, 3.12, and 3.13.
  • camelCase: PASS (n/a) — no method was added or renamed.
  • Backward-compat: PASS — this PR strengthens the compatibility guarantee and does not change it.
  • Headless: PASS — the test runs under the dummy SDL driver that conftest.py forces. The Graphik() default path creates its 900x600 display without a real device.
  • Version sync: PASS (n/a) — no version string was changed.
  • No new deps: PASS — no imports were added.

Findings:

  • test_graphik.py:58 — the test comment originally said a rename would leave "every test above" green. The mutation run showed that every other test in the file stays green, not only the ones above it. This was corrected in a follow-up commit.
  • test_graphik.py:55 — the claim that Apex reads graphik.gameDisplay.get_size() comes from the dev-loop skill's consumer table. It could not be re-confirmed by code search in this session because gh search code was not permitted. The test's value does not depend on that claim, since the attribute is set publicly in __init__ either way.

Summary: this change is a test-only contract pin with empirical evidence that it catches the regression it targets. It is 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

@dmccoystephenson
dmccoystephenson merged commit 4d71da3 into main Oct 9, 2026
5 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/pin-game-display-attribute branch October 9, 2026 08:41
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