You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: durable_execution(plugins=...) return type fails mypy with "Too few arguments" #921
Cause. durable_execution has one signature: execution.py:169-174. Its declared return type is Callable[[Any, LambdaContext], Any] for both call forms. When func is None, the function returns a decorator at runtime (execution.py:187-191). The declared type is still the two-argument handler. The decorator syntax then applies that two-argument type to the user function with one argument. So mypy reports Too few arguments.
CI does not catch it. .github/scripts/type-checks.sh runs mypy on five packages. It excludes the three conformance-test packages, which hold every plugins= call site.
Design note for CONTRIBUTING rule 3: the parameterized decorator form should pass mypy while preserving the existing bare-decorator form.
The cause described above is still present on main (e436a33f): the factory call is annotated as a two-argument handler even though it returns a decorator.
The options are to simplify the existing implementation, use a union return type, or describe the two call forms with overloads; the runtime already has the required two paths, and a union would leave both forms ambiguous to the type checker, so I propose the two overloads outlined in the issue, with no runtime changes and nothing removed.
Validation would add a failing type-check case for @durable_execution(plugins=[]) alongside the bare @durable_execution form under the core package's tests/, which is already covered by types:check, and run the core unit tests without modifying any conformance-test package.
If a maintainer agrees with this design, I can prepare the PR.
Activity
pcbeingused333 commentedon Nov 11, 2026
Design note for CONTRIBUTING rule 3: the parameterized decorator form should pass mypy while preserving the existing bare-decorator form.
The cause described above is still present on main (
e436a33f): the factory call is annotated as a two-argument handler even though it returns a decorator.The options are to simplify the existing implementation, use a union return type, or describe the two call forms with overloads; the runtime already has the required two paths, and a union would leave both forms ambiguous to the type checker, so I propose the two overloads outlined in the issue, with no runtime changes and nothing removed.
Validation would add a failing type-check case for
@durable_execution(plugins=[])alongside the bare@durable_executionform under the core package'stests/, which is already covered bytypes:check, and run the core unit tests without modifying any conformance-test package.If a maintainer agrees with this design, I can prepare the PR.