[GH-ISSUE #2067] Hostable storage I/O errors should return actionable 503 responses #1016

Closed
opened 2026-10-21 05:25:11 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @cha1latte on GitHub.

Summary

Hostable Rust remote runtime storage I/O failures can fall through to HTTP 500 instead of the legacy-style actionable service-unavailable response. The writable health check catches some not-writable startup states, but command-level storage failures still appear less precise.

Expected behavior

Storage I/O failures that indicate unavailable or unwritable user data should surface as stable, actionable HTTP errors. For readonly/locked/unavailable storage, legacy behavior used 503-style responses with user-facing guidance instead of a generic 500.

Actual behavior

Static parityscan found that Rust AppError::from(std::io::Error) produces code io_error, while src-tauri/src/http_server.rs does not map io_error to a non-500 status. It falls through the default HTTP error mapping to 500.

Refactor evidence:

  • src-tauri/crates/core/src/lib.rs maps std::io::Error into AppError code io_error.
  • src-tauri/src/http_server.rs maps known codes like not_found, invalid_input, admin_access_*, and unsupported_command; all other codes default to 500.
  • src-tauri/src/http_server.rs health does test writable storage, but that does not necessarily classify command-level storage I/O failures after readiness.

Legacy evidence:

  • packages/server/src/middleware/error-handler.ts mapped SQLITE_READONLY / readonly database errors and SQLITE_BUSY / locked database errors to 503 with actionable copy.

Steps to reproduce

  1. Compare legacy main:packages/server/src/middleware/error-handler.ts.
  2. Inspect src-tauri/crates/core/src/lib.rs for std::io::Error conversion to io_error.
  3. Inspect src-tauri/src/http_server.rs HttpError mapping and observe io_error is not mapped, so it defaults to 500.
  4. Note that checkRemoteRuntimeHealth may warn on non-writable health state, but command-level io_error still has no stable 503-style envelope.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor at 9bcfb164 during parityscan
  • Run mode: remote runtime / hostable Rust HTTP runtime
  • OS + version: not OS-specific from static proof
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? yes, affected path is remote runtime
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No runtime logs. Static parity evidence from:

  • src-tauri/crates/core/src/lib.rs
  • src-tauri/src/http_server.rs
  • src/shared/api/remote-runtime.ts
  • main:packages/server/src/middleware/error-handler.ts

Regression notes

Legacy main converted readonly/locked storage backend failures to 503 responses with actionable messages. Current refactor hostable runtime can still report command-level storage I/O failures as generic 500s, which can hide the same readiness/auth-adjacent failures this target is trying to make visible.

Additional context

Found during Target 3 remote runtime parityscan slice for health, error, readiness contracts, writable storage, invalid URL handling, HTTP error envelope, and retry metadata. Parent tracker: #2050.

Suggested repair: classify storage-related io_error cases into stable storage_unavailable / storage_not_writable style codes, map them to 503, and add focused hostable HTTP tests for a should-fail storage command path.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2067 Originally assigned to: @cha1latte on GitHub. ## Summary Hostable Rust remote runtime storage I/O failures can fall through to HTTP 500 instead of the legacy-style actionable service-unavailable response. The writable health check catches some not-writable startup states, but command-level storage failures still appear less precise. ## Expected behavior Storage I/O failures that indicate unavailable or unwritable user data should surface as stable, actionable HTTP errors. For readonly/locked/unavailable storage, legacy behavior used 503-style responses with user-facing guidance instead of a generic 500. ## Actual behavior Static parityscan found that Rust `AppError::from(std::io::Error)` produces code `io_error`, while `src-tauri/src/http_server.rs` does not map `io_error` to a non-500 status. It falls through the default HTTP error mapping to `500`. Refactor evidence: - `src-tauri/crates/core/src/lib.rs` maps `std::io::Error` into `AppError` code `io_error`. - `src-tauri/src/http_server.rs` maps known codes like `not_found`, `invalid_input`, `admin_access_*`, and `unsupported_command`; all other codes default to `500`. - `src-tauri/src/http_server.rs` health does test writable storage, but that does not necessarily classify command-level storage I/O failures after readiness. Legacy evidence: - `packages/server/src/middleware/error-handler.ts` mapped `SQLITE_READONLY` / readonly database errors and `SQLITE_BUSY` / locked database errors to 503 with actionable copy. ## Steps to reproduce 1. Compare legacy `main:packages/server/src/middleware/error-handler.ts`. 2. Inspect `src-tauri/crates/core/src/lib.rs` for `std::io::Error` conversion to `io_error`. 3. Inspect `src-tauri/src/http_server.rs` `HttpError` mapping and observe `io_error` is not mapped, so it defaults to 500. 4. Note that `checkRemoteRuntimeHealth` may warn on non-writable health state, but command-level `io_error` still has no stable 503-style envelope. ## Impact area <!-- Check the areas you think are relevant. Leave uncertain items unchecked. --> - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` at `9bcfb164` during parityscan - Run mode: remote runtime / hostable Rust HTTP runtime - OS + version: not OS-specific from static proof - Node + pnpm versions: not relevant - Rust version, if relevant: not captured - Remote Runtime URL configured? yes, affected path is remote runtime - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No runtime logs. Static parity evidence from: - `src-tauri/crates/core/src/lib.rs` - `src-tauri/src/http_server.rs` - `src/shared/api/remote-runtime.ts` - `main:packages/server/src/middleware/error-handler.ts` ## Regression notes Legacy `main` converted readonly/locked storage backend failures to 503 responses with actionable messages. Current refactor hostable runtime can still report command-level storage I/O failures as generic 500s, which can hide the same readiness/auth-adjacent failures this target is trying to make visible. ## Additional context Found during Target 3 remote runtime parityscan slice for health, error, readiness contracts, writable storage, invalid URL handling, HTTP error envelope, and retry metadata. Parent tracker: #2050. Suggested repair: classify storage-related `io_error` cases into stable `storage_unavailable` / `storage_not_writable` style codes, map them to 503, and add focused hostable HTTP tests for a should-fail storage command path. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:25:11 +07:00
Author
Owner

@cha1latte commented on GitHub (Jun 3, 2026):

Fixed in #2083

<!-- gh-comment-id:4616088912 --> @cha1latte commented on GitHub (Jun 3, 2026): Fixed in #2083
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#1016
No description provided.