Skip to content

Fix Gallery save toast to use the chosen filename - #15725

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
Imagineer99:fix/gallery-download-filename
Oct 28, 2026
Merged

danielhanchen merged 2 commits into
unslothai:mainfrom
Imagineer99:fix/gallery-download-filename

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Renaming an image in Unsloth Desktop's Save As dialog still showed the suggested filename in the Gallery success toast. The native save command already returns the chosen basename; this change preserves that result through downloadFile() and uses it in the toast.

Existing export wrappers retain their Promise<void> contracts. Cancellation and errors keep their existing behavior, and browser downloads do not claim a final filename that the browser cannot report.

Fixes #15621.

Playwright A/B evidence

Compared merge base d128b72f72f17bffba7df4d9a0fa748a20680c54 with PR head 2d09e99cd6fdff56299c1e7be49ed3b36860fdea.

Both sides received the simulated native result renamed-gallery-15621.png:

Success toast filename
Before Unsloth_20261028-120000_15621.png
After renamed-gallery-15621.png

Playwright comparison with simulated native save responses

All 10 Playwright cases passed: renamed file, unchanged name, cancellation, save failure, and browser download on each revision. Browser downloads produced the expected 24,798 bytes with matching SHA-256.

The comparison runs the real Gallery, download helper, and backend with a seeded image. Official Tauri mocks provide the native save responses; the startup wrapper is bypassed and unrelated shell commands are stubbed. This A/B does not exercise an OS Save As dialog or a native filesystem write. Browser downloads are exercised directly.

Validation

  • 6 new native-file helper tests and 3 existing chunked-save tests passed.
  • The 3 basename-return tests fail against the baseline and pass with the fix.
  • 43 desktop frontend contract checks passed.
  • Frontend and test TypeScript checks passed.
  • Diff and pre-push checks passed; merges cleanly with current main at 8222149ee32c1b4706f08c0169a4d1769d7f93ae.

Same fix for the Video and audio save toasts

The Video gallery ("Video saved") and audio ("Audio saved") toasts had the same problem: the chunked save (finish_native_file_save) and the streamed URL save (save_native_file_from_url) already return the chosen basename, but downloadBlobStreaming, downloadUrlStreaming and downloadUrl dropped it. They now return it like downloadFile, and both toasts show it. Browser downloads still resolve undefined, so those toasts still only appear in the desktop app. Three new tests cover the helpers; they fail without the change.

Desktop toast before / after

Merge base d128b72f7 vs head 194c6875e. The Images gallery runs in desktop mode with a stand-in for the native bridge whose Save As answers renamed-by-user-15621.png, then Download > PNG (lossless). Before: Unsloth_20261028-030000_15621.png. After: renamed-by-user-15621.png.

Images gallery save toast before and after

Video and audio, same setup (Video gallery Download > MP4, which streams through the URL save; Audio clip menu > Download, which saves in chunks). Before: Unsloth_video_20261028-050000_15621.mp4 and uidiff audio save toast seed - Text to Speech.wav. After: renamed-by-user-15621.mp4 and renamed-by-user-15621.wav.

Video gallery save toast before and after

Audio clip save toast before and after

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T10:18:27.044437Z
We couldn’t complete this review. Comment @codex review to try again.
2d09e99 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen danielhanchen self-assigned this Oct 28, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 28, 2026
danielhanchen added a commit that referenced this pull request Oct 28, 2026
…ency pass (#15747)

## Summary

`Shell installer tests` fails on main, so every PR's staging CI run of
that lane is red (e.g. #15725, a frontend-only change):

```
FAIL: the rerun check directly follows that dependency pass (expected '    _setup_rerun_if_replaced', got '    _SETUP_VENV_CHANGED=true')
Results: 31 passed, 1 failed
tests/sh/test_setup_rerun_after_replace.sh exited 1
```

#15646 (precompile bytecode after setup) added
`_SETUP_VENV_CHANGED=true` between `install_python_stack` and
`_setup_rerun_if_replaced`, and pinned that order in its own
`tests/python/test_installer_compile_bytecode.py`.
`tests/sh/test_setup_rerun_after_replace.sh` pins the opposite: the
handoff to a replaced `setup.sh` must sit directly behind the dependency
pass, so no line of the old copy runs after the update has swapped the
file. The two tests now contradict each other on main.

Both intents can hold at once:
- The flag is a plain local assignment that only feeds the precompile
gate near the end of the script.
- That gate already fires on `UNSLOTH_SETUP_RERUN=1` too: `if { [
"${_SETUP_VENV_CHANGED:-false}" = true ] || [ "${UNSLOTH_SETUP_RERUN:-}"
= 1 ]; }`.

So setting it after the handoff changes nothing:
- **No replacement:** the flag is set before anything reads it.
- **Replacement:** the exec'd new copy precompiles because of
`UNSLOTH_SETUP_RERUN` (an unexported shell variable would not have
survived the `exec` anyway).

## Change

- **`studio/setup.sh`:** `_setup_rerun_if_replaced` moves back directly
behind `install_python_stack`. `_SETUP_VENV_CHANGED=true` follows it,
still inside the dependency-pass branch, with a one-line comment on why
the order is safe.
- **`tests/python/test_installer_compile_bytecode.py`:** asserts the
handoff is the line right after the dependency pass, and that the flag
is set right behind it in the same branch. It keeps the existing checks
on the gate and the `UNSLOTH_SETUP_RERUN` fallback.

## Testing

- `tests/sh/test_setup_rerun_after_replace.sh`: 31 passed, 1 failed on
main; 32 passed with this change.
- `tests/python/test_installer_compile_bytecode.py`: 30 passed, on both
main and this change.
- Every other test that pins this block passes: 12 shell suites and 4
studio pytest files, including `test_setup_full_deps_override.sh`,
`test_node_pin_update.sh`, the CUDA / XPU / AMD fast-path escapes and
`test_ci_shell_suite_coverage.py`.
- `bash -n studio/setup.sh` is clean.
@danielhanchen
danielhanchen merged commit fe032ba into unslothai:main Oct 28, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 28, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 28, 2026
danielhanchen added a commit to Etherll/unsloth that referenced this pull request Oct 28, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Images download toast shows original name after rename

2 participants