Repository navigation
Drop signals with the wrong number of arguments - #2021
Open
AyeshaWaseemAhmad wants to merge 1 commit into
Open
AyeshaWaseemAhmad wants to merge 1 commit into
AyeshaWaseemAhmad wants to merge 1 commit into
Conversation
A signal whose argument count does not match the handler signature raised a TypeError inside the handler and failed the workflow task on every retry. The count is now checked before the handler runs, and the signal is logged and dropped, as already happens for arguments that fail to decode.
This branch has not been deployed
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.
Fixes #355
A signal whose argument count does not match the handler passes payload decoding and then raises a
TypeErrorinside the handler, which fails the workflow task on every retry._SignalDefinitionnow records the accepted positional range for named handlers, and_process_signal_joblogs and drops a signal outside that range, next to the existing "Failed deserializing signal input" path.Dynamic handlers and handlers with required keyword-only parameters are not checked. A handler with no parameters still ignores extra arguments, because
_convert_payloadspasses an empty type hint list. Not covered: updates and queries.Tested with
tests/worker/test_workflow.py(newtest_workflow_bad_signal_arg_countandtest_positional_arg_count_range, the first fails on the previous code), plus the replayer, interceptor and sandbox tests. ruff, pyright, mypy, basedpyright and pydocstyle are clean. I did not run the full suite orcargo clippy.