From 2f60e3816a6aea69d6e8c3daac55644d5895cac3 Mon Sep 17 00:00:00 2001 From: David Montero Date: Sat, 23 May 2026 08:39:26 +0200 Subject: [PATCH] fix(editor): surface QEMU compile failure to the user instead of silent warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the auto-compile path in handleRun() finishes without producing a compiledProgram, the previous code dropped the failure on the floor with only a `console.warn` — the user clicked Run, nothing happened, and they had no idea why. The accompanying comment also promised "always start even if compiledProgram is empty" but the code did the opposite. This commit replaces the dead comment + silent warn with a top-level error toast + addLog entry, with a different copy for MicroPython mode (suggests "click Load MicroPython to retry") vs Arduino C++ mode (directs the user to the output console for the underlying error). handleCompile already writes the actual cause to the compile-output console via addLog — this fix just makes sure the user knows their click failed and where to look. --- .../src/components/editor/EditorToolbar.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/editor/EditorToolbar.tsx b/frontend/src/components/editor/EditorToolbar.tsx index 2959a874..52c7f01e 100644 --- a/frontend/src/components/editor/EditorToolbar.tsx +++ b/frontend/src/components/editor/EditorToolbar.tsx @@ -597,10 +597,6 @@ export const EditorToolbar = ({ compiledProgramLen: updatedBoard?.compiledProgram?.length ?? 0, autoRunFlag: autoRunAfterCompile.current, }); - // For QEMU boards, always start even if compiledProgram is empty — - // the bridge can be told to start without firmware (for waiting on - // a later upload) and is the safest path when the binary may be - // present on the bridge but not yet reflected in the store. if (autoRunAfterCompile.current) { autoRunAfterCompile.current = false; if (updatedBoard?.compiledProgram) { @@ -610,7 +606,20 @@ export const EditorToolbar = ({ startBoard(activeBoardId); setMessage(null); } else { + // handleCompile returned without producing a firmware/program. + // Most common causes: arduino-cli unreachable, ESP-IDF compile + // error in the user's sketch, MicroPython firmware download + // failed, or the bridge rejected the load. handleCompile has + // already addLog'd the underlying error — surface a top-level + // toast too so the user knows their Run click didn't silently + // succeed. + const isMicropython = updatedBoard?.languageMode === 'micropython'; + const errText = isMicropython + ? 'MicroPython firmware did not load. Click "Load MicroPython" to retry, or check the console for the underlying error.' + : 'Compilation produced no firmware. Check the output console for the underlying error.'; console.warn('[handleRun] compile finished but no compiledProgram — not starting'); + setMessage({ type: 'error', text: errText }); + addLog({ timestamp: new Date(), type: 'error', message: errText }); } } return;