Skip to content

Pin that drawButton paints the button before invoking the callback - #52

Merged
dmccoystephenson merged 1 commit into
mainfrom
test/pin-draw-button-paints-before-callback
Oct 17, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
test/pin-draw-button-paints-before-callback

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle, scoped to drawButton.

  • A characterization test, test_draw_button_paints_before_invoking_the_callback, is added. It pins the existing order inside drawButton: the box and label are painted first, and function() is invoked last.
  • The ordering is consumer-observable. A callback that paints (for example, a menu button that switches to another screen) currently lands on top of the button. If the hit test were moved ahead of the drawing (e.g. to choose a hover color), the button would paint over the callback's output in the same frame, and every existing drawButton test would stay green.
  • The test asserts both halves: the box pixel is already colorBox when the callback runs, and the callback's full-surface fill survives once drawButton returns.
  • No production code is changed. The change is additive and test-only, so the public API seen by Roam/Apex/Ophidian/Patchwork/Tic-Tak-Toe is unaffected.

Test plan

  • python3 -m pytest -q: 63 passed (62 existing + 1 new), headless via conftest.py's dummy SDL drivers
  • Mutation check: with the hit test temporarily moved ahead of the drawing in graphik.py, the new test FAILS. With graphik.py restored, it PASSES.
  • CI Test workflow green on 3.9–3.13

Deferred issues

All four open issues were deliberately skipped, because each needs a maintainer decision or touches a path excluded from autonomous change:

No tracking issue: the coverage gap was found during this cycle's test-expansion sweep.

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

The box and label are drawn first and the hit test runs last, so a
callback that paints (e.g. switching screens) lands on top of the
button. Nothing pinned that ordering: moving the hit test ahead of the
drawing would leave every other drawButton test green.

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

Copy link
Copy Markdown
Member Author

Self-review rubric (inline review performed in the same session; no independent reviewer was available because adding Copilot as a reviewer failed with Could not resolve user with login 'copilot'):

Finding (non-blocking):

  • src/test/python/preponderous/graphik/test_graphik.py:972: the in-callback probe checks only a box pixel (11, 11), not the label, so it does not on its own prove the label was drawn before the callback. The final full-surface assertion does cover the label: any label drawn after the callback would leave non-green pixels behind. The behaviour the test protects (the callback's output stays on top) is therefore pinned in full. No change is planned.

The review is clean apart from the one non-blocking observation above.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson

Copy link
Copy Markdown
Member Author

Correction to the self-review above: the in-callback probe is at src/test/python/preponderous/graphik/test_graphik.py:968, not :972. The finding itself is unchanged.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 190dc99 into main Oct 17, 2026
5 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/pin-draw-button-paints-before-callback branch October 17, 2026 07: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