From 83aad5eb544e7f98b924f9b3652cfdb0a1023f47 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 10 Nov 2026 21:07:25 +0100 Subject: [PATCH 1/2] Exclude TypeScript and JavaScript from Sonar coverage (#2813) ## Summary Adds `sonar.coverage.exclusions=**/*.ts,**/*.tsx,**/*.js,**/*.jsx` to `sonar-project.properties`. There were no existing exclusion entries. The shared SonarCloud workflow only publishes the Rust lcov report (`sonar.rust.lcov.reportPaths=lcov.info`). Artcraft's workflow wrapper does not pass a TypeScript or JavaScript coverage report, so those files can never appear covered. That is why [#2805](https://github.com/storytold/artcraft/pull/2805) and [#2806](https://github.com/storytold/artcraft/pull/2806) fail the quality gate on **new_coverage** (0.0% against the 80% target) after the organisation was recreated. They only add `void` in front of existing TypeScript calls: - #2805: 53 new lines to cover, all uncovered - #2806: 38 new lines to cover, all uncovered [#2807](https://github.com/storytold/artcraft/pull/2807) also touches TypeScript (`void` in `libs/components`) and is listed here for the same exclusion, but its current gate failure is duplicated new code (10.6%), which this PR does not address. Same approach as [anicraft#106](https://github.com/storytold/anicraft/pull/106), which excluded JS, PowerShell and Python for the same reason. filmcraft and lightcraft already exclude `**/tools/**,**/docs/**,**/examples/**`. This PR uses extensions because the uncovered TypeScript and JavaScript live under `frontend/`. No product code changes. No open PR already edits `sonar-project.properties`. ## Testing Visual review of `sonar-project.properties` against anicraft, filmcraft and lightcraft, and of the shared `sonarcloud.yml` coverage inputs. No Rust or frontend tests were run (properties file only). The quality-gate effect on #2805 and #2806 will be visible after this merges and those branches are updated from main. - [x] Clean room: no proprietary code, scripts or assets copied (AGENTS.md) ## Summary by CodeRabbit * **Chores** * Updated project configuration for coverage reporting. No user-facing changes. --- sonar-project.properties | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index 832b70c571..025f9e3cd0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,2 +1,8 @@ sonar.projectKey=storytold_artcraft sonar.organization=storytold + +# CI only publishes the Rust lcov report, so TypeScript and JavaScript never +# appear covered. Same idea as anicraft excluding JS/PowerShell/Python, and +# as filmcraft and lightcraft excluding tools/docs/examples. +sonar.coverage.exclusions=**/*.ts,**/*.tsx,**/*.js,**/*.jsx + From c9da5cac18339b9b086161a0b20aaf4362839c5f Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 10 Nov 2026 21:21:36 +0100 Subject: [PATCH 2/2] tauri-events/tauri-api/tauri-utils: mark fire-and-forget promises with void (Sonar S9383) (#2805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Resolves all 53 SonarCloud **typescript:S9383** findings ("Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator") in the Tauri frontend libraries: | Library | Findings | What is marked | |----------------------------|----------|------------------------------------------------------------------------| | `frontend/libs/tauri-events` | 48 | `setup()` and the `unlisten.then(f => f())` cleanups in each `use*Event` hook | | `frontend/libs/tauri-api` | 4 | Same pattern in `CanvasBgRemovedEvent`, plus `setupListener()` in `useSoraLoginListener` | | `frontend/libs/tauri-utils` | 1 | The async IIFE in `useTauriWindowControls` | This is part 1 of 3 for artcraft's 157 S9383 findings. Part 2 (`apps/artcraft/app`) is #2806, and part 3 (`libs/components`) is #2807. ## Approach This ports the approach of storytold/artcraft-services#179, which fixes the same rule in artcraft-services. **#179 is still open and unmerged.** This PR follows its approach and does not depend on it. - Each flagged expression is a fire-and-forget promise: a listener `setup()`, an `unlisten.then(f => f())` cleanup, a loader called from an effect, an upload kicked off from a handler, or an async IIFE. Prefixing it with `void` marks the ignored promise explicitly, which is the fix the rule documents. - It deliberately does not add `.catch()` everywhere. These call sites already handle failures inside the async function or surface them through their own state, and empty handlers would hide errors. - Async IIFEs become `void (async () => …)()`. `if (cond) call()` becomes `if (cond) void call()`. - There is no behaviour change. `void` only discards the promise value, which was already being discarded. Each insertion is placed at the exact `textRange` start offset of the SonarCloud finding, with no other edits. ## Testing - Each changed file parses with `esbuild `, using the same check as #179. - I parsed each changed file with the TypeScript 5.9 compiler API (`createSourceFile`). That found no parse errors, and every inserted `void` is either a whole expression statement or an arrow-function body applied to a call, never part of a larger expression. - `frontend/.eslintrc.json` has no `no-void` rule. - I did not run the full Nx type-check, lint or test targets, because `frontend/node_modules` is not installed in my environment. Please rely on CI. - No tests are added. Discarding an already-discarded promise value is not observable, so no test can fail before this change and pass after it. ## Summary by CodeRabbit * **Refactor** * Clarified that asynchronous event listener setup, cleanup, and window-control initialization run without blocking. Existing subscription behavior and cleanup conditions remain unchanged; no user-facing functionality changes. --- .../libs/tauri-api/src/lib/events/CanvasBgRemovedEvent.ts | 6 +++--- .../libs/tauri-api/src/lib/sora/useSoraLoginListener.ts | 2 +- .../src/lib/events/functional/CreditsBalanceChangedEvent.ts | 6 +++--- .../src/lib/events/functional/ImageEditCompleteEvent.ts | 6 +++--- .../src/lib/events/functional/MediaFileDeletedEvent.ts | 6 +++--- .../lib/events/functional/ObjectGenerationCompleteEvent.ts | 6 +++--- .../src/lib/events/functional/RefreshAccountStateEvent.ts | 6 +++--- .../lib/events/functional/ShowProviderBillingModalEvent.ts | 6 +++--- .../lib/events/functional/ShowProviderLoginModalEvent.ts | 6 +++--- .../lib/events/functional/SubscriptionPlanChangedEvent.ts | 6 +++--- .../events/functional/TextToImageGenerationCompleteEvent.ts | 6 +++--- .../lib/events/functional/VideoGenerationCompleteEvent.ts | 6 +++--- .../src/lib/events/generation/useGenerationCompleteEvent.ts | 6 +++--- .../events/generation/useGenerationEnqueueFailureEvent.ts | 6 +++--- .../events/generation/useGenerationEnqueueSuccessEvent.ts | 6 +++--- .../src/lib/events/generation/useGenerationFailedEvent.ts | 6 +++--- .../src/lib/events/warning/FlashFileDownloadErrorEvent.ts | 6 +++--- .../src/lib/events/warning/FlashUserInputErrorEvent.ts | 6 +++--- frontend/libs/tauri-utils/src/lib/useWindowControls.ts | 2 +- 19 files changed, 53 insertions(+), 53 deletions(-) diff --git a/frontend/libs/tauri-api/src/lib/events/CanvasBgRemovedEvent.ts b/frontend/libs/tauri-api/src/lib/events/CanvasBgRemovedEvent.ts index bfe766db2d..29c915508a 100644 --- a/frontend/libs/tauri-api/src/lib/events/CanvasBgRemovedEvent.ts +++ b/frontend/libs/tauri-api/src/lib/events/CanvasBgRemovedEvent.ts @@ -22,15 +22,15 @@ export const useCanvasBgRemovedEvent = (asyncCallback: (event: CanvasBgRemovedEv }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-api/src/lib/sora/useSoraLoginListener.ts b/frontend/libs/tauri-api/src/lib/sora/useSoraLoginListener.ts index 40cb23a8d0..563daabc2b 100644 --- a/frontend/libs/tauri-api/src/lib/sora/useSoraLoginListener.ts +++ b/frontend/libs/tauri-api/src/lib/sora/useSoraLoginListener.ts @@ -21,7 +21,7 @@ export function useSoraLoginListener( unlisten = stop; }; - setupListener(); + void setupListener(); return () => { if (unlisten) unlisten(); diff --git a/frontend/libs/tauri-events/src/lib/events/functional/CreditsBalanceChangedEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/CreditsBalanceChangedEvent.ts index 1a1e8731d6..d214b37697 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/CreditsBalanceChangedEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/CreditsBalanceChangedEvent.ts @@ -23,15 +23,15 @@ export const useCreditsBalanceChangedEvent = ( ); if (isUnmounted) { - unlisten.then((f) => f()); // Unsubscribe if unmounted early. + void unlisten.then((f) => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then((f) => f()); + void unlisten.then((f) => f()); }; }, []); }; diff --git a/frontend/libs/tauri-events/src/lib/events/functional/ImageEditCompleteEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/ImageEditCompleteEvent.ts index 0d5f38207f..c252a46fd5 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/ImageEditCompleteEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/ImageEditCompleteEvent.ts @@ -27,15 +27,15 @@ export const useImageEditCompleteEvent = (asyncCallback: (event: ImageEditComple }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/functional/MediaFileDeletedEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/MediaFileDeletedEvent.ts index d5a1a864ae..9854100fd7 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/MediaFileDeletedEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/MediaFileDeletedEvent.ts @@ -24,15 +24,15 @@ export const useMediaFileDeletedEvent = ( ); if (isUnmounted) { - unlisten.then((f) => f()); // Unsubscribe if unmounted early. + void unlisten.then((f) => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then((f) => f()); + void unlisten.then((f) => f()); }; }, []); }; diff --git a/frontend/libs/tauri-events/src/lib/events/functional/ObjectGenerationCompleteEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/ObjectGenerationCompleteEvent.ts index aac39c01a5..1483bbed6d 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/ObjectGenerationCompleteEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/ObjectGenerationCompleteEvent.ts @@ -32,15 +32,15 @@ export const useObjectGenerationCompleteEvent = ( ); if (isUnmounted) { - unlisten.then((f) => f()); // Unsubscribe if unmounted early. + void unlisten.then((f) => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then((f) => f()); + void unlisten.then((f) => f()); }; }, []); }; diff --git a/frontend/libs/tauri-events/src/lib/events/functional/RefreshAccountStateEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/RefreshAccountStateEvent.ts index 7d4bdf7094..4b6b6ddd2d 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/RefreshAccountStateEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/RefreshAccountStateEvent.ts @@ -19,15 +19,15 @@ export const useRefreshAccountStateEvent = (asyncCallback: (event: RefreshAccoun }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderBillingModalEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderBillingModalEvent.ts index 6a58779ccc..3dd9a89bd0 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderBillingModalEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderBillingModalEvent.ts @@ -20,15 +20,15 @@ export const useShowProviderBillingModalEvent = (asyncCallback: (event: ShowProv }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderLoginModalEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderLoginModalEvent.ts index d971ba27de..3a62e7825e 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderLoginModalEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/ShowProviderLoginModalEvent.ts @@ -20,15 +20,15 @@ export const useShowProviderLoginModalEvent = (asyncCallback: (event: ShowProvid }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/functional/SubscriptionPlanChangedEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/SubscriptionPlanChangedEvent.ts index e55f9bd9e7..f141ea9f3b 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/SubscriptionPlanChangedEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/SubscriptionPlanChangedEvent.ts @@ -23,15 +23,15 @@ export const useSubscriptionPlanChangedEvent = ( ); if (isUnmounted) { - unlisten.then((f) => f()); // Unsubscribe if unmounted early. + void unlisten.then((f) => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then((f) => f()); + void unlisten.then((f) => f()); }; }, []); }; diff --git a/frontend/libs/tauri-events/src/lib/events/functional/TextToImageGenerationCompleteEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/TextToImageGenerationCompleteEvent.ts index 77175c3c7b..1add5010d5 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/TextToImageGenerationCompleteEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/TextToImageGenerationCompleteEvent.ts @@ -27,15 +27,15 @@ export const useTextToImageGenerationCompleteEvent = (asyncCallback: (event: Tex }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/functional/VideoGenerationCompleteEvent.ts b/frontend/libs/tauri-events/src/lib/events/functional/VideoGenerationCompleteEvent.ts index 68aca6f3c7..bec828c3a9 100644 --- a/frontend/libs/tauri-events/src/lib/events/functional/VideoGenerationCompleteEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/functional/VideoGenerationCompleteEvent.ts @@ -27,15 +27,15 @@ export const useVideoGenerationCompleteEvent = (asyncCallback: (event: VideoGene }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationCompleteEvent.ts b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationCompleteEvent.ts index d38c5173fd..a8df20e414 100644 --- a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationCompleteEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationCompleteEvent.ts @@ -25,15 +25,15 @@ export const useGenerationCompleteEvent = () => { }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueFailureEvent.ts b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueFailureEvent.ts index 6d5ed2ce78..4a7d8813fc 100644 --- a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueFailureEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueFailureEvent.ts @@ -26,15 +26,15 @@ export const useGenerationEnqueueFailureEvent = () => { }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts index fd75a0cb1e..36f788c508 100644 --- a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationEnqueueSuccessEvent.ts @@ -25,15 +25,15 @@ export const useGenerationEnqueueSuccessEvent = () => { }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationFailedEvent.ts b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationFailedEvent.ts index c69242f180..8c59076e70 100644 --- a/frontend/libs/tauri-events/src/lib/events/generation/useGenerationFailedEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/generation/useGenerationFailedEvent.ts @@ -26,15 +26,15 @@ export const useGenerationFailedEvent = () => { }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/warning/FlashFileDownloadErrorEvent.ts b/frontend/libs/tauri-events/src/lib/events/warning/FlashFileDownloadErrorEvent.ts index c944f32139..c3927344a1 100644 --- a/frontend/libs/tauri-events/src/lib/events/warning/FlashFileDownloadErrorEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/warning/FlashFileDownloadErrorEvent.ts @@ -28,15 +28,15 @@ export const useFlashFileDownloadErrorEvent = (asyncCallback: (event: FlashFileD }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-events/src/lib/events/warning/FlashUserInputErrorEvent.ts b/frontend/libs/tauri-events/src/lib/events/warning/FlashUserInputErrorEvent.ts index ac083bb2c8..12dd2f7c63 100644 --- a/frontend/libs/tauri-events/src/lib/events/warning/FlashUserInputErrorEvent.ts +++ b/frontend/libs/tauri-events/src/lib/events/warning/FlashUserInputErrorEvent.ts @@ -19,15 +19,15 @@ export const useFlashUserInputErrorEvent = (asyncCallback: (event: FlashUserInpu }); if (isUnmounted) { - unlisten.then(f => f()); // Unsubscribe if unmounted early. + void unlisten.then(f => f()); // Unsubscribe if unmounted early. } }; - setup(); + void setup(); return () => { isUnmounted = true; - unlisten.then(f => f()); + void unlisten.then(f => f()); }; }, []); diff --git a/frontend/libs/tauri-utils/src/lib/useWindowControls.ts b/frontend/libs/tauri-utils/src/lib/useWindowControls.ts index 8c2da336d9..05e8995f50 100644 --- a/frontend/libs/tauri-utils/src/lib/useWindowControls.ts +++ b/frontend/libs/tauri-utils/src/lib/useWindowControls.ts @@ -16,7 +16,7 @@ export function useTauriWindowControls() { let unlistenUnmax: (() => void) | undefined; let unlistenResize: (() => void) | undefined; - (async () => { + void (async () => { try { const win = await getCurrentWindowSafe(); setIsMaximized(await win.isMaximized());