[PR #7828] [MERGED] fix(image): new style profiles no longer overwrite existing ones #7953

Closed
opened 2026-10-24 04:09:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7828
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/style-profile-overwrite


📝 Commits (2)

  • 84b0cbd fix(image): new style profiles no longer overwrite existing ones
  • 8419129 fix(settings): keep syncing when browser storage is full; plainer size message

📊 Changes

6 files changed (+225 additions, -18 deletions)

View changed files

📝 packages/client/src/components/panels/SettingsPanel.tsx (+2 -6)
📝 packages/client/src/hooks/use-settings-sync.ts (+26 -9)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/shared/src/constants/image-style-profiles.ts (+16 -2)
📝 packages/shared/src/schemas/app-settings.schema.ts (+8 -1)
➕ scripts/regressions/image-style-profile-ids.regression.ts (+172 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

No GitHub issue yet. A user reported this to the maintainer: "Instead of creating a new Style preset, when creating anything past 21, it'll rename the last known preset and append 'Custom' to the end." An issue can be opened to track it if wanted.

@SpicyMarinara

Why this change

In Settings → Image Generation → Style Profiles, Clone stops adding profiles after 21. From then on, every click replaces the newest profile with a copy of itself and adds " Custom" to its name. The replaced profile's text and tags are lost.

Cause: Clone made the new id by adding -custom to the selected profile's id (auto-custom, auto-custom-custom, …). Clone keeps the new copy selected, so copying the newest profile grows the id by 7 characters each time. Ids are cut to 80 characters when settings are normalized. The editor checked for duplicates against the uncut id, so it never noticed that the cut id already existed. The merge by id then replaced the older profile. Starting from Auto, the 11th copy is 81 characters long. That makes 21 profiles (10 built-in + 11), and every copy after that replaces the last one.

Two more limits also dropped or failed to save profiles without telling anyone:

  • Normalization kept only the first 100 stored profiles, on both the client and the server's image generation path.
  • The settings route refused values over 1,000,000 characters. The sync push ignored that error, so new profiles were never saved to the server.

Profiles that were already overwritten cannot be recovered. The old copy was replaced in the saved settings, and no history of it is kept.

What changed

  • Unique copy ids (root cause). New shared createImageStyleProfileId numbers copies from the original id (anime-custom, anime-custom-2, …), so ids stay short. It checks for duplicates against the stored form of the id, so a copy always gets a new id and never replaces a profile. Profiles from older builds whose ids were already cut to 80 characters can be copied too. The Clone button uses this helper.
  • No count limit. Removed the 100-profile cut from normalizeImageStyleProfileSettings, as the maintainer decided. Users can have any number of style profiles.
  • Settings size limit raised and shown. The stored settings value limit goes from 1,000,000 to 4,000,000 characters (MAX_APP_SETTINGS_VALUE_LENGTH). That fits 300 heavily edited profiles with room to spare. A typical profile is about 1,000 characters. The new limit stays under the ~5 MB of browser storage that also holds these settings. If the settings ever pass it, the app shows "Settings are too big to save, so delete some image style profiles to make room." It no longer fails silently, and no profile is dropped from the editor. If the browser cannot cache the settings locally, the push to the server still happens, and the server copy is restored on the next load.
  • New English string settings.sync.tooLarge.
  • Regression scripts/regressions/image-style-profile-ids.regression.ts. It uses the real id helper, normalizer, settings route (full buildApp, real body limit), file storage and server image settings loader.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

What the agent ran (not a substitute for the boxes above):

  • Reproduced the bug on staging by running the editor's old Clone logic through the real normalizer. Copying the newest profile from Auto went 10 → 21 profiles, then clicks 12, 13 and 14 each stayed at 21 and replaced the last profile.
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/image-style-profile-ids.regression.ts passes. It covers:
    • 40 chained copies
    • 30 copies of one profile
    • creating 35, deleting 3 (including the newest), then creating 15 more
    • copying an old 80-character id
    • 300 profiles (about 1.3M characters) saving through PUT /api/app-settings/ui, loading after an app restart, and being read by the server's image settings
    • the server refusing values over the limit
  • The regression fails with the old Clone logic put back ("the copy is stored under the id it was given") and with the old 100-profile cut (110 !== 310).
  • Related regressions pass: omnibar-settings-sync, assigned-issue-sweep, sprite-background, image-prompt-guidance, feature-settings, prompt, open-issues.
  • A temporary Playwright run in Chromium against a dev server on ports 7531/7532 with throwaway data (the test file was deleted afterwards):
    • 30 Clone clicks each added a new profile and kept it selected.
    • Deleting a middle profile and the newest, then cloning 5 more, gave 43 distinct profiles.
    • All 43 reached the server and were still there after a reload.
    • Pushing the settings past the limit showed the message, and all profiles stayed in the editor.

Manual verification notes

  • Manually verify in the browser: Settings → Generations → Image Generation → Style Profiles. Select Auto and click Clone 25+ times. Each click should add a new profile ("Auto Custom", "Auto Custom Custom", …) and keep it selected. The profile count should keep growing past 21.
  • Manually verify: select an older copy in the middle of the list and click Clone. A new profile appears at the end, and the selected one keeps its name and tags.
  • Manually verify: delete a few copies, clone again, reload the page. Every remaining profile is still there with its own name and tags.
  • Manually verify on a second browser or device: the same profiles appear after settings sync.
  • Optional: an install that already has profiles from the old bug (ids cut at 80 characters) can clone them and get new profiles.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs mention the old limits.

UI evidence (if applicable)

The size-limit message (shown from the Playwright run when the settings are pushed past the limit): "Settings are too big to save, so delete some image style profiles to make room."

Summary by CodeRabbit

  • New Features
    • Image style profiles can be cloned repeatedly with distinct names, and more than 100 profiles can be retained.
    • The maximum size for saved settings has increased to 4 million characters.
  • Bug Fixes
    • Settings that exceed the size limit now show an error explaining that deleting image style profiles can free space.
    • Browser storage errors when saving a settings timestamp no longer prevent settings from being sent.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7828 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/style-profile-overwrite` --- ### 📝 Commits (2) - [`84b0cbd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/84b0cbdfde51c5c2bee6552b9c810dcf2759cbb6) fix(image): new style profiles no longer overwrite existing ones - [`8419129`](https://github.com/Pasta-Devs/Marinara-Engine/commit/84191299bf4338524afe26d352b3214716c7fc32) fix(settings): keep syncing when browser storage is full; plainer size message ### 📊 Changes **6 files changed** (+225 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+2 -6) 📝 `packages/client/src/hooks/use-settings-sync.ts` (+26 -9) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/shared/src/constants/image-style-profiles.ts` (+16 -2) 📝 `packages/shared/src/schemas/app-settings.schema.ts` (+8 -1) ➕ `scripts/regressions/image-style-profile-ids.regression.ts` (+172 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue No GitHub issue yet. A user reported this to the maintainer: "Instead of creating a new Style preset, when creating anything past 21, it'll rename the last known preset and append 'Custom' to the end." An issue can be opened to track it if wanted. @SpicyMarinara ## Why this change In Settings → Image Generation → Style Profiles, Clone stops adding profiles after 21. From then on, every click replaces the newest profile with a copy of itself and adds " Custom" to its name. The replaced profile's text and tags are lost. Cause: Clone made the new id by adding `-custom` to the selected profile's id (`auto-custom`, `auto-custom-custom`, …). Clone keeps the new copy selected, so copying the newest profile grows the id by 7 characters each time. Ids are cut to 80 characters when settings are normalized. The editor checked for duplicates against the uncut id, so it never noticed that the cut id already existed. The merge by id then replaced the older profile. Starting from Auto, the 11th copy is 81 characters long. That makes 21 profiles (10 built-in + 11), and every copy after that replaces the last one. Two more limits also dropped or failed to save profiles without telling anyone: - Normalization kept only the first 100 stored profiles, on both the client and the server's image generation path. - The settings route refused values over 1,000,000 characters. The sync push ignored that error, so new profiles were never saved to the server. Profiles that were already overwritten cannot be recovered. The old copy was replaced in the saved settings, and no history of it is kept. ## What changed - **Unique copy ids (root cause).** New shared `createImageStyleProfileId` numbers copies from the original id (`anime-custom`, `anime-custom-2`, …), so ids stay short. It checks for duplicates against the stored form of the id, so a copy always gets a new id and never replaces a profile. Profiles from older builds whose ids were already cut to 80 characters can be copied too. The Clone button uses this helper. - **No count limit.** Removed the 100-profile cut from `normalizeImageStyleProfileSettings`, as the maintainer decided. Users can have any number of style profiles. - **Settings size limit raised and shown.** The stored settings value limit goes from 1,000,000 to 4,000,000 characters (`MAX_APP_SETTINGS_VALUE_LENGTH`). That fits 300 heavily edited profiles with room to spare. A typical profile is about 1,000 characters. The new limit stays under the ~5 MB of browser storage that also holds these settings. If the settings ever pass it, the app shows "Settings are too big to save, so delete some image style profiles to make room." It no longer fails silently, and no profile is dropped from the editor. If the browser cannot cache the settings locally, the push to the server still happens, and the server copy is restored on the next load. - New English string `settings.sync.tooLarge`. - Regression `scripts/regressions/image-style-profile-ids.regression.ts`. It uses the real id helper, normalizer, settings route (full `buildApp`, real body limit), file storage and server image settings loader. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` What the agent ran (not a substitute for the boxes above): - Reproduced the bug on `staging` by running the editor's old Clone logic through the real normalizer. Copying the newest profile from Auto went 10 → 21 profiles, then clicks 12, 13 and 14 each stayed at 21 and replaced the last profile. - `node ./scripts/run-regressions.mjs --filter scripts/regressions/image-style-profile-ids.regression.ts` passes. It covers: - 40 chained copies - 30 copies of one profile - creating 35, deleting 3 (including the newest), then creating 15 more - copying an old 80-character id - 300 profiles (about 1.3M characters) saving through `PUT /api/app-settings/ui`, loading after an app restart, and being read by the server's image settings - the server refusing values over the limit - The regression fails with the old Clone logic put back ("the copy is stored under the id it was given") and with the old 100-profile cut (110 !== 310). - Related regressions pass: `omnibar-settings-sync`, `assigned-issue-sweep`, `sprite-background`, `image-prompt-guidance`, `feature-settings`, `prompt`, `open-issues`. - A temporary Playwright run in Chromium against a dev server on ports 7531/7532 with throwaway data (the test file was deleted afterwards): - 30 Clone clicks each added a new profile and kept it selected. - Deleting a middle profile and the newest, then cloning 5 more, gave 43 distinct profiles. - All 43 reached the server and were still there after a reload. - Pushing the settings past the limit showed the message, and all profiles stayed in the editor. ### Manual verification notes - Manually verify in the browser: Settings → Generations → Image Generation → Style Profiles. Select Auto and click Clone 25+ times. Each click should add a new profile ("Auto Custom", "Auto Custom Custom", …) and keep it selected. The profile count should keep growing past 21. - Manually verify: select an older copy in the middle of the list and click Clone. A new profile appears at the end, and the selected one keeps its name and tags. - Manually verify: delete a few copies, clone again, reload the page. Every remaining profile is still there with its own name and tags. - Manually verify on a second browser or device: the same profiles appear after settings sync. - Optional: an install that already has profiles from the old bug (ids cut at 80 characters) can clone them and get new profiles. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No docs mention the old limits. ## UI evidence (if applicable) The size-limit message (shown from the Playwright run when the settings are pushed past the limit): "Settings are too big to save, so delete some image style profiles to make room." <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Image style profiles can be cloned repeatedly with distinct names, and more than 100 profiles can be retained. * The maximum size for saved settings has increased to 4 million characters. * **Bug Fixes** * Settings that exceed the size limit now show an error explaining that deleting image style profiles can free space. * Browser storage errors when saving a settings timestamp no longer prevent settings from being sent. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7953
No description provided.