Skip to content

docs: document callable/lambda guard conditions and add regression tests (#638)#641

Merged
fgmacedo merged 2 commits into
developfrom
docs/638-callable-guards
Jul 21, 2026
Merged

docs: document callable/lambda guard conditions and add regression tests (#638)#641
fgmacedo merged 2 commits into
developfrom
docs/638-callable-guards

Conversation

@fgmacedo

Copy link
Copy Markdown
Owner

Closes #638.

Investigating the report, this is not a v3 regression: a lambda guard with a parameter named self fails identically on v2.6.0 and v3.2.0. Callbacks are invoked through dependency injection by parameter name, and self is only injected when the callable resolves to a bound method (i.e. it is an attribute of the state machine class). Plain callables (lambdas, module-level functions) are called unbound, so they must declare injectable names such as machine.

Since this behavior was neither tested nor documented, this PR:

  • Adds TestIssue638 regression tests covering callable guards: lambda with machine, zero-arg lambda, lambda receiving event kwargs, lambda with self (asserts the current TypeError), and a class-body function passed by reference (bound, so self works).
  • Adds a "Callable conditions" section to docs/guards.md with doctests and a warning explaining the self vs machine distinction.

Full analysis in #638 (comment).

fgmacedo added 2 commits July 21, 2026 17:37
Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (471fe17) to head (0da2b8f).

Additional details and impacted files
@@            Coverage Diff            @@
##           develop      #641   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           52        52           
  Lines         5505      5505           
  Branches       869       869           
=========================================
  Hits          5505      5505           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fgmacedo
fgmacedo merged commit 5bb50c1 into develop Jul 21, 2026
13 checks passed
@fgmacedo
fgmacedo deleted the docs/638-callable-guards branch July 21, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lambda conditions no longer supported since v3.0?

1 participant