Skip to content

Fix #1743: scene handling for channel updates#1763

Merged
JrooTJunior merged 3 commits intoaiogram:dev-3.xfrom
Latand:codex/issue-1743-scenes-state
Feb 10, 2026
Merged

Fix #1743: scene handling for channel updates#1763
JrooTJunior merged 3 commits intoaiogram:dev-3.xfrom
Latand:codex/issue-1743-scenes-state

Conversation

@Latand
Copy link
Contributor

@Latand Latand commented Feb 10, 2026

Summary

Fixes #1743: channel_post / edited_channel_post no longer crash when Scenes are registered.

Logic

  • If FSM state is missing, SceneRegistry skips scene context injection and continues normal handler flow.
  • For CHAT and CHAT_TOPIC, FSMContextMiddleware maps missing user_id to chat_id for channel-scoped FSM.
  • Scene handlers now raise explicit SceneException when scene context is unavailable.

Tests

Added issue reproduction and unit tests for missing-state paths and strategy coverage.

@github-actions github-actions bot added the 3.x Issue or PR for stable 3.x version label Feb 10, 2026
@github-actions
Copy link

github-actions bot commented Feb 10, 2026

✔️ Changelog found.

Thank you for adding a description of the changes

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1708980) to head (25deca8).
⚠️ Report is 1 commits behind head on dev-3.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           dev-3.x     #1763   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          598       598           
  Lines        14212     14225   +13     
=========================================
+ Hits         14212     14225   +13     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
aiogram/fsm/middleware.py 100.00% <100.00%> (ø)
aiogram/fsm/scene.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor Author

@Latand Latand left a comment

Choose a reason for hiding this comment

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

self reviewed

@Latand Latand marked this pull request as ready for review February 10, 2026 20:13
@Latand
Copy link
Contributor Author

Latand commented Feb 10, 2026

@xMohnad Thanks again for the report in #1743. A fix is implemented in this PR; if you have time, could you please verify it on branch Latand:codex/issue-1743-scenes-state and confirm the behavior on your side?

@JrooTJunior JrooTJunior merged commit da7bfdc into aiogram:dev-3.x Feb 10, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x Issue or PR for stable 3.x version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: 'state' when using channel_post / edited_channel_post with Scenes

2 participants