{"schemaVersion":"2.0.0","locale":"en","title":"Callback runs in an incompatible scheduler context","description":"Rule ID: concurrency.dispatch-isolation-mismatch@1.0.0. Availability below refers to source-scan at product 524fa07e.","htmlUrl":"https://docs.swift-analyzer.com/catalog/concurrency.dispatch-isolation-mismatch/","markdownUrl":"https://docs.swift-analyzer.com/catalog/concurrency.dispatch-isolation-mismatch/index.md","productRevision":"524fa07e0ae4153c84ac12ae9eb6559df89ec2be","catalogRevision":"4558458d","docsRevision":"1f17ba58ab08627e0de898f1442067b09e960b48cd5605d6529e9275f8930d68","channel":"pre-prod","maturity":"experimental","access":"owner-provided-checkout","markdown":"# Callback runs in an incompatible scheduler context\n\nRule ID: concurrency.dispatch-isolation-mismatch@1.0.0. Availability below refers to source-scan at product 524fa07e.\n\n## V-EXEC-04 — Callback runs in an incompatible scheduler context\n\nCallback runs in an incompatible scheduler context. It examines isolation, executor, scheduler, and execution-domain relationships.\n\n### Availability\n\nSelected by default in source-scan. Selection does not mean a supported observation exists in your program.\n\nUse the terminal from [Installation](https://docs.swift-analyzer.com/get-started/installation/), with ANALYZER set. Replace `<package>` and `<product>` with your supported package path and product name.\n\n```text\n\"$ANALYZER\" source-scan --package-path <package> --product <product> --allow-build\n```\n\n### Example and action\n\nIllustrative pattern only. This is not a complete runnable package or a reproduced source-scan result. Helper APIs and omitted context must be supplied by the application.\n\n```swift\nworkerQueue.async {\n    legacyView.setNeedsLayout()\n}\n```\n\nMake the required context explicit at the boundary. Review ordering, lifetime and transferred values before adding a task or changing isolation.\n\n```swift\nTask { @MainActor in\n    legacyView.setNeedsLayout()\n}\n```\n\n### Why this check works\n\nThe selected execution evaluator compares recognized source/SDK context facts with the condition’s required context. Compare the required execution or isolation context with recognized context transitions and use sites. Actor context, task context and physical thread identity are different facts; suspension alone does not prove a thread hop. The [Swift concurrency guide](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html) explains the underlying language concepts. Registration establishes selection, not coverage of this illustrative example.\n\n### Assumptions and unknown\n\nThe current workflow recognizes bounded source forms. An unresolved required context, callback contract, resource domain or thread-affinity fact can remain unknown. A condition with no supported observations is reported as no-observations, not as proof that all uses are valid.\n\n### Evidence and interpretation\n\nRead condition coverage, observation counts and reasons in the actual report. A finding and an unknown observation can coexist. No observations is not a negative proof.\n\nHistorical evidence at 4558458d: recovery-required (historical qualification is incomplete and needs further evidence). That evidence has not been requalified for this product revision.\n\n[How we validate checks](https://docs.swift-analyzer.com/concepts/validation/) explains the evidence boundary. [Foundations](https://docs.swift-analyzer.com/concepts/foundations/) separates method assumptions from implementation claims.\n","anchors":["callback-runs-in-an-incompatible-scheduler-context","V-EXEC-04","availability","example-and-action","why-this-check-works","assumptions-and-unknown","evidence-and-interpretation"]}
