MainActor entry without a proven context
Rule ID: concurrency.unproven-mainactor-entry@1.0.0. Availability below refers to source-scan at product 524fa07e.
V-EXEC-02 — MainActor entry without a proven context#
MainActor entry without a proven context. It examines isolation, executor, scheduler, and execution-domain relationships.
Availability#
Selected by default in source-scan. Selection does not mean a supported observation exists in your program.
Use the terminal from Installation, with ANALYZER set. Replace <package> and <product> with your supported package path and product name.
"$ANALYZER" source-scan --package-path <package> --product <product> --allow-buildExample and action#
Illustrative 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.
foreignAPI.callback = { renderUI() }Make the required context explicit at the boundary. Review ordering, lifetime and transferred values before adding a task or changing isolation.
foreignAPI.callback = { event in
Task { @MainActor in renderUI(event) }
}Why this check works#
The 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 explains the underlying language concepts. Registration establishes selection, not coverage of this illustrative example.
Assumptions and unknown#
The 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.
Evidence and interpretation#
Read 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.
Historical evidence at 4558458d: recovery-required (historical qualification is incomplete and needs further evidence). That evidence has not been requalified for this product revision.
How we validate checks explains the evidence boundary. Foundations separates method assumptions from implementation claims.