[GH-ISSUE #2017] StorageEntity lists non-generic entities that storage commands reject #989

Closed
opened 2026-10-21 05:24:51 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Xelvanis on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2017

Originally assigned to: @Xelvanis on GitHub.

What problem does this solve?

The refactor runtime now correctly rejects unsupported generic storage entities, but the TypeScript storage capability still advertises some names that are not valid generic storage collections.

Current shape:

  • src/engine/capabilities/storage.ts includes backgrounds, game-assets, and game-state in StorageEntity.
  • src/shared/api/storage-api.ts sends generic list/get/create/update/delete calls directly to storage_list, storage_get, storage_create, storage_update, and storage_delete.
  • src-tauri/src/commands/storage/commands/entities.rs validates those generic commands through contracts::collection_contract(entity).
  • src-tauri/src/commands/storage/contracts.rs does not define generic collections for backgrounds, game-assets, or game-state.

Dedicated paths already exist for these concepts: backgrounds use backgrounds_* commands, game assets use game_assets_* commands, and visible world state is stored through chat gameState plus game-state-snapshots/tracker snapshot APIs.

Expected behavior

The frontend generic storage type should match the generic storage command registry, or be split so non-generic asset/world-state surfaces cannot be mistaken for generic collections.

A reasonable target shape:

  • Define a generic storage entity set that mirrors StorageCollectionContract names.
  • Remove backgrounds, game-assets, and game-state from that generic set.
  • Include generic collections that Rust supports but the TypeScript union currently omits, such as background-metadata and sprites, if they are intended for generic callers.
  • Keep backgrounds, game assets, and world state behind their focused wrappers.

Actual behavior

New frontend code can compile against StorageEntity with a value such as backgrounds, then fail at runtime with Unsupported storage entity: backgrounds if it reaches the generic storage command path.

Current searches found no active generic caller using storageApi.list/get/create/update/delete with backgrounds, game-assets, or game-state, so this is an API contract drift rather than a confirmed visible workflow break.

Impact area

  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, imports, or HTTP runtime
  • React-free engine capability ports

Refactor branch considerations

This should stay as a narrow storage-capability cleanup. Do not route asset or world-state behavior through generic storage just to make the type line up; those surfaces already have focused wrappers and command paths.

Additional context

Found during #2011 batch 4 parityscan for the storage collection universe and registry subrows.

Related:

  • #1892 fixed runtime rejection of unsupported storage entities.
  • #2006 tracks separate follow-up debt for making create defaults and delete cleanup execute directly from the registry metadata.

Focused proof from this scan:

cargo test --manifest-path src-tauri\Cargo.toml generic_storage_commands_reject_unsupported_entities
cargo test --manifest-path src-tauri\Cargo.toml generic_storage_commands_still_accept_supported_entities
cargo test --manifest-path src-tauri\Cargo.toml registry_has_unique_collection_names
cargo test --manifest-path src-tauri\Cargo.toml registry_answers_core_contract_questions
Originally created by @Xelvanis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2017 Originally assigned to: @Xelvanis on GitHub. ## What problem does this solve? The refactor runtime now correctly rejects unsupported generic storage entities, but the TypeScript storage capability still advertises some names that are not valid generic storage collections. Current shape: - `src/engine/capabilities/storage.ts` includes `backgrounds`, `game-assets`, and `game-state` in `StorageEntity`. - `src/shared/api/storage-api.ts` sends generic `list/get/create/update/delete` calls directly to `storage_list`, `storage_get`, `storage_create`, `storage_update`, and `storage_delete`. - `src-tauri/src/commands/storage/commands/entities.rs` validates those generic commands through `contracts::collection_contract(entity)`. - `src-tauri/src/commands/storage/contracts.rs` does not define generic collections for `backgrounds`, `game-assets`, or `game-state`. Dedicated paths already exist for these concepts: backgrounds use `backgrounds_*` commands, game assets use `game_assets_*` commands, and visible world state is stored through chat `gameState` plus `game-state-snapshots`/tracker snapshot APIs. ## Expected behavior The frontend generic storage type should match the generic storage command registry, or be split so non-generic asset/world-state surfaces cannot be mistaken for generic collections. A reasonable target shape: - Define a generic storage entity set that mirrors `StorageCollectionContract` names. - Remove `backgrounds`, `game-assets`, and `game-state` from that generic set. - Include generic collections that Rust supports but the TypeScript union currently omits, such as `background-metadata` and `sprites`, if they are intended for generic callers. - Keep backgrounds, game assets, and world state behind their focused wrappers. ## Actual behavior New frontend code can compile against `StorageEntity` with a value such as `backgrounds`, then fail at runtime with `Unsupported storage entity: backgrounds` if it reaches the generic storage command path. Current searches found no active generic caller using `storageApi.list/get/create/update/delete` with `backgrounds`, `game-assets`, or `game-state`, so this is an API contract drift rather than a confirmed visible workflow break. ## Impact area - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, imports, or HTTP runtime - [x] React-free engine capability ports ## Refactor branch considerations This should stay as a narrow storage-capability cleanup. Do not route asset or world-state behavior through generic storage just to make the type line up; those surfaces already have focused wrappers and command paths. ## Additional context Found during #2011 batch 4 parityscan for the storage collection universe and registry subrows. Related: - #1892 fixed runtime rejection of unsupported storage entities. - #2006 tracks separate follow-up debt for making create defaults and delete cleanup execute directly from the registry metadata. Focused proof from this scan: ```powershell cargo test --manifest-path src-tauri\Cargo.toml generic_storage_commands_reject_unsupported_entities cargo test --manifest-path src-tauri\Cargo.toml generic_storage_commands_still_accept_supported_entities cargo test --manifest-path src-tauri\Cargo.toml registry_has_unique_collection_names cargo test --manifest-path src-tauri\Cargo.toml registry_answers_core_contract_questions ```
bsakaguchi 2026-10-21 05:24:51 +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#989
No description provided.