Add MainActor concurrency support#113
Open
acyment wants to merge 6 commits intocucumberswift:mainfrom
Open
Conversation
Annotate DSL classes, structs, protocols, and functions with @mainactor to ensure thread-safety and proper isolation in Swift concurrency.
Annotate Gherkin AST, Parser classes, and enums with @mainactor to ensure thread-safety and proper isolation in Swift concurrency.
Annotate hook functions, protocols (CucumberTestObserver, Positionable, Taggable), and supporting types with @mainactor for concurrency safety.
Make Lexer.Position, Step.Keyword, and Reporter.Result conform to Sendable to enable safe sharing across concurrency domains.
Mark methods as nonisolated or wrap with MainActor.assumeIsolated to comply with Swift concurrency requirements.
- Rewrite Lexer to not inherit from StringReader and properly implement string reading with index tracking - Update Cucumber class with @mainactor - Refactor step execution and test observation to work with MainActor isolation - Update JSONReporter to handle keyword type changes - Make StubGenerator methods static for isolation
Collaborator
|
@acyment thanks for this PR! Here are some suggestions for improvement:
|
Collaborator
|
Also @acyment can you please rename your source branch from "main" something else (e.g. feature/swift-concurrency)? The "main" branch name conflicts with our main branch and there is a known bug in GitHub Actions that prevents workflows from running in this case due to ambiguous branch refs. I'd like to run the workflow on your PR but I'm not able to until you make that change. Thanks. |
Collaborator
|
I ran the tests locally. There are compilation errors and test failures introduced by this PR. It needs a lot of work. |
Author
|
Hi Ian,So sorry for that. Weird, I am using it locally. I’ll try and double check today. Thx,AlanOn 17 Mar 2026, at 08:10, Ian Hlavats ***@***.***> wrote:ianhlavats left a comment (cucumberswift/CucumberSwift#113)
I ran the tests locally. There are compilation errors and test failures introduced by this PR. It needs a lot of work.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
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.
Summary
Changes
This PR adds Swift concurrency support by:
All changes maintain backward compatibility while enabling safe concurrent execution in Swift 6+.