Skip to content

fix: properly annotate EventCallback.fn for tests - #6894

Open
benedikt-bartscher wants to merge 2 commits into
reflex-dev:mainfrom
benedikt-bartscher:improve-event-handler-typing-in-tests
Open

fix: properly annotate EventCallback.fn for tests#6894
benedikt-bartscher wants to merge 2 commits into
reflex-dev:mainfrom
benedikt-bartscher:improve-event-handler-typing-in-tests

Conversation

@benedikt-bartscher

@benedikt-bartscher benedikt-bartscher commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review in cubic

@benedikt-bartscher
benedikt-bartscher marked this pull request as ready for review August 15, 2026 21:53
@benedikt-bartscher
benedikt-bartscher requested a review from a team as a code owner August 15, 2026 21:53
@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a static-only annotation for EventCallback.fn, matching the raw state method exposed through the runtime EventHandler, and removes now-unnecessary Pyright suppressions from event tests.

  • Declares the fn callable attribute under TYPE_CHECKING.
  • Verifies background-task marker access without attribute-access suppressions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/reflex-base/src/reflex_base/event/init.py Adds a type-checking-only fn annotation whose leading state parameter matches the raw undecorated method stored by EventHandler.
tests/units/test_event.py Removes obsolete Pyright suppressions from existing runtime assertions without changing test behavior.

Reviews (2): Last reviewed commit: "rewrite comment with one ai to make anot..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Aug 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing benedikt-bartscher:improve-event-handler-typing-in-tests (fbcc20e) with main (092aa4f)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/reflex-base/src/reflex_base/event/__init__.py
@FarhanAliRaza FarhanAliRaza added the skip-changelog For doc/internal changes label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog For doc/internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants