fix: ensure middleware data is passed to scene entry handler#1674
Merged
JrooTJunior merged 3 commits intodev-3.xfrom Apr 16, 2025
Merged
fix: ensure middleware data is passed to scene entry handler#1674JrooTJunior merged 3 commits intodev-3.xfrom
JrooTJunior merged 3 commits intodev-3.xfrom
Conversation
✔️ Changelog found.Thank you for adding a description of the changes |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-3.x #1674 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 568 568
Lines 13337 13337
=========================================
Hits 13337 13337
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the scene entry handler was not receiving context data injected by middleware.
- Updated the as_handler method in the scene module to merge handler and middleware keyword arguments.
- Added tests in both issues and FSM test suites to validate that middleware data is correctly passed to scene handlers.
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_issues/test_1672_middleware_data_in_scene.py | Added a test case confirming middleware context data propagation to scene entry. |
| tests/test_fsm/test_scene.py | Added a test to validate merging of handler kwargs and middleware data. |
| aiogram/fsm/scene.py | Modified as_handler to merge handler and middleware kwargs when calling scenes.enter. |
Files not reviewed (2)
- CHANGES/1672.bugfix.rst: Language not supported
- docs/dispatcher/finite_state_machine/scene.rst: Language not supported
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.
Description
Fixed an issue where the scene entry handler (
enter) was not receiving data passed to the context by middleware, which could result in aTypeError.Fixes #1672
Is an alternative solution to #1673
Plan
tests/issues/directory to check that the original issue was fixed