From 1ae54cabc0435d25e0ee248c0da4dc97043da1ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:31:01 -0500 Subject: [PATCH 01/24] ci(deps): bump the actions group across 1 directory with 4 updates (#2760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the actions group with 4 updates in the / directory: [actions/checkout](https://github.com/actions/checkout), [actions/setup-node](https://github.com/actions/setup-node), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/checkout` from 4 to 7
Release notes

Sourced from actions/checkout's releases.

v7.0.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v6.0.3...v7.0.0

v6.1.0

What's Changed

https://github.blog/changelog/2026-06-18-safer-pull_request_target-defaults-for-github-actions-checkout/ for more details about this breaking change

Full Changelog: https://github.com/actions/checkout/compare/v6.0.3...v6.1.0

v6.0.3

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v6...v6.0.3

v6.0.2

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v6.0.1...v6.0.2

v6.0.1

What's Changed

... (truncated)

Changelog

Sourced from actions/checkout's changelog.

Changelog

v7.0.1

v7.0.0

v6.0.3

v6.0.2

v6.0.1

v6.0.0

v5.0.1

v5.0.0

v4.3.1

v4.3.0

v4.2.2

v4.2.1

... (truncated)

Commits

Updates `actions/setup-node` from 4 to 7
Release notes

Sourced from actions/setup-node's releases.

v7.0.0

What's Changed

Enhancements:

Bug fixes:

Documentation updates:

Dependency update:

New Contributors

Full Changelog: https://github.com/actions/setup-node/compare/v6...v7.0.0

v6.5.0

What's Changed

Full Changelog: https://github.com/actions/setup-node/compare/v6.4.0...v6.5.0

v6.4.0

What's Changed

Dependency updates:

New Contributors

Full Changelog: https://github.com/actions/setup-node/compare/v6...v6.4.0

v6.3.0

What's Changed

Enhancements:

... (truncated)

Commits

Updates `actions/upload-artifact` from 4 to 7
Release notes

Sourced from actions/upload-artifact's releases.

v7.0.0

v7 What's new

Direct Uploads

Adds support for uploading single files directly (unzipped). Callers can set the new archive parameter to false to skip zipping the file during upload. Right now, we only support single files. The action will fail if the glob passed resolves to multiple files. The name parameter is also ignored with this setting. Instead, the name of the artifact will be the name of the uploaded file.

ESM

To support new versions of the @actions/* packages, we've upgraded the package to ESM.

What's Changed

New Contributors

Full Changelog: https://github.com/actions/upload-artifact/compare/v6...v7.0.0

v6.0.0

v6 - What's new

[!IMPORTANT] actions/upload-artifact@v6 now runs on Node.js 24 (runs.using: node24) and requires a minimum Actions Runner version of 2.327.1. If you are using self-hosted runners, ensure they are updated before upgrading.

Node.js 24

This release updates the runtime to Node.js 24. v5 had preliminary support for Node.js 24, however this action was by default still running on Node.js 20. Now this action by default will run on Node.js 24.

What's Changed

Full Changelog: https://github.com/actions/upload-artifact/compare/v5.0.0...v6.0.0

v5.0.0

What's Changed

BREAKING CHANGE: this update supports Node v24.x. This is not a breaking change per-se but we're treating it as such.

... (truncated)

Commits

Updates `actions/download-artifact` from 4 to 8
Release notes

Sourced from actions/download-artifact's releases.

v8.0.0

v8 - What's new

[!IMPORTANT] actions/download-artifact@v8 has been migrated to an ESM module. This should be transparent to the caller but forks might need to make significant changes.

[!IMPORTANT] Hash mismatches will now error by default. Users can override this behavior with a setting change (see below).

Direct downloads

To support direct uploads in actions/upload-artifact, the action will no longer attempt to unzip all downloaded files. Instead, the action checks the Content-Type header ahead of unzipping and skips non-zipped files. Callers wishing to download a zipped file as-is can also set the new skip-decompress parameter to true.

Enforced checks (breaking)

A previous release introduced digest checks on the download. If a download hash didn't match the expected hash from the server, the action would log a warning. Callers can now configure the behavior on mismatch with the digest-mismatch parameter. To be secure by default, we are now defaulting the behavior to error which will fail the workflow run.

ESM

To support new versions of the @actions/* packages, we've upgraded the package to ESM.

What's Changed

Full Changelog: https://github.com/actions/download-artifact/compare/v7...v8.0.0

v7.0.0

v7 - What's new

[!IMPORTANT] actions/download-artifact@v7 now runs on Node.js 24 (runs.using: node24) and requires a minimum Actions Runner version of 2.327.1. If you are using self-hosted runners, ensure they are updated before upgrading.

Node.js 24

This release updates the runtime to Node.js 24. v6 had preliminary support for Node 24, however this action was by default still running on Node.js 20. Now this action by default will run on Node.js 24.

What's Changed

New Contributors

Full Changelog: https://github.com/actions/download-artifact/compare/v6.0.0...v7.0.0

v6.0.0

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/artcraft-linux-publish.yml | 22 +++++++++---------- .github/workflows/artcraft-macos-publish.yml | 4 ++-- .../workflows/artcraft-windows-publish.yml | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/artcraft-linux-publish.yml b/.github/workflows/artcraft-linux-publish.yml index 103a4642b6..70e42ef0f1 100644 --- a/.github/workflows/artcraft-linux-publish.yml +++ b/.github/workflows/artcraft-linux-publish.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-22.04 timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - uses: storytold/craft-common-actions/actions/install-apt-packages@main with: packages: rpm jq binutils zsync @@ -34,7 +34,7 @@ jobs: TAURI_FRONTEND_PATH: ${{ github.workspace }}/frontend TAURI_APP_PATH: ${{ github.workspace }}/crates/desktop/artcraft steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - uses: storytold/craft-common-actions/actions/install-apt-packages@main with: packages: libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libclang-dev libasound2-dev libxdo-dev libdbus-1-dev build-essential clang file jq perl cmake nasm rpm zsync gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-libav @@ -63,7 +63,7 @@ jobs: PKG_CONFIG_LIBDIR_riscv64gc_unknown_linux_gnu=/usr/lib/riscv64-linux-gnu/pkgconfig:/usr/share/pkgconfig ENV echo "CMAKE_TOOLCHAIN_FILE_riscv64gc_unknown_linux_gnu=$GITHUB_WORKSPACE/packaging/linux/riscv64.cmake" >> "$GITHUB_ENV" - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: '22' cache: npm @@ -89,7 +89,7 @@ jobs: ARCH: ${{ matrix.arch }} TARGET: ${{ matrix.target }} run: packaging/linux/package.sh "$ARCH" "$TARGET" - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: release-linux-${{ matrix.arch }} path: dist/release/* @@ -102,8 +102,8 @@ jobs: matrix: arch: [x86_64, aarch64] steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 with: name: release-linux-${{ matrix.arch }} path: dist/linux @@ -126,7 +126,7 @@ jobs: for package in dist/release/*.pkg.tar.zst; do tar --zstd -xOf "$package" .PKGINFO | grep -Fx 'depend = webkit2gtk-4.1' done - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: release-arch-${{ matrix.arch }} path: dist/release/*.pkg.tar.zst @@ -145,8 +145,8 @@ jobs: - {arch: x86_64, runner: ubuntu-24.04} - {arch: aarch64, runner: ubuntu-24.04-arm} steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 with: name: release-linux-${{ matrix.arch }} path: dist/linux @@ -162,7 +162,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: packaging/linux/flatpak.sh - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: release-flatpak-${{ matrix.arch }} path: | @@ -175,7 +175,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Read version id: version run: echo "value=$(jq -r .version crates/desktop/artcraft/tauri.conf.json)" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/artcraft-macos-publish.yml b/.github/workflows/artcraft-macos-publish.yml index d40cda5e61..63484b6a75 100644 --- a/.github/workflows/artcraft-macos-publish.yml +++ b/.github/workflows/artcraft-macos-publish.yml @@ -29,10 +29,10 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: setup node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: lts/* diff --git a/.github/workflows/artcraft-windows-publish.yml b/.github/workflows/artcraft-windows-publish.yml index fa5847e49c..e814bb8216 100644 --- a/.github/workflows/artcraft-windows-publish.yml +++ b/.github/workflows/artcraft-windows-publish.yml @@ -24,7 +24,7 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: install Rust stable uses: dtolnay/rust-toolchain@stable @@ -39,7 +39,7 @@ jobs: shell: cmd - name: setup node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: lts/* From 79d87b2b54b5b27223fa428bd0acd06bdd7abaf5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 6 Nov 2026 22:48:03 -0500 Subject: [PATCH 02/24] fix(flatpak): persist data directory, keep accelerated rendering, and enrich metainfo (#2761) ## Summary Transfers verified improvements and reviewer feedback from the FlatPark package review to ArtCraft's first-party Flatpak build: - **Data Persistence:** Adds `--persist=Artcraft` to `finish-args` in `flatpak.yml` so user settings, credentials, provider tokens, and local task SQLite queue stored in `~/Artcraft` persist in `~/.var/app/ai.artcraft.app/Artcraft` across launches instead of being discarded on exit. - **Accelerated Rendering:** Adds `artcraft-wrapper` setting `WEBKIT_DISABLE_DMABUF_RENDERER="${WEBKIT_DISABLE_DMABUF_RENDERER:-0}"` and `WEBKIT_DISABLE_COMPOSITING_MODE="${WEBKIT_DISABLE_COMPOSITING_MODE:-0}"`. Keeping WebKitGTK's accelerated rendering path enabled prevents rendering glitches on `org.gnome.Platform//51` while preserving user override capability. - **Dependency Checking:** Updates the Flatpak build runtime verification to inspect the real binary (`/app/bin/artcraft.real`). - **Enriched AppStream Metainfo:** Updates `ai.artcraft.app.metainfo.xml` with CC0-1.0 metadata license, bugtracker/vcs-browser/contact URLs, bulleted feature description, search keywords, branding colors, hardware display requirements, input controls, and OARS-1.1 content rating. ## Verification - `actionlint .github/workflows/*.yml` passed. - `shellcheck packaging/linux/*.sh packaging/linux/artcraft-wrapper` passed. - `xmllint --noout packaging/linux/ai.artcraft.app.metainfo.xml` passed. - `appstreamcli validate packaging/linux/ai.artcraft.app.metainfo.xml` passed with 0 errors and 0 info notices. --- packaging/linux/README.md | 7 +-- packaging/linux/ai.artcraft.app.metainfo.xml | 49 +++++++++++++++++--- packaging/linux/artcraft-wrapper | 16 +++++++ packaging/linux/flatpak.sh | 3 +- packaging/linux/flatpak.yml | 7 +++ 5 files changed, 72 insertions(+), 10 deletions(-) create mode 100755 packaging/linux/artcraft-wrapper diff --git a/packaging/linux/README.md b/packaging/linux/README.md index 2c52f8920c..04cf27c925 100644 --- a/packaging/linux/README.md +++ b/packaging/linux/README.md @@ -13,9 +13,10 @@ existing `artcraft-v` draft, retaining Windows and macOS assets. The ve Native AppImages also include zsync delta-update metadata. Flatpak uses native Ubuntu 24.04 runners and GNOME 51 for GTK3/WebKitGTK 4.1. Its build checks -for missing ELF dependencies inside the sandbox. RISC-V packages require Ubuntu 24.04-era -libraries; x86_64 and ARM64 use Ubuntu 22.04 as their build baseline. The suite does not publish -RISC-V AppImages, Arch packages or Flatpaks. +for missing ELF dependencies inside the sandbox, grants `--persist=Artcraft` so settings and task +data survive restarts, and provides a launcher wrapper keeping WebKitGTK's accelerated rendering +path enabled. RISC-V packages require Ubuntu 24.04-era libraries; x86_64 and ARM64 use Ubuntu 22.04 +as their build baseline. The suite does not publish RISC-V AppImages, Arch packages or Flatpaks. `package.sh ` normalizes Tauri's DEB/RPM/AppImage filenames and extracts the DEB's `/usr` tree into the suite's `bin/` and `share/` tarball layout. Shared Craft diff --git a/packaging/linux/ai.artcraft.app.metainfo.xml b/packaging/linux/ai.artcraft.app.metainfo.xml index affa90da6c..603e89c8ef 100644 --- a/packaging/linux/ai.artcraft.app.metainfo.xml +++ b/packaging/linux/ai.artcraft.app.metainfo.xml @@ -2,13 +2,50 @@ ai.artcraft.app ArtCraft Studio - Create AI images and video + Create images and video with AI MIT MIT OR Apache-2.0 -

ArtCraft Studio is a desktop workspace for generating AI images and video with connected AI providers.

- ai.artcraft.app.desktop + + ArtCraft + https://getartcraft.com - ArtCraft - GraphicsAudioVideo - artcraft + https://github.com/storytold/artcraft/issues + https://github.com/storytold/artcraft + https://discord.gg/artcraft + +

ArtCraft Studio is a creative desktop workspace for generating AI images and video with connected AI providers.

+
    +
  • Text-to-image and image-to-image creation with state-of-the-art models
  • +
  • Video generation and camera motion controls
  • +
  • Direct integration with Fal, Grok, Midjourney, Sora, and WorldLabs
  • +
  • Local task persistence with an embedded SQLite queue
  • +
+
+ ai.artcraft.app.desktop + + Graphics + AudioVideo + + + ai + image + video + generation + art + + + #2f7bf5 + #1a5bc4 + + + 760 + + + keyboard + pointing + + + + artcraft +
diff --git a/packaging/linux/artcraft-wrapper b/packaging/linux/artcraft-wrapper new file mode 100755 index 0000000000..2d2bb3de00 --- /dev/null +++ b/packaging/linux/artcraft-wrapper @@ -0,0 +1,16 @@ +#!/bin/sh +set -eu + +# ArtCraft Studio is a Tauri (WebKitGTK) desktop app. +# +# Keep WebKitGTK's accelerated path on, the opposite of the older recipe of +# disabling the DMABUF renderer. On org.gnome.Platform//51 the unaccelerated +# path draws this window wrong. +# +# ${VAR:-0} rather than plain assignment, so a user whose driver does need the +# unaccelerated path can take it back: +# flatpak override --user --env=WEBKIT_DISABLE_DMABUF_RENDERER=1 ai.artcraft.app +export WEBKIT_DISABLE_DMABUF_RENDERER="${WEBKIT_DISABLE_DMABUF_RENDERER:-0}" +export WEBKIT_DISABLE_COMPOSITING_MODE="${WEBKIT_DISABLE_COMPOSITING_MODE:-0}" + +exec /app/bin/artcraft.real "$@" diff --git a/packaging/linux/flatpak.sh b/packaging/linux/flatpak.sh index 82a856bfea..905efc0a19 100755 --- a/packaging/linux/flatpak.sh +++ b/packaging/linux/flatpak.sh @@ -8,6 +8,7 @@ trap 'rm -rf "$work"' EXIT mkdir -p "$work/stage" dist/release tar -xzf "dist/linux/$base.tar.gz" --strip-components=1 -C "$work/stage" cp packaging/linux/flatpak.yml "$work/manifest.yml" +cp packaging/linux/artcraft-wrapper "$work/artcraft-wrapper" flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo sign=() keys=() @@ -21,7 +22,7 @@ flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --forc # Fail on missing WebKitGTK or other runtime libraries rather than shipping an unloadable binary. # shellcheck disable=SC2016 # Expand these variables inside the Flatpak runtime shell. flatpak build --runtime "$work/build" sh -c ' - dependencies=$(ldd /app/bin/artcraft) || exit 1 + dependencies=$(ldd /app/bin/artcraft.real) || exit 1 printf "%s\n" "$dependencies" case "$dependencies" in *"not found"*) exit 1 ;; esac ' diff --git a/packaging/linux/flatpak.yml b/packaging/linux/flatpak.yml index f1b4581269..705aa5d345 100644 --- a/packaging/linux/flatpak.yml +++ b/packaging/linux/flatpak.yml @@ -13,6 +13,9 @@ finish-args: - --filesystem=xdg-pictures - --filesystem=xdg-videos - --filesystem=xdg-download + # The app hardcodes its data to ~/Artcraft (settings, credentials, state). + # Persist it under ~/.var/app/ai.artcraft.app/Artcraft so data survives exits. + - --persist=Artcraft modules: - name: artcraft buildsystem: simple @@ -20,6 +23,10 @@ modules: - cp -a . /app/ - install -Dm644 /app/share/icons/hicolor/128x128/apps/artcraft.png /app/share/icons/hicolor/128x128/apps/ai.artcraft.app.png - sed -i 's/^Icon=.*/Icon=ai.artcraft.app/' /app/share/applications/ai.artcraft.app.desktop + - mv /app/bin/artcraft /app/bin/artcraft.real + - install -Dm755 artcraft-wrapper /app/bin/artcraft sources: - type: dir path: stage + - type: file + path: artcraft-wrapper From 56b30909244e432784348f4346ec8074779c04b6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 8 Nov 2026 20:22:46 -0500 Subject: [PATCH 03/24] ci: dual-push Flatpak OCI bundles to Docker Hub (#2784) Mirror Flatpak OCI bundles to Docker Hub (`docker.io/storytold/artcraft`) alongside GHCR when Docker Hub credentials (`DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN`) are present. --- .github/workflows/artcraft-linux-publish.yml | 2 ++ packaging/linux/flatpak.sh | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/artcraft-linux-publish.yml b/.github/workflows/artcraft-linux-publish.yml index 70e42ef0f1..e76cc04ac4 100644 --- a/.github/workflows/artcraft-linux-publish.yml +++ b/.github/workflows/artcraft-linux-publish.yml @@ -161,6 +161,8 @@ jobs: - name: Build Flatpak and publish OCI env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} run: packaging/linux/flatpak.sh - uses: actions/upload-artifact@v7 with: diff --git a/packaging/linux/flatpak.sh b/packaging/linux/flatpak.sh index 905efc0a19..cc08d0b57d 100755 --- a/packaging/linux/flatpak.sh +++ b/packaging/linux/flatpak.sh @@ -38,4 +38,13 @@ if [[ -n "${SIGNING_FPR:-}" ]]; then skopeo copy --format oci --dest-creds "$creds" "oci:dist/release/$base-oci" "docker://$registry:stable-$arch" fi skopeo inspect --raw --creds "$creds" "docker://$registry:$version-$arch" >"dist/release/$base.oci-manifest.json" + + if [[ -n "${DOCKERHUB_USERNAME:-}" && -n "${DOCKERHUB_TOKEN:-}" ]]; then + dh_registry="docker.io/storytold/${GITHUB_REPOSITORY##*/}" + dh_creds="$DOCKERHUB_USERNAME:$DOCKERHUB_TOKEN" + skopeo copy --format oci --dest-creds "$dh_creds" "oci:dist/release/$base-oci" "docker://$dh_registry:$version-$arch" + if [[ "$version" != *-* && ( "$GITHUB_REF" == refs/heads/release || "$GITHUB_REF" == refs/heads/artcraft-release ) ]]; then + skopeo copy --format oci --dest-creds "$dh_creds" "oci:dist/release/$base-oci" "docker://$dh_registry:stable-$arch" + fi + fi fi From 1218293fe290d75c7341e27907384f9a7300cba4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 9 Nov 2026 10:09:12 -0500 Subject: [PATCH 04/24] docs: add CodeRabbit badge to README (#2790) Add CodeRabbit review badge to README alongside SonarCloud. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e7095a5377..da446e4916 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@

Scanned by SonarCloud + Reviewed by CodeRabbit

The IDE for artists.

From 1510abf5639393fc7dbda01fc17ff59792cbc885 Mon Sep 17 00:00:00 2001 From: Axylum <86928157+AxylumRust@users.noreply.github.com> Date: Tue, 10 Nov 2026 11:32:48 +0100 Subject: [PATCH 05/24] url_utils: satisfy Clippy pedantic lints (#2681) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Update — 2026-11-01 The latest revision removes the systematic `#[must_use]` additions and any product-name backticks introduced solely for optional `clippy::pedantic` compliance. The useful behavior-preserving cleanups remain. Earlier summary and verification text below describes the original revision; the latest PR comment records the current checks. --- ## Summary - resolve all 54 distinct diagnostics in `url_utils`: 17 pedantic, 36 deprecation warnings, and one Eq/Hash contract issue - preserve the public compatibility module and nested module paths with narrow documented expectations - implement `Hash` against the same bare value as `PartialEq`, with a regression test - apply the repository two-space rustfmt rules within `url_utils` only No public API or dependency changes. ## Verification - `SQLX_OFFLINE=true cargo clippy -p url_utils --all-targets -- -W clippy::pedantic -D warnings` - `SQLX_OFFLINE=true cargo test -p url_utils` — 32 unit tests and 2 doctests passed - `cargo fmt -p url_utils -- --check` - Independent read-only review: no Rust findings; the untracked planning file is excluded from the PR --------- Co-authored-by: Cédric Legrand --- .../download_extension/download_extension.rs | 1 - .../extract_download_extension_from_url.rs | 8 +- .../url_utils/src/download_extension/mod.rs | 1 + .../lib/url_utils/src/extension/extension.rs | 41 ++++++--- .../extension/extract_extension_from_url.rs | 85 +++++++++---------- crates/lib/url_utils/src/extension/mod.rs | 3 +- crates/lib/url_utils/src/lib.rs | 3 +- 7 files changed, 75 insertions(+), 67 deletions(-) diff --git a/crates/lib/url_utils/src/download_extension/download_extension.rs b/crates/lib/url_utils/src/download_extension/download_extension.rs index 4193b07467..93ad91347e 100644 --- a/crates/lib/url_utils/src/download_extension/download_extension.rs +++ b/crates/lib/url_utils/src/download_extension/download_extension.rs @@ -1,4 +1,3 @@ - /// When downloading a remote file, it makes sense to try to match the same file extension (with reasonable safeguards). #[deprecated(note = "Use `Extension` in `url_utils::extension::extension` instead")] #[derive(Debug, Copy, Clone, Eq, PartialEq)] diff --git a/crates/lib/url_utils/src/download_extension/extract_download_extension_from_url.rs b/crates/lib/url_utils/src/download_extension/extract_download_extension_from_url.rs index 1d0c1b6465..5fd0984539 100644 --- a/crates/lib/url_utils/src/download_extension/extract_download_extension_from_url.rs +++ b/crates/lib/url_utils/src/download_extension/extract_download_extension_from_url.rs @@ -12,9 +12,7 @@ pub fn extract_download_extension_from_url_str(url: &str) -> Option Option { let path = url.path(); - let extension = std::path::Path::new(path) - .extension() - .and_then(|ext| ext.to_str())?; + let extension = std::path::Path::new(path).extension().and_then(|ext| ext.to_str())?; DownloadExtension::try_from_str(extension) } @@ -26,14 +24,14 @@ mod tests { #[test] fn success_case() { let url = "https://storyteller.ai/example.jpg"; - let maybe_extension= extract_download_extension_from_url_str(url); + let maybe_extension = extract_download_extension_from_url_str(url); assert_eq!(maybe_extension, Some(DownloadExtension::Jpg)); } #[test] fn difficult_url() { let url = "https://videos.youtube.com/foo/bar/files/00000000-f19a-1275-a092-caa60b38f8d2%2Fraw?se=2025-11-21T22%3A26%3A53Z&sp=r&sv=2024-08-09&sr=b&skoid=8cfff87a-01fc-27c1-9091-32999dcd1389&sktid=aa8ccaf6-e6da-484e-ab11-9c7496c21c53&skt=2025-11-17T21%3A09%3A08Z&ske=2025-10-23T21%3A14%3A08Z&sks=b&skv=2024-08-04&sig=T2U6%2Brw9WJdJagBkCL4/GlFr72KhZGP3QPlobIO7JlU%3D&ac=oaisdsorprnorthcentralus"; - let maybe_extension= extract_download_extension_from_url_str(url); + let maybe_extension = extract_download_extension_from_url_str(url); assert!(maybe_extension.is_none()); } } diff --git a/crates/lib/url_utils/src/download_extension/mod.rs b/crates/lib/url_utils/src/download_extension/mod.rs index 3706f2dddb..576d032ace 100644 --- a/crates/lib/url_utils/src/download_extension/mod.rs +++ b/crates/lib/url_utils/src/download_extension/mod.rs @@ -1,3 +1,4 @@ +#[expect(clippy::module_inception, reason = "Preserve the existing public module path")] mod download_extension; pub mod extract_download_extension_from_url; diff --git a/crates/lib/url_utils/src/extension/extension.rs b/crates/lib/url_utils/src/extension/extension.rs index a92df6d43c..cee9a92ec6 100644 --- a/crates/lib/url_utils/src/extension/extension.rs +++ b/crates/lib/url_utils/src/extension/extension.rs @@ -1,5 +1,6 @@ use std::borrow::Cow; use std::fmt; +use std::hash::{Hash, Hasher}; /// A file extension that can be either a compile-time constant or a runtime-parsed value. /// @@ -16,7 +17,7 @@ use std::fmt; /// assert_eq!(ext.without_period(), "mp4"); /// assert_eq!(ext.with_period(), ".mp4"); /// ``` -#[derive(Clone, Eq, Hash)] +#[derive(Clone, Eq)] pub struct Extension { /// The extension without the leading period, e.g. "png", "mp4". value: Cow<'static, str>, @@ -34,20 +35,14 @@ impl Extension { /// const MP4: Extension = Extension::from_static("mp4", ".mp4"); /// ``` pub const fn from_static(ext: &'static str, dotted: &'static str) -> Self { - Self { - value: Cow::Borrowed(ext), - dotted: Cow::Borrowed(dotted), - } + Self { value: Cow::Borrowed(ext), dotted: Cow::Borrowed(dotted) } } /// Creates an `Extension` from a `&str` at runtime. /// The input must NOT include a leading period. pub fn new(ext: &str) -> Self { - let dotted = format!(".{}", ext); - Self { - value: Cow::Owned(ext.to_string()), - dotted: Cow::Owned(dotted), - } + let dotted = format!(".{ext}"); + Self { value: Cow::Owned(ext.to_string()), dotted: Cow::Owned(dotted) } } /// Returns the extension without the leading period, e.g. `"png"`. @@ -67,6 +62,12 @@ impl PartialEq for Extension { } } +impl Hash for Extension { + fn hash(&self, state: &mut H) { + self.value.hash(state); + } +} + impl fmt::Debug for Extension { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Extension(\"{}\")", self.value) @@ -135,12 +136,28 @@ mod tests { #[test] fn display() { - assert_eq!(format!("{}", PNG), "png"); + assert_eq!(format!("{PNG}"), "png"); assert_eq!(format!("{}", Extension::new("xyz")), "xyz"); } #[test] fn debug() { - assert_eq!(format!("{:?}", PNG), "Extension(\"png\")"); + assert_eq!(format!("{PNG:?}"), "Extension(\"png\")"); + } + + #[test] + fn hash_matches_equality() { + let plain = Extension::from_static("png", ".png"); + let inconsistent = Extension::from_static("png", ".not-a-suffix"); + assert_eq!(plain, inconsistent); + assert_eq!(hash(&plain), hash(&inconsistent)); + } + + fn hash(extension: &Extension) -> u64 { + use std::collections::hash_map::DefaultHasher; + + let mut hasher = DefaultHasher::new(); + extension.hash(&mut hasher); + hasher.finish() } } diff --git a/crates/lib/url_utils/src/extension/extract_extension_from_url.rs b/crates/lib/url_utils/src/extension/extract_extension_from_url.rs index 928aa583fe..2fb3310ead 100644 --- a/crates/lib/url_utils/src/extension/extract_extension_from_url.rs +++ b/crates/lib/url_utils/src/extension/extract_extension_from_url.rs @@ -6,24 +6,13 @@ use url::Url; // TODO: Lookups against these as lists will be slow /// Known image extensions. -const KNOWN_IMAGE_EXTENSIONS: &[Extension] = &[ - Extension::from_static("png", ".png"), - Extension::from_static("jpg", ".jpg"), - Extension::from_static("jpeg", ".jpeg"), - Extension::from_static("webp", ".webp"), -]; +const KNOWN_IMAGE_EXTENSIONS: &[Extension] = &[Extension::from_static("png", ".png"), Extension::from_static("jpg", ".jpg"), Extension::from_static("jpeg", ".jpeg"), Extension::from_static("webp", ".webp")]; /// Known audio extensions. -const KNOWN_AUDIO_EXTENSIONS: &[Extension] = &[ - Extension::from_static("wav", ".wav"), - Extension::from_static("mp3", ".mp3"), -]; +const KNOWN_AUDIO_EXTENSIONS: &[Extension] = &[Extension::from_static("wav", ".wav"), Extension::from_static("mp3", ".mp3")]; /// Known video extensions. -const KNOWN_VIDEO_EXTENSIONS: &[Extension] = &[ - Extension::from_static("mp4", ".mp4"), - Extension::from_static("webm", ".webm"), -]; +const KNOWN_VIDEO_EXTENSIONS: &[Extension] = &[Extension::from_static("mp4", ".mp4"), Extension::from_static("webm", ".webm")]; /// Controls which extensions are accepted when extracting from a URL. pub enum ExtractExtensions { @@ -62,9 +51,7 @@ pub fn extract_extension_from_url_str(url: &str, accept: &ExtractExtensions) -> /// Extracts a file extension from a parsed `Url`, filtered by `accept`. pub fn extract_extension_from_url(url: &Url, accept: &ExtractExtensions) -> Option { let path = url.path(); - let raw_ext = std::path::Path::new(path) - .extension() - .and_then(|ext| ext.to_str())?; + let raw_ext = std::path::Path::new(path).extension().and_then(|ext| ext.to_str())?; let lower = raw_ext.to_lowercase(); let candidate = Extension::new(&lower); @@ -72,27 +59,40 @@ pub fn extract_extension_from_url(url: &Url, accept: &ExtractExtensions) -> Opti match accept { ExtractExtensions::All => Some(candidate), ExtractExtensions::Set(set) => { - if set.contains(&candidate) { Some(candidate) } else { None } - } - ExtractExtensions::KnownImage => { - if slice_contains(KNOWN_IMAGE_EXTENSIONS, &candidate) { Some(candidate) } else { None } - } - ExtractExtensions::KnownAudio => { - if slice_contains(KNOWN_AUDIO_EXTENSIONS, &candidate) { Some(candidate) } else { None } - } - ExtractExtensions::KnownVideo => { - if slice_contains(KNOWN_VIDEO_EXTENSIONS, &candidate) { Some(candidate) } else { None } - } - ExtractExtensions::KnownMedia => { - if slice_contains(KNOWN_IMAGE_EXTENSIONS, &candidate) - || slice_contains(KNOWN_AUDIO_EXTENSIONS, &candidate) - || slice_contains(KNOWN_VIDEO_EXTENSIONS, &candidate) - { + if set.contains(&candidate) { Some(candidate) } else { None } - } + }, + ExtractExtensions::KnownImage => { + if slice_contains(KNOWN_IMAGE_EXTENSIONS, &candidate) { + Some(candidate) + } else { + None + } + }, + ExtractExtensions::KnownAudio => { + if slice_contains(KNOWN_AUDIO_EXTENSIONS, &candidate) { + Some(candidate) + } else { + None + } + }, + ExtractExtensions::KnownVideo => { + if slice_contains(KNOWN_VIDEO_EXTENSIONS, &candidate) { + Some(candidate) + } else { + None + } + }, + ExtractExtensions::KnownMedia => { + if slice_contains(KNOWN_IMAGE_EXTENSIONS, &candidate) || slice_contains(KNOWN_AUDIO_EXTENSIONS, &candidate) || slice_contains(KNOWN_VIDEO_EXTENSIONS, &candidate) { + Some(candidate) + } else { + None + } + }, } } @@ -190,19 +190,14 @@ mod tests { #[test] fn set_matches_custom_list() { - let accept = ExtractExtensions::from_vec(vec![ - Extension::from_static("csv", ".csv"), - Extension::from_static("tsv", ".tsv"), - ]); + let accept = ExtractExtensions::from_vec(vec![Extension::from_static("csv", ".csv"), Extension::from_static("tsv", ".tsv")]); let ext = extract_extension_from_url_str("https://example.com/data.csv", &accept); assert_eq!(ext.unwrap().without_period(), "csv"); } #[test] fn set_rejects_non_member() { - let accept = ExtractExtensions::from_vec(vec![ - Extension::from_static("csv", ".csv"), - ]); + let accept = ExtractExtensions::from_vec(vec![Extension::from_static("csv", ".csv")]); let ext = extract_extension_from_url_str("https://example.com/data.png", &accept); assert!(ext.is_none()); } @@ -215,10 +210,7 @@ mod tests { #[test] fn query_params_ignored() { - let ext = extract_extension_from_url_str( - "https://example.com/file.mp4?token=abc&format=hd", - &ExtractExtensions::KnownVideo, - ); + let ext = extract_extension_from_url_str("https://example.com/file.mp4?token=abc&format=hd", &ExtractExtensions::KnownVideo); assert_eq!(ext.unwrap().without_period(), "mp4"); } @@ -230,8 +222,7 @@ mod tests { } fn extract_extension_all(url: &str) -> Option { - extract_extension_from_url_str(url, &ExtractExtensions::All) - .map(|ext| ext.without_period().to_string()) + extract_extension_from_url_str(url, &ExtractExtensions::All).map(|ext| ext.without_period().to_string()) } #[test] diff --git a/crates/lib/url_utils/src/extension/mod.rs b/crates/lib/url_utils/src/extension/mod.rs index 824c6d227e..e0cc69f24a 100644 --- a/crates/lib/url_utils/src/extension/mod.rs +++ b/crates/lib/url_utils/src/extension/mod.rs @@ -1,2 +1,3 @@ +#[expect(clippy::module_inception, reason = "Preserve the existing public module path")] pub mod extension; -pub mod extract_extension_from_url; \ No newline at end of file +pub mod extract_extension_from_url; diff --git a/crates/lib/url_utils/src/lib.rs b/crates/lib/url_utils/src/lib.rs index 2f3ba5d097..abb775f0c5 100644 --- a/crates/lib/url_utils/src/lib.rs +++ b/crates/lib/url_utils/src/lib.rs @@ -1,2 +1,3 @@ pub mod extension; -pub mod download_extension; \ No newline at end of file +#[expect(deprecated, reason = "Keep the public compatibility module while downstream users migrate to Extension")] +pub mod download_extension; From 1b99c184efed01ba1202475a3f20e7bf18ebbc76 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 10 Nov 2026 16:45:35 +0100 Subject: [PATCH 06/24] ci: one macOS and one Windows release build per branch at a time, with job time limits (#2809) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changes release workflows (house rule 9). It only adds limits, but it needs a maintainer's look before merging. ## Problem `artcraft-macos-publish.yml` and `artcraft-windows-publish.yml` have no `concurrency` and no `timeout-minutes`. `artcraft-linux-publish.yml` already has both. - **Overlapping builds:** two pushes to `release` or `artcraft-release` in quick succession start two builds of the same platform side by side. Both create or update the same `artcraft-v` draft release through `tauri-action`. Nothing stops this today. It happens whenever a second push lands while a 10-36 minute build is still running. (The two runs on 2026-11-07 were 35 minutes apart and did not overlap.) - **Hung builds:** a build that hangs runs until GitHub's 6-hour default. The Windows run on 2026-06-12 did exactly that and was cancelled at 360 minutes. Successful builds take far less: | workflow | successful builds, last 15 runs (2026-04 to 2026-11) | |---|---| | macOS publish | 10-22 min | | Windows publish | 17-36 min | ## Change Two files, limits only. Triggers, steps, secrets, signing, release settings and action versions are unchanged. - **Concurrency:** `concurrency: { group: macos-release-${{ github.ref }}, cancel-in-progress: false }`, and likewise `windows-release-…`. This is the same pattern as `artcraft-linux-publish.yml` (`linux-release-${{ github.ref }}`). - A release build that is already running is **never cancelled**, since it may already have uploaded to the draft release. - One GitHub behaviour to be aware of: a concurrency group holds one running and one pending run. If a third push lands while one build runs and another waits, GitHub replaces the waiting run with the newest. So the next build is always of the latest commit on that branch, and an intermediate commit may not get its own build. For a release branch I think that is what we want. If every commit must get a build, this PR shouldn't be merged as it is; tell me and I'll change it. - The groups are per platform and per branch, so macOS, Windows and Linux still build in parallel with each other. - **Timeouts:** `timeout-minutes: 60` for macOS and `90` for Windows. That is about 2.5-3× the slowest successful build, and Windows matches the Linux build job's 90. A hang now stops after an hour or an hour and a half instead of six. Not changed: `dtolnay/rust-toolchain@stable` and `tauri-apps/tauri-action@v0` are still unpinned tags. Pinning them would change which action code builds a release, so it should be a separate decision. ## Verification - `actionlint` is clean on the three publish workflows. - These workflows only run on pushes to `release`, `artcraft-release`, `artcraft-macos` and `artcraft-windows`, so this PR's checks don't exercise them. The new settings take effect on the next release push. - I didn't trigger a release build. ## Summary by CodeRabbit * **Chores** * Release builds for macOS and Windows now finish in progress without being cancelled by newer runs. When multiple builds are queued for the same branch or ref, only the newest pending build is kept. * Publishing jobs now have maximum run times of 60 minutes for macOS and 90 minutes for Windows. Co-authored-by: FredApps --- .github/workflows/artcraft-macos-publish.yml | 9 +++++++++ .github/workflows/artcraft-windows-publish.yml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/artcraft-macos-publish.yml b/.github/workflows/artcraft-macos-publish.yml index 63484b6a75..59ca9a9532 100644 --- a/.github/workflows/artcraft-macos-publish.yml +++ b/.github/workflows/artcraft-macos-publish.yml @@ -10,6 +10,13 @@ on: # This workflow creates Universal macOS builds with signing certificate support. # On each push to the release branches it will create or update a GitHub release, build your app, and upload the artifacts to the release. +# One release build per branch at a time. A run in progress is never cancelled, because it may +# already have created or uploaded to the draft release. If more pushes arrive while one runs, +# GitHub keeps only the newest as pending, so the next build is of the latest commit. +concurrency: + group: macos-release-${{ github.ref }} + cancel-in-progress: false + jobs: publish-artcraft: permissions: @@ -28,6 +35,8 @@ jobs: # args: '' runs-on: ${{ matrix.platform }} + # Successful builds took 10-22 min (2026-04 to 2026-11). + timeout-minutes: 60 steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/artcraft-windows-publish.yml b/.github/workflows/artcraft-windows-publish.yml index e814bb8216..cb07d151a7 100644 --- a/.github/workflows/artcraft-windows-publish.yml +++ b/.github/workflows/artcraft-windows-publish.yml @@ -10,6 +10,13 @@ on: # This workflow creates Windows builds. # On each push to the release branches it will create or update a GitHub release, build your app, and upload the artifacts to the release. +# One release build per branch at a time. A run in progress is never cancelled, because it may +# already have created or uploaded to the draft release. If more pushes arrive while one runs, +# GitHub keeps only the newest as pending, so the next build is of the latest commit. +concurrency: + group: windows-release-${{ github.ref }} + cancel-in-progress: false + jobs: publish-artcraft-windows: permissions: @@ -23,6 +30,8 @@ jobs: args: '' runs-on: ${{ matrix.platform }} + # Successful builds took 17-36 min (2026-04 to 2026-11); one hung run used the full 6-hour default. + timeout-minutes: 90 steps: - uses: actions/checkout@v7 From c3fa0453a467cdb8ce7ae1aa3b19a6c961808e04 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 10 Nov 2026 18:36:03 +0100 Subject: [PATCH 07/24] desktop: use tokio::fs for Sora and Midjourney file I/O (Sonar S7493) (#2804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Replaces blocking `std::fs` calls inside `async fn`s in the desktop crate with `tokio::fs`. SonarCloud reports these as **rust:S7493** ("use an asynchronous file API instead of this blocking file operation"). This PR resolves 17 of the 26 desktop findings. | File (under `crates/desktop/artcraft/src/services/`) | Findings | Change | |----------------------------------------------------------------|----------|----------------------------------------------------------------------------| | `sora/state/read_sora_credentials_from_disk_with_upgrade.rs` | 10 | `read_to_string` and `OpenOptions`+`write_all`+`flush` → `tokio::fs::{read_to_string, write}` | | `sora/state/initialize_sora_jwt_bearer_token.rs` | 2 | `std::fs::{read_to_string, write}` → `tokio::fs` | | `sora/state/sora_credential_manager.rs` (`call_sentinel_refresh`) | 2 | `OpenOptions`+`write_all`+`flush` → `tokio::fs::write` | | `midjourney/utils/download_midjourney_image.rs` | 2 | `File::create`+`write_all` → `tokio::fs::write` | | `midjourney/threads/upload_midjourney_batch.rs` | 1 | `std::fs::remove_file` → `tokio::fs::remove_file(..).await` | `tokio::fs::write` creates or truncates the file and writes everything. That is the same as the `OpenOptions::new().create(true).write(true).truncate(true)` + `write_all` + `flush` sequence it replaces. The synchronous helpers in `sora_credential_manager.rs` (`persist_*_to_disk`) are not `async`, are not flagged, and are left unchanged. The `.exists()` guards are also left as they are. The desktop crate already depends on `tokio` with the `fs` feature, so no manifest or lockfile changes. ## Not included (overlap with open PRs) The remaining 9 desktop S7493 findings are in files that open PRs are rewriting. They are left alone to avoid conflicting changes: - `core/utils/simple_http_download.rs`, `sora/.../handle_successful_generations.rs`, `worldlabs/threads/worldlabs_marble_task_polling.rs`: #2777 (fail downloads on non-2xx responses). - `core/threads/.../fal/handle_fal_complete.rs`: #2550, #2373. - `core/utils/auto_download.rs`: #2785, #2686, #2393. The api_clients findings are in #2803. ## Testing - Each changed file parses with `rustfmt --check`. The formatting diffs it reports already exist on `main`, and no files were reformatted. - **I could not build the desktop crate locally.** `cargo check -p artcraft` stops at `libdbus-sys` because the build machine lacks the GTK, WebKit and D-Bus system libraries Tauri needs. Please rely on CI for compilation before marking this ready. - No new tests are added. This is a behaviour-preserving switch to non-blocking I/O, so no test fails before the change and passes after it, and these paths have no existing offline tests. ## Summary by CodeRabbit * **Chores** * Updated background handling for saved images, checkpoints, and account credentials. Existing cleanup, credential processing, and error reporting behavior remain unchanged. * These maintenance updates do not change the app’s available features or how people interact with it. --- .../threads/upload_midjourney_batch.rs | 2 +- .../utils/download_midjourney_image.rs | 5 +-- .../state/initialize_sora_jwt_bearer_token.rs | 4 +- ...sora_credentials_from_disk_with_upgrade.rs | 38 ++++--------------- .../sora/state/sora_credential_manager.rs | 9 +---- 5 files changed, 13 insertions(+), 45 deletions(-) diff --git a/crates/desktop/artcraft/src/services/midjourney/threads/upload_midjourney_batch.rs b/crates/desktop/artcraft/src/services/midjourney/threads/upload_midjourney_batch.rs index 8b0448e12a..9010ae09f3 100644 --- a/crates/desktop/artcraft/src/services/midjourney/threads/upload_midjourney_batch.rs +++ b/crates/desktop/artcraft/src/services/midjourney/threads/upload_midjourney_batch.rs @@ -119,7 +119,7 @@ pub(super) async fn upload_midjourney_batch(maybe_app_handle: Option<&AppHandle> } } - if let Err(err) = std::fs::remove_file(MidjourneyUploadCheckpoint::path(app_data_root, local_task)) { + if let Err(err) = tokio::fs::remove_file(MidjourneyUploadCheckpoint::path(app_data_root, local_task)).await { log::warn!("Could not remove completed Midjourney upload checkpoint: {}", err); } Ok(()) diff --git a/crates/desktop/artcraft/src/services/midjourney/utils/download_midjourney_image.rs b/crates/desktop/artcraft/src/services/midjourney/utils/download_midjourney_image.rs index fb63021c15..c07ecd6963 100644 --- a/crates/desktop/artcraft/src/services/midjourney/utils/download_midjourney_image.rs +++ b/crates/desktop/artcraft/src/services/midjourney/utils/download_midjourney_image.rs @@ -2,8 +2,6 @@ use crate::core::state::data_dir::app_data_root::AppDataRoot; use crate::core::state::data_dir::trait_data_subdir::DataSubdir; use errors::AnyhowResult; use midjourney_client::utils::get_image_url::get_image_url; -use std::fs::File; -use std::io::Write; use std::path::PathBuf; use url::Url; use midjourney_client::utils::image_downloader_client::ImageDownloaderClient; @@ -28,8 +26,7 @@ pub async fn download_midjourney_image( let download_filename = format!("{}_{}.{}", job_id, index, ext); let download_path = tempdir.join(download_filename); - let mut file = File::create(&download_path)?; - file.write_all(&image_bytes)?; + tokio::fs::write(&download_path, &image_bytes).await?; Ok(download_path) } diff --git a/crates/desktop/artcraft/src/services/sora/state/initialize_sora_jwt_bearer_token.rs b/crates/desktop/artcraft/src/services/sora/state/initialize_sora_jwt_bearer_token.rs index 5705cb165f..62b4c3983e 100644 --- a/crates/desktop/artcraft/src/services/sora/state/initialize_sora_jwt_bearer_token.rs +++ b/crates/desktop/artcraft/src/services/sora/state/initialize_sora_jwt_bearer_token.rs @@ -14,7 +14,7 @@ pub async fn initialize_sora_jwt_bearer_token(app_data_root: &AppDataRoot) -> An return Ok(()); // Bearer token already exists. } - let cookie = std::fs::read_to_string(app_data_root.get_sora_cookie_file_path())? + let cookie = tokio::fs::read_to_string(app_data_root.get_sora_cookie_file_path()).await? .trim() .to_string(); @@ -22,7 +22,7 @@ pub async fn initialize_sora_jwt_bearer_token(app_data_root: &AppDataRoot) -> An let bearer = generate_bearer_jwt_with_cookie(&cookie).await?; - std::fs::write(app_data_root.get_sora_bearer_token_file_path(), bearer)?; + tokio::fs::write(app_data_root.get_sora_bearer_token_file_path(), bearer).await?; Ok(()) } diff --git a/crates/desktop/artcraft/src/services/sora/state/read_sora_credentials_from_disk_with_upgrade.rs b/crates/desktop/artcraft/src/services/sora/state/read_sora_credentials_from_disk_with_upgrade.rs index 7538a1a067..eae939280f 100644 --- a/crates/desktop/artcraft/src/services/sora/state/read_sora_credentials_from_disk_with_upgrade.rs +++ b/crates/desktop/artcraft/src/services/sora/state/read_sora_credentials_from_disk_with_upgrade.rs @@ -8,8 +8,7 @@ use openai_sora_client::creds::sora_jwt_bearer_token::SoraJwtBearerToken; use openai_sora_client::creds::sora_sentinel::SoraSentinel; use openai_sora_client::creds::sora_sentinel_token::SoraSentinelToken; use openai_sora_client::recipes::maybe_upgrade_or_renew_session::maybe_upgrade_or_renew_session; -use std::fs::{read_to_string, OpenOptions}; -use std::io::Write; +use tokio::fs::{read_to_string, write}; pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDataRoot) -> AnyhowResult { let cookie_file = app_data_root.get_sora_cookie_file_path(); @@ -21,7 +20,7 @@ pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDat return Err(anyhow!("Cookie file does not exist: {:?}", cookie_file)); } - let value = read_to_string(cookie_file)? + let value = read_to_string(cookie_file).await? .trim() .to_string(); @@ -32,14 +31,14 @@ pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDat let mut sentinel_token = None; if bearer_file.exists() { - let value = read_to_string(&bearer_file)? + let value = read_to_string(&bearer_file).await? .trim() .to_string(); bearer = Some(SoraJwtBearerToken::new(value)?); } if legacy_sentinel_file.exists() { - let value = read_to_string(&legacy_sentinel_file)? + let value = read_to_string(&legacy_sentinel_file).await? .trim() .to_string(); @@ -47,7 +46,7 @@ pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDat } if sentinel_token_file.exists() { - let value = read_to_string(&sentinel_token_file)? + let value = read_to_string(&sentinel_token_file).await? .trim() .to_string(); @@ -73,14 +72,7 @@ pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDat info!("Persisting bearer token value..."); let value = bearer.token_str(); - let mut file = OpenOptions::new() - .create(true) - .write(true) - .truncate(true) - .open(&bearer_file)?; - - file.write_all(value.as_bytes())?; - file.flush()?; + write(&bearer_file, value.as_bytes()).await?; } } @@ -89,14 +81,7 @@ pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDat info!("Persisting sentinel value..."); let value = sentinel.get_sentinel(); - let mut file = OpenOptions::new() - .create(true) - .write(true) - .truncate(true) - .open(&legacy_sentinel_file)?; - - file.write_all(value.as_bytes())?; - file.flush()?; + write(&legacy_sentinel_file, value.as_bytes()).await?; } } @@ -105,14 +90,7 @@ pub async fn read_sora_credentials_from_disk_with_upgrade(app_data_root: &AppDat info!("Persisting sentinel token..."); let value = sentinel_token.to_persistent_storage_json()?; - let mut file = OpenOptions::new() - .create(true) - .write(true) - .truncate(true) - .open(&sentinel_token_file)?; - - file.write_all(value.as_bytes())?; - file.flush()?; + write(&sentinel_token_file, value.as_bytes()).await?; } } diff --git a/crates/desktop/artcraft/src/services/sora/state/sora_credential_manager.rs b/crates/desktop/artcraft/src/services/sora/state/sora_credential_manager.rs index e10ddcf3f6..451e2ba1dd 100644 --- a/crates/desktop/artcraft/src/services/sora/state/sora_credential_manager.rs +++ b/crates/desktop/artcraft/src/services/sora/state/sora_credential_manager.rs @@ -162,14 +162,7 @@ impl SoraCredentialManager { self.holder.set_credentials(&creds)?; - let mut file = OpenOptions::new() - .create(true) - .write(true) - .truncate(true) - .open(self.app_data_root.get_sora_legacy_sentinel_file_path())?; - - file.write_all(sentinel.as_bytes())?; - file.flush()?; + tokio::fs::write(self.app_data_root.get_sora_legacy_sentinel_file_path(), sentinel.as_bytes()).await?; Ok(creds) } From 50afb36f9c999542b53292685d7d5827f437965a Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 10 Nov 2026 18:53:57 +0100 Subject: [PATCH 08/24] api_clients: use tokio::fs inside async functions (Sonar S7493) (#2803) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Replaces blocking `std::fs` calls inside `async fn`s with `tokio::fs` in four API client crates. SonarCloud reports these as **rust:S7493** ("use an asynchronous file API instead of this blocking file operation"). This PR resolves 13 of the 40 artcraft findings. | Crate | File | Change | |---------------------|-------------------------------------------------------------|------------------------------------------------------------| | `artcraft_client` | `endpoints/media_files/*_from_file.rs` (4 files) | `std::fs::read` → `tokio::fs::read(..).await` | | `artcraft_client` | `recipes/download_media_file.rs` | `File::create` + `write_all` + `flush` → `tokio::fs::write` | | `artcraft_router` | `generate_video/providers/kinovi/upload.rs` | `std::fs::read` → `tokio::fs::read(..).await` | | `midjourney_client` | `credentials/credential_manager.rs` (`clear_credentials`) | `std::fs::remove_file` → `tokio::fs::remove_file(..).await` | | `openai_sora_client`| `requests/deprecated/job_status/sora_job_status.rs` | `create_dir_all` / `File::create` + `write_all` → `tokio::fs` | The workspace `tokio` dependency enables only `macros`. `artcraft_client` (which had `tokio` only as a dev-dependency) and `artcraft_router` now declare `tokio = { workspace = true, features = ["fs"] }`. `midjourney_client` and `openai_sora_client` already use `tokio` with `full`. `Cargo.lock` does not change. In `save_generations_to_dir`, the blocking `dir.exists()` check before `create_dir_all` is dropped, because `create_dir_all` already succeeds when the directory exists. The behaviour stays the same: same paths, same error mapping, and the same `NotFound` handling in `clear_credentials`. ## Not included - `crates/schema/database/sqlite_tasks/src/connection.rs:25` (S7493): #2360 removes this `remove_file` entirely, so it's left to that PR. - `crates/desktop/artcraft` (26 findings): handled in a separate PR. #2365, #2373 and #2785 edit nearby lines in the `*_from_file.rs` upload files (client builder, idempotency token). None of them touch the `std::fs::read` lines. Expect at most a trivial rebase. ## Testing Run locally on Linux x86_64 with stable Rust: - `cargo check -p artcraft_client -p artcraft_router -p midjourney_client -p openai_sora_client` passes. - `cargo test` on the same four crates passes: 2555 + 39 + 16 + 6 unit tests, with ignored tests left ignored. That includes `midjourney_client`'s existing `loads_a_saved_login_and_logout_removes_every_format`, which exercises the changed `clear_credentials` path. - `cargo clippy` on these crates reports nothing on the changed lines. Clippy cannot finish on `main` itself: `enums` fails on `clippy::deprecated_semver` and `openai_sora_client` fails on `should_implement_trait` in `task_id.rs`, both pre-existing. No new test is added. This is a non-blocking I/O refactor with identical observable behaviour, so there is no test that fails before the change and passes after it. The other changed paths do network I/O and have no offline tests. Please rely on CI and the SonarCloud re-analysis to confirm the S7493 findings close. ## Summary by CodeRabbit * **Refactor** * File uploads and downloads, generated image saving, and credential-file cleanup now use asynchronous file operations. * When a local file can’t be read during a video upload, the existing fallback to downloading from the source URL remains in place. * Existing handling of file-read, write, and removal errors is preserved, including ignoring missing credential files. --- .../api_clients/artcraft/artcraft_client/Cargo.toml | 1 + .../legacy_upload_media_file_from_file.rs | 2 +- .../media_files/upload_image_media_file_from_file.rs | 2 +- .../media_files/upload_new_engine_asset_from_file.rs | 2 +- .../media_files/upload_video_media_file_from_file.rs | 2 +- .../src/recipes/download_media_file.rs | 10 +--------- .../api_clients/artcraft/artcraft_router/Cargo.toml | 2 +- .../generate_video/providers/kinovi/upload.rs | 2 +- .../src/credentials/credential_manager.rs | 2 +- .../deprecated/job_status/sora_job_status.rs | 12 ++++-------- 10 files changed, 13 insertions(+), 24 deletions(-) diff --git a/crates/api_clients/artcraft/artcraft_client/Cargo.toml b/crates/api_clients/artcraft/artcraft_client/Cargo.toml index 6987761299..4fa416b0aa 100644 --- a/crates/api_clients/artcraft/artcraft_client/Cargo.toml +++ b/crates/api_clients/artcraft/artcraft_client/Cargo.toml @@ -33,6 +33,7 @@ chrono.workspace = true cookie.workspace = true log.workspace = true reqwest = { workspace = true, features = ["multipart", "gzip"] } +tokio = { workspace = true, features = ["fs"] } url.workspace = true # Serialization diff --git a/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/legacy_upload_media_file_from_file.rs b/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/legacy_upload_media_file_from_file.rs index 9d0b0e1d59..964ec52c4a 100644 --- a/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/legacy_upload_media_file_from_file.rs +++ b/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/legacy_upload_media_file_from_file.rs @@ -60,7 +60,7 @@ pub async fn legacy_upload_media_file_from_file>( .build() .map_err(|err| StorytellerError::Client(ClientError::from(err)))?; - let file_bytes = std::fs::read(args.path.as_ref()) + let file_bytes = tokio::fs::read(args.path.as_ref()).await .map_err(|err| StorytellerError::Client(ClientError::from(err)))?; let file_name = args.path.as_ref().file_name() .and_then(|n| n.to_str()).unwrap_or("file").to_string(); diff --git a/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_image_media_file_from_file.rs b/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_image_media_file_from_file.rs index 70105963e9..39c9a6358f 100644 --- a/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_image_media_file_from_file.rs +++ b/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_image_media_file_from_file.rs @@ -69,7 +69,7 @@ pub async fn upload_image_media_file_from_file_with_idempotency_token>( let client = storyteller_client_builder(api_host) .build()?; - let file_bytes = std::fs::read(path.as_ref())?; + let file_bytes = tokio::fs::read(path.as_ref()).await?; let file_name = path.as_ref().file_name() .and_then(|n| n.to_str()).unwrap_or("file").to_string(); let mut form = Form::new() diff --git a/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_video_media_file_from_file.rs b/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_video_media_file_from_file.rs index 332a5464aa..d0864b126a 100644 --- a/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_video_media_file_from_file.rs +++ b/crates/api_clients/artcraft/artcraft_client/src/endpoints/media_files/upload_video_media_file_from_file.rs @@ -61,7 +61,7 @@ pub async fn upload_video_media_file_from_file>( let client = storyteller_client_builder(args.api_host) .build()?; - let file_bytes = std::fs::read(args.path.as_ref())?; + let file_bytes = tokio::fs::read(args.path.as_ref()).await?; let file_name = args.path.as_ref().file_name() .and_then(|n| n.to_str()).unwrap_or("file").to_string(); let mut form = Form::new() diff --git a/crates/api_clients/artcraft/artcraft_client/src/recipes/download_media_file.rs b/crates/api_clients/artcraft/artcraft_client/src/recipes/download_media_file.rs index a4eb3903b6..8c42250b13 100644 --- a/crates/api_clients/artcraft/artcraft_client/src/recipes/download_media_file.rs +++ b/crates/api_clients/artcraft/artcraft_client/src/recipes/download_media_file.rs @@ -1,5 +1,3 @@ -use std::fs; -use std::io::Write; use std::path::{Path, PathBuf}; use log::{info, warn}; @@ -68,13 +66,7 @@ pub async fn download_media_file>( let bytes = download_bytes(cdn_url).await?; // 4. Write to disk. - let mut file = fs::File::create(&output_path) - .map_err(|err| StorytellerError::Client(ClientError::IoError(err)))?; - - file.write_all(&bytes) - .map_err(|err| StorytellerError::Client(ClientError::IoError(err)))?; - - file.flush() + tokio::fs::write(&output_path, &bytes).await .map_err(|err| StorytellerError::Client(ClientError::IoError(err)))?; info!("Downloaded {} bytes to {:?}", bytes.len(), output_path); diff --git a/crates/api_clients/artcraft/artcraft_router/Cargo.toml b/crates/api_clients/artcraft/artcraft_router/Cargo.toml index 3fd929faee..8edabf415c 100644 --- a/crates/api_clients/artcraft/artcraft_router/Cargo.toml +++ b/crates/api_clients/artcraft/artcraft_router/Cargo.toml @@ -31,7 +31,7 @@ reqwest.workspace = true serde.workspace = true wreq.workspace = true serde_derive.workspace = true -tokio.workspace = true +tokio = { workspace = true, features = ["fs"] } uuid.workspace = true [dev-dependencies] diff --git a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/providers/kinovi/upload.rs b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/providers/kinovi/upload.rs index ae878a16a3..1900d0465b 100644 --- a/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/providers/kinovi/upload.rs +++ b/crates/api_clients/artcraft/artcraft_router/src/generate/generate_video/providers/kinovi/upload.rs @@ -24,7 +24,7 @@ pub(crate) async fn upload_to_kinovi_web( .unwrap_or_else(|| "jpg".to_string()); let file_bytes = match maybe_local_path { - Some(local_path) => match std::fs::read(local_path) { + Some(local_path) => match tokio::fs::read(local_path).await { Ok(bytes) => { info!("Reusing predownloaded file for kinovi upload: {}", source_url); bytes diff --git a/crates/api_clients/midjourney_client/src/credentials/credential_manager.rs b/crates/api_clients/midjourney_client/src/credentials/credential_manager.rs index 2909961236..fb9472a468 100644 --- a/crates/api_clients/midjourney_client/src/credentials/credential_manager.rs +++ b/crates/api_clients/midjourney_client/src/credentials/credential_manager.rs @@ -93,7 +93,7 @@ impl MidjourneyCredentialManager { let _guard = self.mutation.lock().await; // Remove every format, so a later startup cannot migrate a logged-out account. for path in self.legacy_paths.iter().chain([&self.credential_path]) { - match std::fs::remove_file(path) { + match tokio::fs::remove_file(path).await { Ok(()) => {}, Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}, Err(err) => return Err(err.into()), diff --git a/crates/api_clients/openai_sora_client/src/requests/deprecated/job_status/sora_job_status.rs b/crates/api_clients/openai_sora_client/src/requests/deprecated/job_status/sora_job_status.rs index fce3287c0c..5338d98de0 100644 --- a/crates/api_clients/openai_sora_client/src/requests/deprecated/job_status/sora_job_status.rs +++ b/crates/api_clients/openai_sora_client/src/requests/deprecated/job_status/sora_job_status.rs @@ -11,7 +11,7 @@ use errors::AnyhowResult; use log::{debug, error, warn}; use serde_derive::{Deserialize, Serialize}; use std::fmt::{Debug, Display}; -use std::{fs::File, io::Write, path::Path}; +use std::path::Path; use url::Url; use wreq::Client; @@ -271,9 +271,7 @@ pub async fn get_image_gen_status(status_request: &StatusRequest, credentials: & pub async fn save_generations_to_dir(generations: &[Generation], dir: &str) -> AnyhowResult<()> { let dir = Path::new(dir); - if !dir.exists() { - std::fs::create_dir_all(dir)?; - } + tokio::fs::create_dir_all(dir).await?; for generation in generations { let response = wreq::get(generation.url.clone()).send().await?; let image_bytes = response.bytes().await?; @@ -282,15 +280,13 @@ pub async fn save_generations_to_dir(generations: &[Generation], dir: &str) -> A let ext = url.path().split(".").last().unwrap_or("png"); let path = Path::new(dir).join(format!("{}.{}", generation.id, ext)); - let mut file = File::create(path)?; - file.write_all(&image_bytes)?; + tokio::fs::write(path, &image_bytes).await?; let thumbnail_url = generation.encodings.thumbnail.path.clone(); let thumbnail_response = wreq::get(thumbnail_url).send().await?; let thumbnail_bytes = thumbnail_response.bytes().await?; let thumbnail_path = Path::new(dir).join(format!("{}_thumbnail.{}", generation.id, ext)); - let mut thumbnail_file = File::create(thumbnail_path)?; - thumbnail_file.write_all(&thumbnail_bytes)?; + tokio::fs::write(thumbnail_path, &thumbnail_bytes).await?; } Ok(()) 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 09/24] 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 10/24] 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()); From 71adfd4701f7164bb7b527d27cecf24955cba02b Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 10 Nov 2026 21:35:11 +0100 Subject: [PATCH 11/24] artcraft app: mark fire-and-forget promises with void (Sonar S9383) (#2806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Resolves all 38 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 `frontend/apps/artcraft/app`, across 19 files. They are: - startup calls in `index.tsx`, such as `SyncStorytellerApiConfig()` and `persistLogin()` - polling in `useActiveJobs`, `useBackgroundLoadingMedia`, `signals/activeJobs.ts` and `signals/authentication/fetchers.ts` - listener cleanups (`unlisten*.then(f => f())`) in `TaskQueue` and `useDesktopGenerationFeed` - UI handlers that start uploads or renames, such as `ImageTo3DExperience`, `UploadFilesMedia`, `SceneTitleInput`, `ProfileDropdown` and `DesktopGenerationGallery` - async IIFEs in `useDesktopUsername`, `TaskQueue` and `BaseImageSelector` This is part 2 of 3 for artcraft's 157 S9383 findings. Part 1 (Tauri libraries) is #2805. Part 3 (`libs/components`) is #2807. Several of these files are also changed by open PRs for unrelated reasons, for example #2519, #2520, #2615 and #2064. Each change here inserts one word at the start of a statement, so a rebase either way is trivial. ## 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 * **Chores** * Updated background tasks across uploads, sign-in, polling, scene editing, and other app workflows to handle asynchronous operations consistently. * Existing workflows and their success and error handling remain unchanged; no user-facing behavior changes are expected. --- .../GlobalFileDropHandler.tsx | 2 +- .../components/experiences/ImageTo3DExperience.tsx | 8 ++++---- .../generation-feed/DesktopGenerationGallery.tsx | 2 +- .../generation-feed/useDesktopGenerationFeed.ts | 4 ++-- .../generation-feed/useDesktopUsername.ts | 2 +- .../reusable/UploadModalMedia/UploadFilesMedia.tsx | 2 +- .../components/signaled/TopBar/ProfileDropdown.tsx | 2 +- .../components/signaled/TopBar/SceneTitleInput.tsx | 2 +- .../src/components/signaled/TopBar/TaskQueue.tsx | 14 +++++++------- .../components/signaled/TopBar/taskEnqueueMeta.ts | 2 +- .../artcraft/app/src/hoc/withProtectedRoute.tsx | 2 +- .../app/src/hooks/useActiveJobs/useActiveJobs.ts | 6 +++--- .../useBackgroundLoadingMedia.tsx | 8 ++++---- frontend/apps/artcraft/app/src/index.tsx | 4 ++-- frontend/apps/artcraft/app/src/pages/MainApp.tsx | 2 +- .../app/src/pages/PageDraw/BaseImageSelector.tsx | 2 +- .../PageRemoveBackground/RemoveBackground.tsx | 2 +- .../apps/artcraft/app/src/signals/activeJobs.ts | 2 +- .../app/src/signals/authentication/fetchers.ts | 8 ++++---- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/frontend/apps/artcraft/app/src/components/GlobalFileDropHandler/GlobalFileDropHandler.tsx b/frontend/apps/artcraft/app/src/components/GlobalFileDropHandler/GlobalFileDropHandler.tsx index 368189837e..6eabbacd30 100644 --- a/frontend/apps/artcraft/app/src/components/GlobalFileDropHandler/GlobalFileDropHandler.tsx +++ b/frontend/apps/artcraft/app/src/components/GlobalFileDropHandler/GlobalFileDropHandler.tsx @@ -120,7 +120,7 @@ export function GlobalFileDropHandler() { } }; - setup(); + void setup(); return () => { unlisteners.forEach((fn) => fn()); }; } else { diff --git a/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx b/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx index 24d2fdc59d..3f0e4f3b7a 100644 --- a/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx +++ b/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx @@ -256,7 +256,7 @@ export const ImageTo3DExperience = ({ }; const handleFileChange = (event: React.ChangeEvent) => { - handleFiles(event.target.files); + void handleFiles(event.target.files); event.target.value = ""; }; @@ -264,7 +264,7 @@ export const ImageTo3DExperience = ({ event.preventDefault(); event.stopPropagation(); setDragActive(false); - handleFiles(event.dataTransfer?.files); + void handleFiles(event.dataTransfer?.files); }; const handlePickFromLibrary = () => { @@ -716,7 +716,7 @@ export const ImageTo3DExperience = ({ e.stopPropagation(); setDragActive(false); if (e.dataTransfer?.files) - handleWorldFiles( + void handleWorldFiles( Array.from(e.dataTransfer.files).filter((f) => f.type.startsWith("image/"), ), @@ -1177,7 +1177,7 @@ export const ImageTo3DExperience = ({ className="hidden" onChange={(e) => { if (e.target.files) { - handleWorldFiles(Array.from(e.target.files)); + void handleWorldFiles(Array.from(e.target.files)); } e.target.value = ""; }} diff --git a/frontend/apps/artcraft/app/src/components/generation-feed/DesktopGenerationGallery.tsx b/frontend/apps/artcraft/app/src/components/generation-feed/DesktopGenerationGallery.tsx index 327031844a..10cd58bc27 100644 --- a/frontend/apps/artcraft/app/src/components/generation-feed/DesktopGenerationGallery.tsx +++ b/frontend/apps/artcraft/app/src/components/generation-feed/DesktopGenerationGallery.tsx @@ -248,7 +248,7 @@ function ItemActions({ e.stopPropagation(); const url = item.fullImage || item.thumbnail; if (!url) return; - applyMakeVideoFromImage(url, item.id); + void applyMakeVideoFromImage(url, item.id); }, [item.fullImage, item.thumbnail, item.id], ); diff --git a/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopGenerationFeed.ts b/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopGenerationFeed.ts index e0923cbf03..0014c75238 100644 --- a/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopGenerationFeed.ts +++ b/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopGenerationFeed.ts @@ -295,8 +295,8 @@ export function useDesktopGenerationFeed(options: { cancelled = true; clearInterval(intervalId); window.removeEventListener("task-queue-update", handleTaskUpdate); - unlistenComplete.then((f) => f()); - unlistenFailed.then((f) => f()); + void unlistenComplete.then((f) => f()); + void unlistenFailed.then((f) => f()); }; }, [load]); diff --git a/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopUsername.ts b/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopUsername.ts index 444fe7d031..d3658dc4b6 100644 --- a/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopUsername.ts +++ b/frontend/apps/artcraft/app/src/components/generation-feed/useDesktopUsername.ts @@ -8,7 +8,7 @@ export function useDesktopUsername(): string | null { useEffect(() => { let cancelled = false; - (async () => { + void (async () => { try { const session = await new UsersApi().GetSession(); if (!cancelled && session.success && session.data?.user) { diff --git a/frontend/apps/artcraft/app/src/components/reusable/UploadModalMedia/UploadFilesMedia.tsx b/frontend/apps/artcraft/app/src/components/reusable/UploadModalMedia/UploadFilesMedia.tsx index 4fe4eaec30..8856eceec2 100644 --- a/frontend/apps/artcraft/app/src/components/reusable/UploadModalMedia/UploadFilesMedia.tsx +++ b/frontend/apps/artcraft/app/src/components/reusable/UploadModalMedia/UploadFilesMedia.tsx @@ -48,7 +48,7 @@ export const UploadFilesMedia = ({ return; } - uploadPlane({ + void uploadPlane({ title: uploadTitle.value, assetFile: assetFile.value, progressCallback: onUploadProgress, diff --git a/frontend/apps/artcraft/app/src/components/signaled/TopBar/ProfileDropdown.tsx b/frontend/apps/artcraft/app/src/components/signaled/TopBar/ProfileDropdown.tsx index 459a5b086b..be6f1b5faa 100644 --- a/frontend/apps/artcraft/app/src/components/signaled/TopBar/ProfileDropdown.tsx +++ b/frontend/apps/artcraft/app/src/components/signaled/TopBar/ProfileDropdown.tsx @@ -26,7 +26,7 @@ export default function ProfileDropdown() { label: "Logout", icon: LogOutIcon, onClick: () => { - logout(); + void logout(); }, }, ]; diff --git a/frontend/apps/artcraft/app/src/components/signaled/TopBar/SceneTitleInput.tsx b/frontend/apps/artcraft/app/src/components/signaled/TopBar/SceneTitleInput.tsx index 1dd589e2b1..2120bd4b0e 100644 --- a/frontend/apps/artcraft/app/src/components/signaled/TopBar/SceneTitleInput.tsx +++ b/frontend/apps/artcraft/app/src/components/signaled/TopBar/SceneTitleInput.tsx @@ -67,7 +67,7 @@ export const SceneTitleInput = ({ pageName }: Props) => { e.currentTarget.focus(); } else if (scene.value.token) { setIsSaving(true); - renameScene( + void renameScene( scene.value.title!, //guarunteed by input scene.value.token, ); diff --git a/frontend/apps/artcraft/app/src/components/signaled/TopBar/TaskQueue.tsx b/frontend/apps/artcraft/app/src/components/signaled/TopBar/TaskQueue.tsx index b710abc9f3..3d928c87b2 100644 --- a/frontend/apps/artcraft/app/src/components/signaled/TopBar/TaskQueue.tsx +++ b/frontend/apps/artcraft/app/src/components/signaled/TopBar/TaskQueue.tsx @@ -164,7 +164,7 @@ const CopyPromptButton = ({ prompt }: { prompt: string }) => { aria-label="Copy prompt" onClick={(e) => { e.stopPropagation(); - navigator.clipboard.writeText(prompt); + void navigator.clipboard.writeText(prompt); setCopied(true); setTimeout(() => setCopied(false), 3000); }} @@ -869,7 +869,7 @@ export const TaskQueue = () => { }; cleanupOldEntries(); - load(); + void load(); const id = setInterval(load, 5000); // Listen for cover image uploads to refresh and show new thumbnails @@ -883,17 +883,17 @@ export const TaskQueue = () => { let unlistenComplete: Promise | null = null; let unlistenFailed: Promise | null = null; - (async () => { + void (async () => { // Update immediately when Tauri signals a generation completion unlistenComplete = listen("generation-complete-event", () => { if (!cancelled) { - load(); + void load(); } }); // Also update immediately when a generation fails unlistenFailed = listen("generation-failed-event", () => { if (!cancelled) { - load(); + void load(); // Refunded credits may take a moment to settle in the database setTimeout(() => { useCreditsState.getState().fetchFromServer(); @@ -906,10 +906,10 @@ export const TaskQueue = () => { clearInterval(id); window.removeEventListener("cover-image-uploaded", handleCoverUploaded); if (unlistenComplete) { - unlistenComplete.then((f) => f()); + void unlistenComplete.then((f) => f()); } if (unlistenFailed) { - unlistenFailed.then((f) => f()); + void unlistenFailed.then((f) => f()); } }; }, [ diff --git a/frontend/apps/artcraft/app/src/components/signaled/TopBar/taskEnqueueMeta.ts b/frontend/apps/artcraft/app/src/components/signaled/TopBar/taskEnqueueMeta.ts index 567ced7a99..331ad08938 100644 --- a/frontend/apps/artcraft/app/src/components/signaled/TopBar/taskEnqueueMeta.ts +++ b/frontend/apps/artcraft/app/src/components/signaled/TopBar/taskEnqueueMeta.ts @@ -125,7 +125,7 @@ export function storeEnqueueMeta(meta: EnqueueMeta) { // Then convert blob URLs to base64 in the background for persistence if (meta.refImageUrls && meta.refImageUrls.length > 0) { - Promise.all(meta.refImageUrls.map(toBase64Thumb)).then((dataUrls) => { + void Promise.all(meta.refImageUrls.map(toBase64Thumb)).then((dataUrls) => { const current = readEntries(); const found = current.find((e) => e.id === entryId); if (found) { diff --git a/frontend/apps/artcraft/app/src/hoc/withProtectedRoute.tsx b/frontend/apps/artcraft/app/src/hoc/withProtectedRoute.tsx index 5e96ed0bf2..16ea97db39 100644 --- a/frontend/apps/artcraft/app/src/hoc/withProtectedRoute.tsx +++ b/frontend/apps/artcraft/app/src/hoc/withProtectedRoute.tsx @@ -12,7 +12,7 @@ export const withProtectionRoute =

( function ProtectionRoute(rest: P) { useSignals(); useSignalEffect(() => { - persistLogin(); + void persistLogin(); }); // const { status, userInfo } = authentication; diff --git a/frontend/apps/artcraft/app/src/hooks/useActiveJobs/useActiveJobs.ts b/frontend/apps/artcraft/app/src/hooks/useActiveJobs/useActiveJobs.ts index b667c7179d..e0cc622a91 100644 --- a/frontend/apps/artcraft/app/src/hooks/useActiveJobs/useActiveJobs.ts +++ b/frontend/apps/artcraft/app/src/hooks/useActiveJobs/useActiveJobs.ts @@ -38,7 +38,7 @@ export const useActiveJobs = () => { // then set new one with new interval clearInterval(curr.timer); const newTimer = setInterval(() => { - PollRecentJobs(); + void PollRecentJobs(); }, newTimeInterval); return { timer: newTimer, @@ -72,7 +72,7 @@ export const useActiveJobs = () => { useSignalEffect(() => { // if active jobs is not initiated, do do a first pull; if (!activeJobs.value) { - PollRecentJobs(); + void PollRecentJobs(); return; } // if there are no active jobs, stop making polls @@ -115,7 +115,7 @@ export const useActiveJobs = () => { //else make and set timer const newTimer = setInterval(() => { - PollRecentJobs(); + void PollRecentJobs(); }, curr.interval); return { ...curr, diff --git a/frontend/apps/artcraft/app/src/hooks/useBackgroundLoadingMedia/useBackgroundLoadingMedia.tsx b/frontend/apps/artcraft/app/src/hooks/useBackgroundLoadingMedia/useBackgroundLoadingMedia.tsx index 27099abf18..f06ecc6081 100644 --- a/frontend/apps/artcraft/app/src/hooks/useBackgroundLoadingMedia/useBackgroundLoadingMedia.tsx +++ b/frontend/apps/artcraft/app/src/hooks/useBackgroundLoadingMedia/useBackgroundLoadingMedia.tsx @@ -24,7 +24,7 @@ export const useBackgroundLoadingMedia = () => { //CASE 1: first load // if myMovies undefined, poll for the first time if (!userMovies.value) { - PollUserGeneratedMovies(); + void PollUserGeneratedMovies(); return; } @@ -45,7 +45,7 @@ export const useBackgroundLoadingMedia = () => { //there are videos newly completed, set and poll lastCompletedWorkflow.current = completedWorkflowJobs.value; - PollUserGeneratedMovies().then((ret: boolean) => { + void PollUserGeneratedMovies().then((ret: boolean) => { if (ret) { addToast( ToastTypes.SUCCESS, @@ -60,7 +60,7 @@ export const useBackgroundLoadingMedia = () => { //CASE 1: first load // if audioItems undefined, poll for the first time if (!userAudioItems.value) { - PollUserAudioItems(); + void PollUserAudioItems(); return; } @@ -82,7 +82,7 @@ export const useBackgroundLoadingMedia = () => { //there are audio jobs newly completed, set and poll lastCompletedAudioJobs.current = completedAudioJobs.value; - PollUserAudioItems().then((ret: boolean) => { + void PollUserAudioItems().then((ret: boolean) => { if (ret) { addToast( ToastTypes.SUCCESS, diff --git a/frontend/apps/artcraft/app/src/index.tsx b/frontend/apps/artcraft/app/src/index.tsx index 6c433fccf7..8564d92080 100644 --- a/frontend/apps/artcraft/app/src/index.tsx +++ b/frontend/apps/artcraft/app/src/index.tsx @@ -26,12 +26,12 @@ const ENV = { const GlobalSettingsManager = ({ env }: { env: Record }) => { console.log("GlobalSettingsManager()"); - SyncStorytellerApiConfig(); + void SyncStorytellerApiConfig(); useSignals(); useSignalEffect(() => { - persistLogin(); + void persistLogin(); }); /// Initizations that depends on ENV vars /// diff --git a/frontend/apps/artcraft/app/src/pages/MainApp.tsx b/frontend/apps/artcraft/app/src/pages/MainApp.tsx index b35bebd13a..175fefe5ee 100644 --- a/frontend/apps/artcraft/app/src/pages/MainApp.tsx +++ b/frontend/apps/artcraft/app/src/pages/MainApp.tsx @@ -152,7 +152,7 @@ export const MainApp = ({ sceneToken }: Props) => { // Session probe (runs once per shell mount). useEffect(() => { const usersApi = new UsersApi(); - usersApi.GetSession().then((result) => { + void usersApi.GetSession().then((result) => { console.log( `User Info | Username: ${result.data?.user?.username}, Token: ${result.data?.user?.user_token}`, ); diff --git a/frontend/apps/artcraft/app/src/pages/PageDraw/BaseImageSelector.tsx b/frontend/apps/artcraft/app/src/pages/PageDraw/BaseImageSelector.tsx index 39a18ab615..e4ecd13384 100644 --- a/frontend/apps/artcraft/app/src/pages/PageDraw/BaseImageSelector.tsx +++ b/frontend/apps/artcraft/app/src/pages/PageDraw/BaseImageSelector.tsx @@ -84,7 +84,7 @@ export const BaseImageSelector = ({ progressCallback: (newState) => { if (newState.status === UploaderStates.success && newState.data) { const mediaToken = newState.data || ""; - (async () => { + void (async () => { let finalUrl = reader.result as string; let thumbnailUrlTemplate = undefined; try { diff --git a/frontend/apps/artcraft/app/src/pages/PageRemoveBackground/RemoveBackground.tsx b/frontend/apps/artcraft/app/src/pages/PageRemoveBackground/RemoveBackground.tsx index 503b928c82..75616bf9f3 100644 --- a/frontend/apps/artcraft/app/src/pages/PageRemoveBackground/RemoveBackground.tsx +++ b/frontend/apps/artcraft/app/src/pages/PageRemoveBackground/RemoveBackground.tsx @@ -148,7 +148,7 @@ export const RemoveBackground = () => { } }; - processExternalUrl(); + void processExternalUrl(); }, [ pendingExternalUrl, setPendingExternalUrl, diff --git a/frontend/apps/artcraft/app/src/signals/activeJobs.ts b/frontend/apps/artcraft/app/src/signals/activeJobs.ts index 60c5ad6992..c1e5673aad 100644 --- a/frontend/apps/artcraft/app/src/signals/activeJobs.ts +++ b/frontend/apps/artcraft/app/src/signals/activeJobs.ts @@ -87,7 +87,7 @@ export const completedAudioJobs = computed(() => { export const shouldPollActiveJobs = signal(false); export const startPollingActiveJobs = () => { - PollRecentJobs(); //poll once regardless of polling intervals + void PollRecentJobs(); //poll once regardless of polling intervals shouldPollActiveJobs.value = true; }; diff --git a/frontend/apps/artcraft/app/src/signals/authentication/fetchers.ts b/frontend/apps/artcraft/app/src/signals/authentication/fetchers.ts index 68e49b7d48..b6f1e3cb8b 100644 --- a/frontend/apps/artcraft/app/src/signals/authentication/fetchers.ts +++ b/frontend/apps/artcraft/app/src/signals/authentication/fetchers.ts @@ -47,7 +47,7 @@ export const login = async ({ // technically user is login with the system now, HOWEVER, // in storyteller studio, only having a sesison is not enough, // we need session info and active subscription info as well - getUserInfoAndSubcriptions(); + void getUserInfoAndSubcriptions(); window.location.href = "/"; // TODO(bt,2025-04-19): Once we have in-page routing, get rid of this. }; @@ -86,7 +86,7 @@ export const signUp = async ({ // technically user is login with the system now, HOWEVER, // in storyteller studio, only having a sesison is not enough, // we need session info and active subscription info as well - getUserInfoAndSubcriptions(); + void getUserInfoAndSubcriptions(); return ""; }; @@ -95,12 +95,12 @@ export const persistLogin = async () => { if (authentication.status.value !== AUTH_STATUS.INIT) { return; } - getUserInfoAndSubcriptions(); + void getUserInfoAndSubcriptions(); }; // NB: Only for SyncStorytellerApiConfig. export const forceGetUserInfoAndSubcriptions = async () => { - getUserInfoAndSubcriptions(); + void getUserInfoAndSubcriptions(); }; async function getUserInfoAndSubcriptions() { From f9f4c99e4f7fa1ca4c5bcca55f770133ded53e0d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 10 Nov 2026 20:22:36 -0500 Subject: [PATCH 12/24] frontend: Sonar reliability fixes (promises in conditions, async executors, identical branches, reduce, regex) (#2821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clears 51 open TypeScript issues. Typecheck and build are left to CI. **typescript:S6544 (17)** - A cached promise checked by truthiness (`if (existing)`, `if (cached)`, `if (ammoLoadPromise)`…) is checked as `!== undefined` / `!== null` against its map or field type. Same branches, since a Promise is always truthy. - `scene.ts` `load_glb_wrapped_no_cors` / `load_splat_wrapped_no_cors`: the fetch moves out of the `async` Promise executor. The methods were already `async`, so a failed fetch now `throw`s (rejects the same way), and only the callback APIs (`GLTFLoader.parse`, `SplatMesh` `onLoad`) stay inside `new Promise`. - `SceneManagerAPI` declares the promises its implementation returns (`create`/`retrieve` → `Promise`, `update`/`delete` → `Promise`). Nothing calls through the interface. - `convertFbxToGlb.worker.ts`: `onmessage` calls `void convert(event)`. **typescript:S3923 / S1764 / S3516 / S905 (12)**: identical branches collapsed (`variant === "world" ? "max-w-[1600px]" : "max-w-[1600px]"`, `ScissorIcon : ScissorIcon`, `index % 2 === 0 ? point + offset : point + offset`, PromptBox3D's two `setIsEnqueueing(false); return;` arms, `{DEFAULT_GRID_CONFIG ? null : null}` and its now-unused import), `x && x`, the `this.gridHelper;` statement, and `CurrentUserBadge`, which always rendered `null` (its markup was commented out). **typescript:S6959 (5)**: each `reduce` starts from the first element. Every one is behind an emptiness check, and comparing the first element with itself keeps it. **typescript:S2871 (4)**: `sort((a, b) => a.localeCompare(b))` for the order-independent cache keys and the board and font name lists. **typescript:S8786 (8)** - Markdown link text is `[^\][]+`. `@image(url, size)` drops the `\s*` before the size (it's `.trim()`ed already). ATX headings `trimStart()` the text instead of `\s*`. Slugs trim one `-` (runs were already collapsed to one). - `color.ts` `stripCssNoise`: `!important` is replaced by a space, then trailing `;` are trimmed in a loop. - Data-URL mime: `/:([^;]*);/`. - `ControlPanelSceneObject` number check: `/^-?\d*(\.\d*)?$/`. The old `.` was unescaped and matched any character, so `12a3` passed as a number. **Others**: `window.open(…, "noopener,noreferrer")` (S5148). `AlertTitle` renders `children` explicitly (S6850). The folder name hash wraps with `Math.imul(…, 1)` instead of `| 0`, the same int32 result (S7767). `autoFocus` is removed from the two rename inputs, which their refs already focus and select (S9379). **Not here**: S7059 in `editor.ts` (`ensureAmmoLoaded()` in the constructor) is on a line #2807 changes. ## Summary by CodeRabbit * **Bug Fixes** * Improved reliability when loading 3D scene assets and completing drag-and-drop operations. * Corrected numeric input validation, scene import handling, and video duration tie handling. * Improved media, audio, and video cache handling to avoid unnecessary retries or missed waits. * Refined markdown parsing for links, headings, image directives, and heading anchors. * Discord invites now open with additional browser protections. * Improved CSS color cleanup and handling of pasted scene elements. * **Improvements** * Made ordering of tags, fonts, and prompt-related items more consistent. * Improved video editor timeline selections. * Removed the non-functional account badge from the video editor header. **typescript:S1848 (2)**: `new SplatMesh({ …, onLoad })` created an instance only for its callback. `scene.ts` now awaits `mesh.initialized` (Spark's promise, which resolves after load), so a failed load rejects instead of leaving the promise pending. `viewer-3d.tsx` runs the same body in `initialized.then`, with a `.catch` that logs. Kept as is: `TabState.setActiveTab` still resolves `true` (S3516 stays open), because `TabState.spec.ts` and the tab-change benchmark read its result. --- .../experiences/ImageTo3DExperience.tsx | 4 +- .../src/lib/button-dropdown.tsx | 2 +- .../src/lib/FolderNameDialog.tsx | 1 - .../gallery-modal/src/lib/gallery-modal.tsx | 3 +- .../src/lib/media-prompt-token-cache.ts | 2 +- .../generation-list/src/lib/prompts-cache.ts | 2 +- .../login-modal/src/lib/login-modal.tsx | 2 +- .../src/lib/boards/boardSelectors.ts | 2 +- .../pagedraw/src/lib/stores/SceneState.ts | 6 +- .../pagescene/src/lib/DragAndDrop/DndAsset.ts | 2 +- .../ControlPanelSceneObject.tsx | 2 +- .../pagescene/src/lib/engine/ammoLoader.ts | 2 +- .../pagescene/src/lib/engine/scene.ts | 67 ++++++++----------- .../src/lib/engine/scene_manager_api.ts | 12 ++-- .../promptbox/src/lib/PromptBox3D.tsx | 10 +-- .../utilities/convertFbxToGlb.worker.ts | 6 +- .../lib/commands/timeline/clipboard/paste.ts | 6 +- .../lib/components/editor/editor-header.tsx | 17 ----- .../src/lib/components/ui/alert.tsx | 6 +- .../src/lib/core/managers/audio-manager.ts | 4 +- .../src/lib/fonts/google-fonts.ts | 2 +- .../src/lib/fonts/use-font-atlas.ts | 4 +- .../src/lib/guides/definitions/grid.tsx | 4 -- .../src/lib/preview/preview-snap.ts | 8 ++- .../lib/services/renderer/nodes/image-node.ts | 2 +- .../services/renderer/nodes/sticker-node.ts | 2 +- .../src/lib/services/video-cache/service.ts | 4 +- .../lib/services/waveform-cache/service.ts | 2 +- .../timeline/components/timeline-element.tsx | 9 +-- .../src/lib/timeline/placement/main-track.ts | 2 +- .../video-editor/src/lib/utils/color.ts | 6 +- .../viewer-3d/src/lib/viewer-3d.tsx | 11 +-- .../src/lib/utils/markdown.ts | 10 +-- .../src/lib/classes/videoOptions.ts | 2 +- 34 files changed, 97 insertions(+), 129 deletions(-) diff --git a/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx b/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx index 3f0e4f3b7a..973ac36977 100644 --- a/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx +++ b/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx @@ -944,7 +944,7 @@ export const ImageTo3DExperience = ({

@@ -1111,7 +1111,7 @@ export const ImageTo3DExperience = ({
{option.label}
- {option.description && option.description} + {option.description}
{showSelected && ( <> diff --git a/frontend/libs/components/gallery-modal/src/lib/FolderNameDialog.tsx b/frontend/libs/components/gallery-modal/src/lib/FolderNameDialog.tsx index 8e232b85ae..26b006c461 100644 --- a/frontend/libs/components/gallery-modal/src/lib/FolderNameDialog.tsx +++ b/frontend/libs/components/gallery-modal/src/lib/FolderNameDialog.tsx @@ -64,7 +64,6 @@ export const FolderNameDialog: React.FC = ({ if (e.key === "Enter") submit(); }} className="w-full rounded-[3px] border border-ui-panel-border bg-ui-controls/40 px-3 py-1.5 text-sm text-base-fg outline-none focus:ring-1 focus:ring-primary/50" - autoFocus />
@@ -47,21 +45,6 @@ export function EditorHeader({ endSlot, exitTo = "/projects" }: EditorHeaderProp ); } -function CurrentUserBadge() { - const { authUser } = useEditorAdapters(); - const user = useAuthUser(authUser); - if (!user) return null; - return ( - // - // {user.displayName} - // - null - ); -} - function ProjectDropdown({ exitTo }: { exitTo: string }) { const [openDialog, setOpenDialog] = useState< "delete" | "rename" | "shortcuts" | null diff --git a/frontend/libs/components/video-editor/src/lib/components/ui/alert.tsx b/frontend/libs/components/video-editor/src/lib/components/ui/alert.tsx index cfcf4cbc84..84c4a648d4 100644 --- a/frontend/libs/components/video-editor/src/lib/components/ui/alert.tsx +++ b/frontend/libs/components/video-editor/src/lib/components/ui/alert.tsx @@ -44,7 +44,7 @@ Alert.displayName = "Alert"; const AlertTitle = React.forwardRef< HTMLParagraphElement, React.HTMLAttributes ->(({ className, ...props }, ref) => ( +>(({ className, children, ...props }, ref) => (
+ > + {children} +
)); AlertTitle.displayName = "AlertTitle"; diff --git a/frontend/libs/components/video-editor/src/lib/core/managers/audio-manager.ts b/frontend/libs/components/video-editor/src/lib/core/managers/audio-manager.ts index 8f0aaea5a0..85a7e00054 100644 --- a/frontend/libs/components/video-editor/src/lib/core/managers/audio-manager.ts +++ b/frontend/libs/components/video-editor/src/lib/core/managers/audio-manager.ts @@ -539,7 +539,7 @@ export class AudioManager { }): Promise { const cacheKey = this.buildPreparedClipCacheKey({ clip }); const existing = this.preparedClipBuffers.get(cacheKey); - if (existing) { + if (existing !== undefined) { return existing; } @@ -574,7 +574,7 @@ export class AudioManager { clip: AudioClipSource; }): Promise { const existing = this.decodedBuffers.get(clip.sourceKey); - if (existing) { + if (existing !== undefined) { return existing; } diff --git a/frontend/libs/components/video-editor/src/lib/fonts/google-fonts.ts b/frontend/libs/components/video-editor/src/lib/fonts/google-fonts.ts index d3303c6b06..fa537feb4c 100644 --- a/frontend/libs/components/video-editor/src/lib/fonts/google-fonts.ts +++ b/frontend/libs/components/video-editor/src/lib/fonts/google-fonts.ts @@ -26,7 +26,7 @@ export function clearFontAtlasCache(): void { export function loadFontAtlas(): Promise { if (cachedAtlas) return Promise.resolve(cachedAtlas); - if (atlasFetchPromise) return atlasFetchPromise; + if (atlasFetchPromise !== null) return atlasFetchPromise; atlasFetchPromise = fetch(FONT_ATLAS_PATH) .then(async (response) => { diff --git a/frontend/libs/components/video-editor/src/lib/fonts/use-font-atlas.ts b/frontend/libs/components/video-editor/src/lib/fonts/use-font-atlas.ts index cb71f70c3d..a4d7fc12ae 100644 --- a/frontend/libs/components/video-editor/src/lib/fonts/use-font-atlas.ts +++ b/frontend/libs/components/video-editor/src/lib/fonts/use-font-atlas.ts @@ -46,7 +46,9 @@ export function useFontAtlas({ open }: { open: boolean }) { const fontNames = useMemo(() => { if (!atlas) return []; - return [...Object.keys(atlas.fonts), ...SYSTEM_FONTS].sort(); + return [...Object.keys(atlas.fonts), ...SYSTEM_FONTS].sort((a, b) => + a.localeCompare(b), + ); }, [atlas]); return { atlas, status, fontNames, retry }; diff --git a/frontend/libs/components/video-editor/src/lib/guides/definitions/grid.tsx b/frontend/libs/components/video-editor/src/lib/guides/definitions/grid.tsx index afa74a773a..e957301e35 100644 --- a/frontend/libs/components/video-editor/src/lib/guides/definitions/grid.tsx +++ b/frontend/libs/components/video-editor/src/lib/guides/definitions/grid.tsx @@ -7,7 +7,6 @@ import { HugeiconsIcon } from "@hugeicons/react"; import { GRID_MIN, GRID_MAX, - DEFAULT_GRID_CONFIG, } from "../grid"; import { usePreviewStore } from "../../preview/preview-store"; import { clampRound } from "../../utils/math"; @@ -113,9 +112,6 @@ function GridGuideOptions() { }} /> - {/* Acknowledge DEFAULT_GRID_CONFIG so the reset import stays parked - for when NumberField (with its onReset affordance) is ported. */} - {DEFAULT_GRID_CONFIG ? null : null}
); } diff --git a/frontend/libs/components/video-editor/src/lib/preview/preview-snap.ts b/frontend/libs/components/video-editor/src/lib/preview/preview-snap.ts index 48bc5f2767..11ed819659 100644 --- a/frontend/libs/components/video-editor/src/lib/preview/preview-snap.ts +++ b/frontend/libs/components/video-editor/src/lib/preview/preview-snap.ts @@ -75,7 +75,7 @@ function pickClosestScaleCandidate - current.distance < closest.distance ? current : closest, + return snapCandidatesWithinThreshold.reduce( + (closest, current) => + current.distance < closest.distance ? current : closest, + snapCandidatesWithinThreshold[0], ); } diff --git a/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/image-node.ts b/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/image-node.ts index c64e9809e1..67f6d18e3f 100644 --- a/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/image-node.ts +++ b/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/image-node.ts @@ -35,7 +35,7 @@ export function loadImageSource({ const cacheKey = `${url}::${maxSourceSize ?? "full"}`; const cached = imageSourceCache.get(cacheKey); - if (cached) return cached; + if (cached !== undefined) return cached; const promise = (async (): Promise => { const image = new Image(); diff --git a/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/sticker-node.ts b/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/sticker-node.ts index 6a15d04c79..ceb23a9108 100644 --- a/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/sticker-node.ts +++ b/frontend/libs/components/video-editor/src/lib/services/renderer/nodes/sticker-node.ts @@ -25,7 +25,7 @@ export function loadStickerSource({ stickerId: string; }): Promise { const cached = stickerSourceCache.get(stickerId); - if (cached) return cached; + if (cached !== undefined) return cached; const promise = (async (): Promise => { const url = resolveStickerId({ diff --git a/frontend/libs/components/video-editor/src/lib/services/video-cache/service.ts b/frontend/libs/components/video-editor/src/lib/services/video-cache/service.ts index 01f230698e..e32326c32f 100644 --- a/frontend/libs/components/video-editor/src/lib/services/video-cache/service.ts +++ b/frontend/libs/components/video-editor/src/lib/services/video-cache/service.ts @@ -170,7 +170,7 @@ export class VideoCache { try { while (true) { - if (sinkData.prefetching && sinkData.prefetchPromise) { + if (sinkData.prefetching && sinkData.prefetchPromise !== null) { await sinkData.prefetchPromise; } @@ -215,7 +215,7 @@ export class VideoCache { time: number; }): Promise { try { - if (sinkData.prefetching && sinkData.prefetchPromise) { + if (sinkData.prefetching && sinkData.prefetchPromise !== null) { await sinkData.prefetchPromise; } diff --git a/frontend/libs/components/video-editor/src/lib/services/waveform-cache/service.ts b/frontend/libs/components/video-editor/src/lib/services/waveform-cache/service.ts index 59fbb914e8..48da5f0d89 100644 --- a/frontend/libs/components/video-editor/src/lib/services/waveform-cache/service.ts +++ b/frontend/libs/components/video-editor/src/lib/services/waveform-cache/service.ts @@ -27,7 +27,7 @@ export class WaveformCache { audioUrl, }: GetSourceWaveformSummaryArgs): Promise { const existing = this.summaries.get(sourceKey); - if (existing) { + if (existing !== undefined) { return existing; } diff --git a/frontend/libs/components/video-editor/src/lib/timeline/components/timeline-element.tsx b/frontend/libs/components/video-editor/src/lib/timeline/components/timeline-element.tsx index 6a1342b583..9126806e74 100644 --- a/frontend/libs/components/video-editor/src/lib/timeline/components/timeline-element.tsx +++ b/frontend/libs/components/video-editor/src/lib/timeline/components/timeline-element.tsx @@ -47,7 +47,6 @@ import { mediaSupportsAudio } from "../../media/media-utils"; import { canToggleSourceAudio, getSourceAudioActionLabel, - isSourceAudioSeparated, } from "../audio-separation"; import { buildWaveformGainSamples, isElementMuted } from "../audio-state"; import { getTimelinePixelsPerSecond } from "../pixel-utils"; @@ -346,8 +345,6 @@ export function TimelineElement({ element.type === "video" ? getSourceAudioActionLabel({ element }) : "Extract audio"; - const isElementSourceAudioSeparated = - element.type === "video" && isSourceAudioSeparated({ element }); const hasKeyframes = elementKeyframes.length > 0; const expansionHeight = getExpansionHeight({ rows: expandedRows }); const baseTrackHeight = getTrackHeight({ type: track.type }); @@ -450,11 +447,7 @@ export function TimelineElement({ {canToggleCurrentSourceAudio && ( + } onClick={(event: React.MouseEvent) => { event.stopPropagation(); diff --git a/frontend/libs/components/video-editor/src/lib/timeline/placement/main-track.ts b/frontend/libs/components/video-editor/src/lib/timeline/placement/main-track.ts index a3c6152614..5a46d56534 100644 --- a/frontend/libs/components/video-editor/src/lib/timeline/placement/main-track.ts +++ b/frontend/libs/components/video-editor/src/lib/timeline/placement/main-track.ts @@ -26,7 +26,7 @@ export function getEarliestMainTrackElement({ return element.startTime < earliestElement.startTime ? element : earliestElement; - }); + }, elements[0]); } export function enforceMainTrackStart({ diff --git a/frontend/libs/components/video-editor/src/lib/utils/color.ts b/frontend/libs/components/video-editor/src/lib/utils/color.ts index a792894150..20839ed74a 100644 --- a/frontend/libs/components/video-editor/src/lib/utils/color.ts +++ b/frontend/libs/components/video-editor/src/lib/utils/color.ts @@ -54,10 +54,8 @@ export function appendAlpha({ function stripCssNoise({ text }: { text: string }): string { let cleaned = text.trim(); - cleaned = cleaned - .replace(/\s*!important\s*/gi, "") - .replace(/;+\s*$/, "") - .trim(); + cleaned = cleaned.replace(/!important/gi, " ").trim(); + while (cleaned.endsWith(";")) cleaned = cleaned.slice(0, -1).trimEnd(); const colonIndex = cleaned.indexOf(":"); const parenIndex = cleaned.indexOf("("); diff --git a/frontend/libs/components/viewer-3d/src/lib/viewer-3d.tsx b/frontend/libs/components/viewer-3d/src/lib/viewer-3d.tsx index 0ddde8f2ce..a3808f86b8 100644 --- a/frontend/libs/components/viewer-3d/src/lib/viewer-3d.tsx +++ b/frontend/libs/components/viewer-3d/src/lib/viewer-3d.tsx @@ -408,9 +408,8 @@ export function Viewer3D({ if (SPLAT_EXTENSIONS.includes(urlExtension)) { console.log(`[Viewer3D] splat format detected (.${urlExtension})`); - new SplatMesh({ - url: modelUrl, - onLoad: (mesh) => { + void new SplatMesh({ url: modelUrl }).initialized + .then((mesh) => { if (cancelled) { mesh.dispose(); return; @@ -434,8 +433,10 @@ export function Viewer3D({ } console.log("Splat loaded"); - }, - }); + }) + .catch((error) => + console.error("[Viewer3D] splat load failed:", error), + ); } else if (!GLTF_EXTENSIONS.includes(urlExtension)) { // Known non-glTF model format with no loader wired here (obj, fbx, // pmx, …). Show the fallback shape rather than spamming a parse error. diff --git a/frontend/libs/markdown-content/src/lib/utils/markdown.ts b/frontend/libs/markdown-content/src/lib/utils/markdown.ts index a50469bc47..c240865e5d 100644 --- a/frontend/libs/markdown-content/src/lib/utils/markdown.ts +++ b/frontend/libs/markdown-content/src/lib/utils/markdown.ts @@ -143,7 +143,7 @@ export const markdownToHtml = ( return renderImage(safeUrl, alt, size); }); // links: [text](url) - out = out.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => { + out = out.replace(/\[([^\][]+)\]\(([^)]+)\)/g, (_m, label, url) => { const safeLabel = String(label || "").replace(/"/g, """); const safeUrl = normalizeLink(String(url || "")); return `${safeLabel}`; @@ -220,7 +220,7 @@ export const markdownToHtml = ( // Image/GIF embed: @image(url, size) or @gif(url, size) const imageMatch = ltrim.match( - /^@(image|gif)\(([^,)]+)(?:,\s*([^)]+))?\)\s*$/, + /^@(image|gif)\(([^,)]+)(?:,([^)]+))?\)\s*$/, ); if (imageMatch) { flushParagraph(); @@ -232,12 +232,12 @@ export const markdownToHtml = ( } // ATX headings: support #..###### with optional space after hashes - const heading = ltrim.match(/^(#{1,6})\s*(.*)$/); + const heading = ltrim.match(/^(#{1,6})(.*)$/); if (heading) { flushParagraph(); closeListIfOpen(); const level = Math.min(heading[1].length, 6); - const text = renderInline(heading[2] || ""); + const text = renderInline((heading[2] || "").trimStart()); htmlParts.push(`${text}`); continue; } @@ -318,7 +318,7 @@ export const slugify = (s: string): string => .replace(/[_\s]+/g, "-") .replace(/[^a-z0-9-]/g, "") .replace(/--+/g, "-") - .replace(/^-+|-+$/g, ""); + .replace(/^-|-$/g, ""); export const pathToFilename = (path: string): string => { const parts = path.split("/"); diff --git a/frontend/libs/model-list/src/lib/classes/videoOptions.ts b/frontend/libs/model-list/src/lib/classes/videoOptions.ts index 7657fb5c05..76d07dd229 100644 --- a/frontend/libs/model-list/src/lib/classes/videoOptions.ts +++ b/frontend/libs/model-list/src/lib/classes/videoOptions.ts @@ -70,7 +70,7 @@ export function resolveVideoDuration( (distance === bestDistance && option > best) ? option : best; - }); + }, model.durationOptions[0]); } return model.defaultDuration ?? null; } From 8d6fc363b12106bffc23f0ea28a4bf40f9edb944 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 10 Nov 2026 20:22:41 -0500 Subject: [PATCH 13/24] frontend: roles, keyboard access and label association (Sonar S6848, S6853) (#2822) Clears the 59 open typescript:S6848 issues ("non-native interactive element without a role"). - **Clickable things that act like buttons (16)**: upload and preview tiles, storyboard frames, help items, reference thumbnails, remove buttons, deck cards, asset items, popover menu items. They get `role="button"`, `tabIndex={0}` and `onKeyDown={clickOnEnterOrSpace}`, the pattern `GalleryRow` already uses. `clickOnEnterOrSpace` (new, `@storyteller/common`) calls the element's own `click()`, so each `onClick` runs unchanged. Menu items also get `aria-disabled` when disabled (their `onClick` already ignores the click). The bulk-select box is `role="checkbox"` with `aria-checked`. In `ImagePromptRow` the attributes come before dnd-kit's `attributes`/`listeners` spread, so when reordering is on, dnd-kit's own role and keyboard sensor still win. - **Not controls (42)**: modal and menu backdrops, wrappers that only stop event propagation, mouse-only drag/resize handles and slider tracks, trigger wrappers around a child button, the tooltip body. They get `role="presentation"`, which says what they already are to assistive tech. Nothing changes for mouse users. - **The prompt editor** (`contentEditable` in `MentionTextarea`) is `role="textbox"` with `aria-multiline="true"`. Mouse behaviour is unchanged. Keyboard users can now Tab to and activate the 16 button-like elements. Typecheck is left to CI. **typescript:S6853 (13)**: labels tied to their controls. In the storyboard metadata editor, the signup form and the cost modal, each label gets `htmlFor` and its control a matching `id` (`Input` and `Select` pass `id` through, and `Select`'s goes on its `ListboxButton`). These render once per page. The two colour-picker labels, which already wrap their ``, get `sr-only` text in place of their `title`-only name. ## Summary by CodeRabbit * **Accessibility** * Added keyboard access to image tiles, asset cards, list items, and other controls, including Enter and Space activation. * Improved screen-reader support with clearer labels for controls and thumbnails, and associations between form labels and fields. * Updated accessibility semantics for decorative content and interactive elements. --- .../experiences/ImageTo3DExperience.tsx | 8 ++++++++ .../app/src/components/reusable/CostModal.tsx | 4 ++-- .../src/pages/PageStoryboard/Storyboard.tsx | 20 ++++++++++++++----- .../VideoFrameExtractor.tsx | 2 ++ .../VideoWatermarkRemover.tsx | 1 + frontend/libs/common/src/lib/utils/index.ts | 1 + .../libs/common/src/lib/utils/keyboard.ts | 16 +++++++++++++++ .../src/lib/WaveformAudioPlayer.tsx | 2 ++ .../gallery-modal/src/lib/FolderColorRow.tsx | 1 + .../src/lib/GalleryDraggableItem.tsx | 10 +++++++++- .../gallery-modal/src/lib/gallery-modal.tsx | 3 +++ .../help-menu/src/lib/help-menu.tsx | 4 ++++ .../lightbox-modal/src/lib/lightbox-modal.tsx | 11 ++++++++++ .../src/lib/tags/TagChipInput.tsx | 1 + .../login-modal/src/lib/artcraft-signup.tsx | 15 +++++++++----- .../login-modal/src/lib/login-modal.tsx | 1 + .../libs/components/modal/src/lib/modal.tsx | 3 +++ .../pagedraw/src/lib/HistoryStack.tsx | 5 +++++ .../src/lib/PromptEditor/ImagePreview.tsx | 3 ++- .../src/lib/components/ui/ContextMenu.tsx | 3 ++- .../src/lib/components/ui/SplitPane.tsx | 1 + .../pagescene/src/lib/Stage3DBody.tsx | 2 ++ .../comps/AssetMenu/shared/ItemElement.tsx | 5 +++++ .../DraggablePrecisionMutator.tsx | 2 +- .../src/lib/comps/PoseModeSelector.tsx | 1 + .../src/lib/comps/Timeline/MotionPopover.tsx | 1 + .../src/lib/comps/Timeline/TimelineBar.tsx | 1 + .../lib/comps/Timeline/TimelineClipRow.tsx | 1 + .../src/lib/comps/Timeline/TimelineEditor.tsx | 1 + .../components/popover/src/lib/popover.tsx | 11 ++++++++++ .../promptbox/src/lib/CharactersModal.tsx | 6 ++++++ .../promptbox/src/lib/ImagePromptRow.tsx | 12 ++++++++++- .../promptbox/src/lib/MentionTextarea.tsx | 3 +++ .../promptbox/src/lib/PromptBox3D.tsx | 2 ++ .../promptbox/src/lib/deck/DeckCard.tsx | 4 ++++ .../src/lib/panes/AboutSettingsPane.tsx | 1 + .../slider-v2/src/lib/slider-v2.tsx | 4 ++++ .../components/tooltip/src/lib/tooltip.tsx | 2 ++ .../viewer-3d/src/lib/viewer-3d.tsx | 1 + 39 files changed, 158 insertions(+), 17 deletions(-) create mode 100644 frontend/libs/common/src/lib/utils/keyboard.ts diff --git a/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx b/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx index 973ac36977..d7f13b3b62 100644 --- a/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx +++ b/frontend/apps/artcraft/app/src/components/experiences/ImageTo3DExperience.tsx @@ -38,6 +38,7 @@ import { } from "@storyteller/ui-pricing-modal"; import { HelpMenuButton } from "@storyteller/ui-help-menu"; import { CreateEmptyState } from "~/components/generation-feed/CreateEmptyState"; +import { clickOnEnterOrSpace } from "@storyteller/common"; type Mode = "image" | "text"; type Variant = "object" | "world"; @@ -599,6 +600,9 @@ export const ImageTo3DExperience = ({
{uploadedPreview ? (
(
setPreviewImage(null)} > diff --git a/frontend/apps/artcraft/app/src/components/reusable/CostModal.tsx b/frontend/apps/artcraft/app/src/components/reusable/CostModal.tsx index 32995cf568..3b54f88d01 100644 --- a/frontend/apps/artcraft/app/src/components/reusable/CostModal.tsx +++ b/frontend/apps/artcraft/app/src/components/reusable/CostModal.tsx @@ -66,9 +66,9 @@ export const CostModal = ({ credits = 1, onClose }: CostModalProps) => {
- + onUpdate({ title: e.target.value })} @@ -84,8 +86,9 @@ const MetadataEditor = ({ board, onUpdate, onDelete, onUpload, onSketch }: Metad
- +