[PR #2024] [MERGED] Align generic storage entity contract #5397

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/storage-entity-generic-contract


📝 Commits (2)

  • b20848e storage: align generic entity contract
  • 1a72ceb storage: invalidate background metadata changes

📊 Changes

5 files changed (+72 additions, -60 deletions)

View changed files

📝 src/engine/capabilities/storage.ts (+43 -41)
📝 src/engine/generation/connected-commands.ts (+2 -2)
📝 src/engine/modes/roleplay/encounter/encounter-service.ts (+3 -3)
📝 src/features/catalog/presets/hooks/use-presets.ts (+2 -1)
📝 src/shared/api/storage-api.ts (+22 -13)

📄 Description

Linked issue

Closes #2017

Why this change

  • TypeScript generic storage types advertised entity names that Rust generic storage commands reject, so new callers could compile and then fail at runtime with Unsupported storage entity.

What changed

  • Rebuilt StorageEntity from a local generic-entity tuple that mirrors the Rust storage contract registry.
  • Removed non-generic backgrounds, game-assets, and game-state from generic storage types.
  • Added registry-backed generic names background-metadata and sprites.
  • Tightened StorageGateway and dynamic helper call sites to use StorageEntity instead of loose string.
  • Kept backgrounds, game assets, and world-state behavior behind their focused APIs.

Refactor impact

Primary owner:

Storage capability contract and shared storage API wrapper.

Impact areas reviewed:

  • Rust storage contract registry and generic storage command validation.
  • Shared API generic storage wrapper and cache invalidation handling.
  • Engine storage gateway callers that pass dynamic entity names.
  • Dedicated backgrounds, game assets, and world-state API paths.

Boundary notes:

  • No Rust behavior changed; Rust already rejects unsupported generic storage entities.
  • Engine code still uses a storage capability port, not concrete Tauri or shared API adapters.
  • Shared API remains the runtime wrapper for embedded and remote generic storage calls.
  • Backgrounds, game assets, and world state remain on focused command/API paths.

Pressure points touched:

  • None. Did not touch ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules.

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

  • pnpm typecheck
  • pnpm check:architecture
  • pnpm check:unused
  • cargo test --manifest-path src-tauri/Cargo.toml generic_storage_commands
  • cargo test --manifest-path src-tauri/Cargo.toml registry_
  • Local TS/Rust registry mirror probe: 34 TypeScript entities and 34 Rust registry entries, with no missing or extra names.
  • pnpm check
  • No UI/manual validation run; this is an internal storage contract typing fix.

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:

  • N/A because this is an internal storage contract typing fix and does not add a user-discoverable feature, workflow, setting, mode, panel, import path, media capability, or tool.

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 changes needed. This does not change user-facing behavior or restore release/package claims.

UI evidence

Not applicable; no visible UI changed.

Summary by CodeRabbit

  • Refactor
    • Improved internal storage entity type consistency across the codebase for stricter validation.
    • Enhanced asset invalidation logic to better manage cached resources during storage operations.
    • Tightened storage operation signatures to enforce type safety for entity parameters.

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/2024 **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:** `fix/storage-entity-generic-contract` --- ### 📝 Commits (2) - [`b20848e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b20848e725b9dc06d06d65080cb7c09142bfeb39) storage: align generic entity contract - [`1a72ceb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a72ceb32a7c4d965875edc5a3b2c57b10420f9c) storage: invalidate background metadata changes ### 📊 Changes **5 files changed** (+72 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/capabilities/storage.ts` (+43 -41) 📝 `src/engine/generation/connected-commands.ts` (+2 -2) 📝 `src/engine/modes/roleplay/encounter/encounter-service.ts` (+3 -3) 📝 `src/features/catalog/presets/hooks/use-presets.ts` (+2 -1) 📝 `src/shared/api/storage-api.ts` (+22 -13) </details> ### 📄 Description ## Linked issue Closes #2017 ## Why this change - TypeScript generic storage types advertised entity names that Rust generic storage commands reject, so new callers could compile and then fail at runtime with `Unsupported storage entity`. ## What changed - Rebuilt `StorageEntity` from a local generic-entity tuple that mirrors the Rust storage contract registry. - Removed non-generic `backgrounds`, `game-assets`, and `game-state` from generic storage types. - Added registry-backed generic names `background-metadata` and `sprites`. - Tightened `StorageGateway` and dynamic helper call sites to use `StorageEntity` instead of loose `string`. - Kept backgrounds, game assets, and world-state behavior behind their focused APIs. ## Refactor impact Primary owner: Storage capability contract and shared storage API wrapper. Impact areas reviewed: - Rust storage contract registry and generic storage command validation. - Shared API generic storage wrapper and cache invalidation handling. - Engine storage gateway callers that pass dynamic entity names. - Dedicated backgrounds, game assets, and world-state API paths. Boundary notes: - No Rust behavior changed; Rust already rejects unsupported generic storage entities. - Engine code still uses a storage capability port, not concrete Tauri or shared API adapters. - Shared API remains the runtime wrapper for embedded and remote generic storage calls. - Backgrounds, game assets, and world state remain on focused command/API paths. Pressure points touched: - None. Did not touch ModeSurface, GameSurface, shared mode UI, `src-tauri/src/lib.rs` command registration, or import modules. ## 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 - `pnpm typecheck` - `pnpm check:architecture` - `pnpm check:unused` - `cargo test --manifest-path src-tauri/Cargo.toml generic_storage_commands` - `cargo test --manifest-path src-tauri/Cargo.toml registry_` - Local TS/Rust registry mirror probe: 34 TypeScript entities and 34 Rust registry entries, with no missing or extra names. - `pnpm check` - No UI/manual validation run; this is an internal storage contract typing fix. ## 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: - N/A because this is an internal storage contract typing fix and does not add a user-discoverable feature, workflow, setting, mode, panel, import path, media capability, or tool. ## 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 changes needed. This does not change user-facing behavior or restore release/package claims. ## UI evidence Not applicable; no visible UI changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved internal storage entity type consistency across the codebase for stricter validation. * Enhanced asset invalidation logic to better manage cached resources during storage operations. * Tightened storage operation signatures to enforce type safety for entity parameters. <!-- 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/2024?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:15:57 +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#5397
No description provided.