[PR #2008] [MERGED] Add storage collection prep helpers #5390

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

📋 Pull Request Information

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

Base: refactor ← Head: storage/message-sidecar-prep


📝 Commits (4)

  • 0eafc56 Add storage collection prep helpers
  • 275d309 Harden atomic storage update callback
  • 3b5e4c8 Block side effects during atomic storage updates
  • 21d4d2d Stop recovery writes during atomic updates

📊 Changes

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

View changed files

📝 src-tauri/crates/storage/src/lib.rs (+670 -2)

📄 Description

Linked issue

Prep for #1923

Why this change

  • Prepares the Rust storage capability for future message sidecar storage by adding helpers for filtered projected collection reads and atomic multi-collection updates.
  • Tightens the proof around the sidecar read path so it matches the legacy message_swipes behavior: rows are filtered by messageId, ordered file rows are preserved, and unrequested fields are skipped.

What changed

  • Added FileStorage::list_projected_where_in for projected reads filtered by a string field and allowed value set.
  • Added FileStorage::update_collections_atomically for locked multi-collection read/update/replace flows.
  • Hardened multi-collection replacement so existing collection paths must be regular files before replacement begins.
  • Added storage tests for atomic updates, non-file collection rejection, rollback, and legacy-shaped sidecar swipe rows.

Refactor impact

Primary owner:

Rust storage capability crate.

Impact areas reviewed:

  • Collection cache and dirty flush behavior.
  • Multi-collection replacement rollback path.
  • Message sidecar prep shape against legacy message_swipes rows.
  • Existing profile import callers that use multi-collection replacement.

Boundary notes:

  • No React, TypeScript engine, shared API, Tauri command facade, or remote-runtime routing changes.
  • Behavior stays inside the Rust storage crate; future command/API wiring remains separate work.

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

  • git diff --check origin/refactor...HEAD
  • cargo test --manifest-path src-tauri/crates/storage/Cargo.toml
  • cargo check --manifest-path src-tauri/Cargo.toml
  • cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings
  • 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:

  • Internal Rust storage prep and test coverage only; no user-discoverable workflow changes.

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

Notes:

  • No docs or release-note changes needed because this is internal storage prep and proof coverage, not a user-facing behavior change.

UI evidence

N/A; no visible UI changes.

Summary by CodeRabbit

  • New Features

    • Added efficient filtering of stored data by specific field values with optimized data retrieval
    • Introduced atomic multi-collection update operations for improved data consistency and reliability across multiple collections simultaneously
  • Tests

    • Added test coverage for new filtering and update capabilities

🔄 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/2008 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `storage/message-sidecar-prep` --- ### 📝 Commits (4) - [`0eafc56`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0eafc569a8a6c775bcf6872f2be7db90d0745f1d) Add storage collection prep helpers - [`275d309`](https://github.com/Pasta-Devs/Marinara-Engine/commit/275d3090bc3f0cd39ce317b08e1bf0835f5a1d0d) Harden atomic storage update callback - [`3b5e4c8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3b5e4c834f8c705bc938f8ea0388f99f806631eb) Block side effects during atomic storage updates - [`21d4d2d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/21d4d2d13a5a50e4202dedf0a38127a910b9d796) Stop recovery writes during atomic updates ### 📊 Changes **1 file changed** (+670 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/storage/src/lib.rs` (+670 -2) </details> ### 📄 Description ## Linked issue Prep for #1923 ## Why this change - Prepares the Rust storage capability for future message sidecar storage by adding helpers for filtered projected collection reads and atomic multi-collection updates. - Tightens the proof around the sidecar read path so it matches the legacy `message_swipes` behavior: rows are filtered by `messageId`, ordered file rows are preserved, and unrequested fields are skipped. ## What changed - Added `FileStorage::list_projected_where_in` for projected reads filtered by a string field and allowed value set. - Added `FileStorage::update_collections_atomically` for locked multi-collection read/update/replace flows. - Hardened multi-collection replacement so existing collection paths must be regular files before replacement begins. - Added storage tests for atomic updates, non-file collection rejection, rollback, and legacy-shaped sidecar swipe rows. ## Refactor impact Primary owner: Rust storage capability crate. Impact areas reviewed: - Collection cache and dirty flush behavior. - Multi-collection replacement rollback path. - Message sidecar prep shape against legacy `message_swipes` rows. - Existing profile import callers that use multi-collection replacement. Boundary notes: - No React, TypeScript engine, shared API, Tauri command facade, or remote-runtime routing changes. - Behavior stays inside the Rust storage crate; future command/API wiring remains separate work. 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 - `git diff --check origin/refactor...HEAD` - `cargo test --manifest-path src-tauri/crates/storage/Cargo.toml` - `cargo check --manifest-path src-tauri/Cargo.toml` - `cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings` - `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: - Internal Rust storage prep and test coverage only; no user-discoverable workflow changes. ## 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 Notes: - No docs or release-note changes needed because this is internal storage prep and proof coverage, not a user-facing behavior change. ## UI evidence N/A; no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added efficient filtering of stored data by specific field values with optimized data retrieval * Introduced atomic multi-collection update operations for improved data consistency and reliability across multiple collections simultaneously * **Tests** * Added test coverage for new filtering and update capabilities <!-- 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:15:52 +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#5390
No description provided.