[PR #1212] [MERGED] Harden SillyTavern bulk import #4985

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1212
Author: @cha1latte
Created: 5/25/2026
Status: ✅ Merged
Merged: 5/25/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/pr-1200-st-bulk-import-hardening


📝 Commits (5)

  • a54fd42 Harden SillyTavern bulk import
  • c5708d8 Fix Rust clippy test module ordering
  • e3013a5 Merge remote-tracking branch 'upstream/refactor' into pr-1200-fix
  • 6b17335 Address bulk import review feedback
  • 5d5a32b Merge remote-tracking branch 'upstream/refactor' into pr-1200-fix

📊 Changes

5 files changed (+599 additions, -82 deletions)

View changed files

📝 src-tauri/src/commands/storage/imports/bulk_imports.rs (+268 -65)
📝 src-tauri/src/commands/storage/imports/marinara.rs (+1 -1)
📝 src-tauri/src/commands/storage/imports/payloads.rs (+15 -0)
📝 src-tauri/src/commands/storage/imports/service.rs (+198 -16)
📝 src-tauri/src/commands/storage/media_uploads.rs (+117 -0)

📄 Description

Linked issue

Refs #1200

Why this change

  • Hardens SillyTavern bulk imports so stale selected items are reported as per-item warnings instead of aborting the whole import run.
  • Keeps imported character/persona avatar image data out of storage records by storing managed local asset files instead.
  • This branch includes the clippy ordering fix needed for the Rust Capability Layer to pass on the current refactor base.

What changed

  • Added selected-item resolution that records stale or invalid selected IDs into errors and continues importing the remaining items.
  • Reused the per-item warning path across characters, lorebooks, presets, personas, backgrounds, chats, and group chats.
  • Added managed image persistence helpers for copied files and decoded image bytes.
  • Added path-aware PNG character parsing so bulk imported character card avatars can be copied into managed storage.
  • Updated persona avatar imports to store managed asset references instead of duplicating image bytes into the avatar field.
  • Moved the media_uploads.rs test module to the end of the file so cargo clippy --all-targets -D warnings passes.
  • Addressed CodeRabbit feedback by counting stale selected IDs in streamed progress and by ignoring reserved avatar source fields from untrusted imported payloads.

Refactor impact

Primary owner:

Rust storage / imports

Impact areas reviewed:

  • SillyTavern import scanning and selected-item import flow.
  • Rust managed avatar/media storage helpers.
  • Character and persona import payload normalization.

Boundary notes:

  • No client UI changes.
  • No schema, release metadata, package, or dependency changes.
  • Import/storage behavior remains scoped to the Rust/Tauri storage command layer.

Pressure points touched:

  • src-tauri/src/commands/storage/imports/*
  • src-tauri/src/commands/storage/media_uploads.rs

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex ran cargo clippy --manifest-path src-tauri\Cargo.toml --workspace --all-targets --target-dir C:\tmp\pr1200-cargo-target -- -D warnings.
  • Codex ran cargo test --manifest-path src-tauri\Cargo.toml run_st_bulk_import_continues_after_stale_selected_items --target-dir C:\tmp\pr1200-cargo-target.
  • Codex ran cargo test --manifest-path src-tauri\Cargo.toml file_path_asset_url_matches_tauri_encoding_on_windows --target-dir C:\tmp\pr1200-cargo-target.
  • Codex ran cargo test --manifest-path src-tauri\Cargo.toml import_st_character_ignores_untrusted_avatar_source_fields --target-dir C:\tmp\pr1200-cargo-target.
  • Codex ran cargo test --manifest-path src-tauri\Cargo.toml import_st_character_uses_trusted_avatar_source_path --target-dir C:\tmp\pr1200-cargo-target.
  • Codex ran pnpm check.
  • Live UI import against a full external SillyTavern folder was not run.

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

UI evidence

N/A; this is Rust storage/import behavior with no visible UI changes.

Summary by CodeRabbit

Release Notes

  • New Features

    • Bulk import operations now gracefully handle invalid or stale item selections, recording errors while continuing processing for remaining items
    • Avatar files for characters and personas are now persisted as managed assets for improved reliability
  • Bug Fixes

    • Fixed avatar storage to use proper file persistence instead of embedded data formats
  • Tests

    • Added comprehensive test coverage for handling stale selections during bulk imports

Review Change Stack


🔄 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/1212 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/25/2026 **Status:** ✅ Merged **Merged:** 5/25/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/pr-1200-st-bulk-import-hardening` --- ### 📝 Commits (5) - [`a54fd42`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a54fd42d6c32401733101685863d0deaec2d51a1) Harden SillyTavern bulk import - [`c5708d8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c5708d84ab5fadf18983369db2ee7538a4fff7a1) Fix Rust clippy test module ordering - [`e3013a5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e3013a5b904531b29bf1a6f8513688e82d609cc9) Merge remote-tracking branch 'upstream/refactor' into pr-1200-fix - [`6b17335`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6b1733562175b05e66f781a312fb8fc6a53f4e09) Address bulk import review feedback - [`5d5a32b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5d5a32bca21cfd88eb7e174bb465707c1595f532) Merge remote-tracking branch 'upstream/refactor' into pr-1200-fix ### 📊 Changes **5 files changed** (+599 additions, -82 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/imports/bulk_imports.rs` (+268 -65) 📝 `src-tauri/src/commands/storage/imports/marinara.rs` (+1 -1) 📝 `src-tauri/src/commands/storage/imports/payloads.rs` (+15 -0) 📝 `src-tauri/src/commands/storage/imports/service.rs` (+198 -16) 📝 `src-tauri/src/commands/storage/media_uploads.rs` (+117 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Refs #1200 ## Why this change - Hardens SillyTavern bulk imports so stale selected items are reported as per-item warnings instead of aborting the whole import run. - Keeps imported character/persona avatar image data out of storage records by storing managed local asset files instead. - This branch includes the clippy ordering fix needed for the Rust Capability Layer to pass on the current `refactor` base. ## What changed - Added selected-item resolution that records stale or invalid selected IDs into `errors` and continues importing the remaining items. - Reused the per-item warning path across characters, lorebooks, presets, personas, backgrounds, chats, and group chats. - Added managed image persistence helpers for copied files and decoded image bytes. - Added path-aware PNG character parsing so bulk imported character card avatars can be copied into managed storage. - Updated persona avatar imports to store managed asset references instead of duplicating image bytes into the `avatar` field. - Moved the `media_uploads.rs` test module to the end of the file so `cargo clippy --all-targets -D warnings` passes. - Addressed CodeRabbit feedback by counting stale selected IDs in streamed progress and by ignoring reserved avatar source fields from untrusted imported payloads. ## Refactor impact Primary owner: Rust storage / imports Impact areas reviewed: - SillyTavern import scanning and selected-item import flow. - Rust managed avatar/media storage helpers. - Character and persona import payload normalization. Boundary notes: - No client UI changes. - No schema, release metadata, package, or dependency changes. - Import/storage behavior remains scoped to the Rust/Tauri storage command layer. Pressure points touched: - `src-tauri/src/commands/storage/imports/*` - `src-tauri/src/commands/storage/media_uploads.rs` ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Codex ran `cargo clippy --manifest-path src-tauri\Cargo.toml --workspace --all-targets --target-dir C:\tmp\pr1200-cargo-target -- -D warnings`. - Codex ran `cargo test --manifest-path src-tauri\Cargo.toml run_st_bulk_import_continues_after_stale_selected_items --target-dir C:\tmp\pr1200-cargo-target`. - Codex ran `cargo test --manifest-path src-tauri\Cargo.toml file_path_asset_url_matches_tauri_encoding_on_windows --target-dir C:\tmp\pr1200-cargo-target`. - Codex ran `cargo test --manifest-path src-tauri\Cargo.toml import_st_character_ignores_untrusted_avatar_source_fields --target-dir C:\tmp\pr1200-cargo-target`. - Codex ran `cargo test --manifest-path src-tauri\Cargo.toml import_st_character_uses_trusted_avatar_source_path --target-dir C:\tmp\pr1200-cargo-target`. - Codex ran `pnpm check`. - Live UI import against a full external SillyTavern folder was not run. ## 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 ## UI evidence N/A; this is Rust storage/import behavior with no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Bulk import operations now gracefully handle invalid or stale item selections, recording errors while continuing processing for remaining items * Avatar files for characters and personas are now persisted as managed assets for improved reliability * **Bug Fixes** * Fixed avatar storage to use proper file persistence instead of embedded data formats * **Tests** * Added comprehensive test coverage for handling stale selections during bulk imports <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1212?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:12:14 +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#4985
No description provided.