[PR #2357] [MERGED] Prune sprite cleanup restore points #5559

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/sprite-restore-point-prune


📝 Commits (2)

  • 91409c6 Prune sprite cleanup restore points
  • 174f4c6 Gate sprite restore pruning on manifest writes

📊 Changes

1 file changed (+265 additions, -2 deletions)

View changed files

📝 src-tauri/src/commands/storage/sprites.rs (+265 -2)

📄 Description

Linked issue

Closes #2330

Why this change

  • Sprite background cleanup created a full restore-point copy on each successful run, but old restore points were only removed when that exact point was restored. Repeated cleanup runs could leave unbounded duplicate sprite data on disk.

What changed

  • Added a retention cap for generated sprite cleanup restore points, keeping the latest 5 per sprite owner directory.
  • Protected the current cleanup restore point from pruning so the just-returned restore ID remains valid.
  • Left manual/non-generated restore-point directories and loose files untouched.
  • Made pruning best-effort with warning logs so cleanup success is not turned into an error after sprite files and the new restore manifest have already been written.

Refactor impact

Primary owner:

Rust storage

Impact areas reviewed:

  • Sprite background cleanup restore-point creation and restore lookup.
  • Local sprite asset folders for character and persona sprite owners.
  • Catalog sprite cleanup UI contract for restorePointId success handling.

Boundary notes:

  • Rust storage-only change in src-tauri; no React, engine, shared API, command registration, or remote-runtime contract changes.
  • Existing sprite cleanup/restore command names and return payloads are preserved.

Pressure points touched:

  • None.

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 test --manifest-path src-tauri/Cargo.toml sprite_cleanup_restore_point_tests -- --nocapture
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace
  • pnpm check

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:

  • This caps internal restore-point retention for an existing sprite cleanup workflow; it does not add a new discoverable feature.

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. Storage-only cleanup retention change; no visible UI changed.

Summary by CodeRabbit

  • New Features

    • Automatic pruning of older sprite cleanup restore points with configurable limits to optimize storage usage.
    • Protection mechanism preserving currently referenced restore points from deletion.
  • Tests

    • Added unit tests validating restore point pruning behavior and safeguard mechanisms.

🔄 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/2357 **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/sprite-restore-point-prune` --- ### 📝 Commits (2) - [`91409c6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/91409c66c4e03800a722e8be303ad7d1de1a4373) Prune sprite cleanup restore points - [`174f4c6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/174f4c61a81657eae278fd30fe0127852ce36c1a) Gate sprite restore pruning on manifest writes ### 📊 Changes **1 file changed** (+265 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/sprites.rs` (+265 -2) </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 Closes #2330 ## Why this change - Sprite background cleanup created a full restore-point copy on each successful run, but old restore points were only removed when that exact point was restored. Repeated cleanup runs could leave unbounded duplicate sprite data on disk. ## What changed - Added a retention cap for generated sprite cleanup restore points, keeping the latest 5 per sprite owner directory. - Protected the current cleanup restore point from pruning so the just-returned restore ID remains valid. - Left manual/non-generated restore-point directories and loose files untouched. - Made pruning best-effort with warning logs so cleanup success is not turned into an error after sprite files and the new restore manifest have already been written. ## Refactor impact Primary owner: Rust storage Impact areas reviewed: - Sprite background cleanup restore-point creation and restore lookup. - Local sprite asset folders for character and persona sprite owners. - Catalog sprite cleanup UI contract for `restorePointId` success handling. Boundary notes: - Rust storage-only change in `src-tauri`; no React, engine, shared API, command registration, or remote-runtime contract changes. - Existing sprite cleanup/restore command names and return payloads are preserved. Pressure points touched: - None. ## 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 test --manifest-path src-tauri/Cargo.toml sprite_cleanup_restore_point_tests -- --nocapture` - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` - `pnpm check` ## 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: - This caps internal restore-point retention for an existing sprite cleanup workflow; it does not add a new discoverable feature. ## 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 ## UI evidence N/A. Storage-only cleanup retention change; no visible UI changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Automatic pruning of older sprite cleanup restore points with configurable limits to optimize storage usage. * Protection mechanism preserving currently referenced restore points from deletion. * **Tests** * Added unit tests validating restore point pruning behavior and safeguard mechanisms. <!-- 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:22 +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#5559
No description provided.