• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

looplab / fsm
93%

Build:
DEFAULT BRANCH: main
Repo Added 14 Nov 2014 08:18AM UTC
Files 7
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH main
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • fix/clear-transition-on-canceled-context
  • main

27 Aug 2026 05:45AM UTC coverage: 92.936% (+0.05%) from 92.889%
33043495920

push

github

maxekman
fix: clear the transition when the context is canceled

transitionFunc returns early when ctx.Err() != nil, but does not clear
f.transition on the way out — only the completed path below it does. Since
f.transition was already published before the context was ever checked, the FSM is
left in transition permanently: every later Event returns InTransitionError, Can()
returns false, and Transition() cannot help either, because it re-runs this same
closure and takes this same early return. Only constructing a new FSM recovers.

A state whose leave callback cancels is spared, because leaveStateCallbacks
returning CanceledError clears the flag. A state with no callbacks at all is not —
so whether a canceled context bricks the FSM depends on whether the state you
happen to be leaving has a callback registered.

Clears it with the same lock the completed path takes, and leaves e.Err untouched,
so Event still returns the context error to the caller as before.

Fixes #115.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

3 of 3 new or added lines in 1 file covered. (100.0%)

421 of 453 relevant lines covered (92.94%)

15.67 hits per line

Relevant lines Covered
Build:
Build:
453 RELEVANT LINES 421 COVERED LINES
15.67 HITS PER LINE
Source Files on main
  • Tree
  • List 7
  • Changed 7
  • Source Changed 7
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
33043495920 main fix: clear the transition when the context is canceled transitionFunc returns early when ctx.Err() != nil, but does not clear f.transition on the way out — only the completed path below it does. Since f.transition was already published before the... push 27 Aug 2026 05:45AM UTC maxekman github
92.94
32349779650 fix/clear-transition-on-canceled-context Merge ae5452034 into 5a66e0ee4 Pull #117 20 Aug 2026 11:54AM UTC web-flow github
92.94
14882968042 main feat(errors): implement error wrapping push 07 May 2025 12:09PM UTC maxekman github
92.89
14765048185 main Merge 417580318 into 5a8ac868f Pull #113 07 May 2025 12:08PM UTC web-flow github
92.89
10146410757 errors_introspection Merge 9ad9b6cb1 into b2f0ab5cc Pull #108 09 Aug 2024 11:53AM UTC web-flow github
88.48
10318733746 main Fixed data race between Can() and Event() (#107) push 09 Aug 2024 11:52AM UTC web-flow github
92.74
7889541032 main Deadlock calling Event in after-event callback when current state == dst (#104) * Deadlock in afterEventCallbacks in case when src == dst fixed * Test added --------- Co-authored-by: Igor Kuzmin <i.kuzmin@webinar.ru> push 13 Feb 2024 04:21PM UTC web-flow github
92.71
7812068592 main Merge 9c9eb183e into e668a855b Pull #104 13 Feb 2024 02:17PM UTC web-flow github
92.71
6416172394 ayush/callback-decorator Merge d5d10e9a7 into e668a855b Pull #100 11 Oct 2023 05:14PM UTC web-flow github
92.74
4071695605 main race fixes (#94) push 02 Feb 2023 05:59AM UTC GitHub github pending completion  
See All Builds (87)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc