Repository navigation
fix: name the event in the delayed+internal error and let send(delay=0) override - #683
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #683 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 53 53
Lines 5787 5816 +29
Branches 918 926 +8
=========================================
+ Hits 5787 5816 +29
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…0) override The delayed+internal check ran in Event.__new__ before the class attribute name was known, so an Event declared without an explicit id reported its placeholder id. The check now runs when the factory rebinds the event under its attribute name, for top-level and State.Compound declarations alike. send() and raise_() treated delay=0 as "not given", so an explicit zero could not override a declared delay. Their default is now None. Fixes #679 Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
fgmacedo
force-pushed
the
fgmacedo/fix-679-delay-internal-error
branch
from
October 13, 2026 20:45
ff368b0 to
2279678
Compare
|
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.



Why
light = Event(dark.to(lit), delay=50, internal=True)raisedInvalidDefinition: Event '__event__<uuid>' cannot be both delayed and internal. The check ran inEvent.__new__, before the metaclass knew the attribute name, and the 3.2.2 release-notes doctest only passed because ofIGNORE_EXCEPTION_DETAIL. Separately,send("go", delay=0)could not override a declareddelay, because0counted as "not given".Fixes #679
What changes
id, or by the first id of anerror_/done_state_/done_invoke_prefix. This holds at the top level and insideState.Compound/State.Parallelbodies, and also for anEvent(delay=..., internal=True)declared without transitions, which a nested body used to drop before checking.send()andraise_()defaultdelaytoNone, so an explicitdelay=0overrides a declared delay on both engines. Withoutdelay, the declared one still applies, andraise_("go")on an event declared with a delay is stillInvalidDefinition.<send>load-time messages are unchanged.docs/releases/3.2.2.md, the doctest now checks the message with# doctest: -IGNORE_EXCEPTION_DETAIL, and the fix: honor Event(internal=True) and give internal events from outside a step the external contract #668 entry documents thedelay=0override.processing_model.mdandstatechart.mdmention the override too.Evidence
With the
event.pychange reverted, the release-notes doctest fails:Pre-commit (ruff, mypy, pyright, pytest) passes on the commit.
Not verified
Event(..., delay=50, internal=True)statement left unassigned in a class body is no longer rejected. Before, the placeholder check caught it by accident. Now the transition becomes eventless, which is what any unassignedEvent(...)statement already did.registry.register, which is how the other metaclass-timeInvalidDefinitionerrors already behave.sm.go()takes nodelayargument, so there is no override to test on the bound-event call path. Onlysend()/raise_()were changed.