Skip to content

chore: add CI check for nonisolated on classes with background DispatchQueue/OperationQueue #699

@batonogov

Description

@batonogov

Summary

Add a CI script that greps all classes using DispatchQueue or OperationQueue for background work and verifies they are marked nonisolated. Fail CI if any class with a background queue is missing nonisolated.

Motivation

v1.16.0 shipped with a crash in ConfigValidator because it uses a background DispatchQueue but was implicitly @MainActor due to SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor. This was missed in code review and not caught by tests (PineTests target is Swift 5, which doesn't enforce isolation at compile time).

Similar crashes already hit SyntaxHighlighter, FileNode, and PreviewItem during development.

Implementation ideas

  • Shell script in .github/scripts/ that:
    1. Finds all .swift files in Pine/ containing DispatchQueue(label: or OperationQueue() (excluding .main)
    2. For each match, checks if the enclosing class/struct has nonisolated
    3. Fails with a clear error message listing non-compliant classes
  • Add as a CI step after SwiftLint
  • Could also check for DispatchQueue.global() usage in closures within MainActor classes

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous integrationpriority: highCritical prioritytoolingDeveloper tooling

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions