[PR #2269] [MERGED] Fix character version avatar assets #5523

Closed
opened 2026-10-22 04:17:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2269
Author: @Xelvanis
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/version-avatar-history-assets


📝 Commits (5)

  • 1590286 Fix character version avatar assets
  • 633e125 Address character version avatar rollback
  • e58e911 Surface character version rollback failures
  • 06ae0a2 Restore prompt default flag normalization
  • 9cf1984 Cover character avatar rollback failures

📊 Changes

5 files changed (+1288 additions, -121 deletions)

View changed files

📝 src-tauri/src/commands/storage/avatars.rs (+429 -101)
📝 src-tauri/src/commands/storage/characters.rs (+770 -19)
📝 src-tauri/src/commands/storage/commands/entities.rs (+78 -0)
📝 src-tauri/src/commands/storage/contracts.rs (+2 -1)
📝 src-tauri/src/commands/storage/media_uploads.rs (+9 -0)

📄 Description

Linked issue

N/A

Why this change

  • Character version snapshots could lose or orphan avatar assets because saved versions, restored live characters, and delete cleanup did not have a single ownership rule for managed avatar files.

What changed

  • Copy managed character avatars into version-owned files when creating character version snapshots.
  • Copy version avatars into separate live-owned files when restoring a saved version.
  • Fail snapshot creation when a managed source avatar exists but cannot be copied, and roll back newly uploaded files on snapshot or patch failure.
  • Register managed media cleanup for character-versions and preserve avatar files that are still referenced by a live character or another saved version.
  • Add focused Rust regression coverage for snapshot copy, restore copy, copy failure, missing-character restore, and version delete cleanup paths.

Refactor impact

Primary owner:

Rust storage

Impact areas reviewed:

  • Character avatar upload and removal snapshot creation.
  • Character version restore behavior.
  • Managed avatar file delete cleanup for characters and character-versions.
  • Storage collection cleanup registration.

Boundary notes:

  • Rust-only storage capability change under src-tauri.
  • No React, TypeScript engine, shared API, command registration, or remote-runtime allowlist changes.
  • Existing Tauri/HTTP command entrypoints continue to call the same Rust storage owners.

Pressure points touched:

  • None of the listed broad pressure points. Touched focused storage modules only.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo fmt --manifest-path src-tauri/Cargo.toml
  • cargo test --manifest-path src-tauri/Cargo.toml character_avatar passed, 4 tests.
  • cargo test --manifest-path src-tauri/Cargo.toml deleting_character_version passed, 2 tests.
  • cargo test --manifest-path src-tauri/Cargo.toml restore_character_version passed, 2 tests.
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passed.
  • pnpm check passed.
  • git diff --check passed.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Internal storage bugfix for character version avatar asset ownership. No new user-discoverable feature or workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs changes needed because this is an internal Rust storage bugfix and does not change documented commands, architecture guidance, or user-facing copy.

UI evidence

N/A. No visible UI changes.

Summary by CodeRabbit

  • New Features

    • Character versions now capture and preserve avatar files in snapshots
    • Avatar files are properly copied and restored when recovering previous character versions
  • Bug Fixes

    • Failed avatar uploads no longer leave orphaned files; cleanup is rolled back on failure
    • Avatar file cleanup during character version deletion now correctly preserves files still referenced by other versions

🔄 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/2269 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/version-avatar-history-assets` --- ### 📝 Commits (5) - [`1590286`](https://github.com/Pasta-Devs/Marinara-Engine/commit/159028600c1fe8c9c5c2d2bb46f003734cb51abf) Fix character version avatar assets - [`633e125`](https://github.com/Pasta-Devs/Marinara-Engine/commit/633e1254d0fb0144dd8d0a92a939620baf7b5000) Address character version avatar rollback - [`e58e911`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e58e91134a8f5aacd994d4bdfff67c5960799e86) Surface character version rollback failures - [`06ae0a2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/06ae0a2323f29c7caf2fce0237a669b3b73afc5e) Restore prompt default flag normalization - [`9cf1984`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9cf198408b5a6d9e3b48b9744dda6b27bc2c05ce) Cover character avatar rollback failures ### 📊 Changes **5 files changed** (+1288 additions, -121 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/avatars.rs` (+429 -101) 📝 `src-tauri/src/commands/storage/characters.rs` (+770 -19) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+78 -0) 📝 `src-tauri/src/commands/storage/contracts.rs` (+2 -1) 📝 `src-tauri/src/commands/storage/media_uploads.rs` (+9 -0) </details> ### 📄 Description ## Linked issue N/A ## Why this change - Character version snapshots could lose or orphan avatar assets because saved versions, restored live characters, and delete cleanup did not have a single ownership rule for managed avatar files. ## What changed - Copy managed character avatars into version-owned files when creating character version snapshots. - Copy version avatars into separate live-owned files when restoring a saved version. - Fail snapshot creation when a managed source avatar exists but cannot be copied, and roll back newly uploaded files on snapshot or patch failure. - Register managed media cleanup for `character-versions` and preserve avatar files that are still referenced by a live character or another saved version. - Add focused Rust regression coverage for snapshot copy, restore copy, copy failure, missing-character restore, and version delete cleanup paths. ## Refactor impact Primary owner: Rust storage Impact areas reviewed: - Character avatar upload and removal snapshot creation. - Character version restore behavior. - Managed avatar file delete cleanup for `characters` and `character-versions`. - Storage collection cleanup registration. Boundary notes: - Rust-only storage capability change under `src-tauri`. - No React, TypeScript engine, shared API, command registration, or remote-runtime allowlist changes. - Existing Tauri/HTTP command entrypoints continue to call the same Rust storage owners. Pressure points touched: - None of the listed broad pressure points. Touched focused storage modules only. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo fmt --manifest-path src-tauri/Cargo.toml` - `cargo test --manifest-path src-tauri/Cargo.toml character_avatar` passed, 4 tests. - `cargo test --manifest-path src-tauri/Cargo.toml deleting_character_version` passed, 2 tests. - `cargo test --manifest-path src-tauri/Cargo.toml restore_character_version` passed, 2 tests. - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passed. - `pnpm check` passed. - `git diff --check` passed. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Internal storage bugfix for character version avatar asset ownership. No new user-discoverable feature or workflow. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No docs changes needed because this is an internal Rust storage bugfix and does not change documented commands, architecture guidance, or user-facing copy. ## UI evidence N/A. No visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Character versions now capture and preserve avatar files in snapshots * Avatar files are properly copied and restored when recovering previous character versions * **Bug Fixes** * Failed avatar uploads no longer leave orphaned files; cleanup is rolled back on failure * Avatar file cleanup during character version deletion now correctly preserves files still referenced by other versions <!-- 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-22 04:17:03 +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#5523
No description provided.