Metastatic.Analysis.BusinessLogic.MissingHandleAsync (Metastatic v0.10.4)

View Source

Detects missing async error handling (fire-and-forget without supervision).

Universal pattern: spawning async tasks without monitoring results or errors.

Examples

Python (asyncio without await):

async def process():
    asyncio.create_task(heavy_work())  # Task created but never awaited - errors lost
    return "done"

JavaScript (Promise without catch):

function processData() {
    fetchData();  // Returns Promise but not awaited/caught - errors swallowed
    return success;
}

Elixir (Task.start without monitoring):

def handle_cast(:process, state) do
    Task.start(fn -> heavy_work() end)  # Should use Task.Supervisor or Task.async + await
    {:noreply, state}
end

C# (Task.Run fire-and-forget):

void ProcessData() {
    Task.Run(() => HeavyWork());  // Should await or use ContinueWith
    return;
}

Go (goroutine without sync):

func process() {
    go heavyWork()  // No WaitGroup or channel - completion/errors unknown
    return
}

Java (CompletableFuture without handling):

void processData() {
    CompletableFuture.runAsync(() -> heavyWork());  // Should use get() or exceptionally()
    return;
}

Ruby (Thread without join):

def process
    Thread.new { heavy_work }  # Should join or use thread pool
    return
end