[PR #2083] [MERGED] Map remote storage IO failures to 503 #5425

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/2060-remote-storage-io-errors


📝 Commits (2)

  • 5de56f3 Fix remote storage IO HTTP status
  • 451a638 Address storage IO review feedback

📊 Changes

1 file changed (+105 additions, -12 deletions)

View changed files

📝 src-tauri/src/http_server.rs (+105 -12)

📄 Description

Linked issue

Closes #2060

Why this change

  • Remote Runtime storage-backed /api/invoke commands could return a generic HTTP 500 when the underlying storage failed because it was read-only, locked, busy, full, or otherwise unavailable at command time.
  • Legacy handling exposed comparable storage availability failures as actionable 503-class responses, so this restores that behavior without changing unrelated internal IO failures.

What changed

  • Extracted the hostable HTTP AppError status mapping into a small helper in src-tauri/src/http_server.rs.
  • Mapped storage-availability io_error signals to HTTP 503 Service Unavailable.
  • Kept generic uncategorized io_error responses on HTTP 500 so unrelated internal IO errors are not masked.
  • Added Rust unit coverage for read-only/permission-denied storage IO, locked database IO, and a should-not-match uncategorized IO case.

Refactor impact

Primary owner:

Rust storage / remote runtime

Impact areas reviewed:

  • Hostable Remote Runtime HTTP error mapping.
  • Storage-backed command error surface for /api/invoke.
  • Existing JSON error payload shape (code, message, details) remains unchanged.

Boundary notes:

  • This stays in src-tauri/src/http_server.rs; no React, engine, shared API, schema, dependency, prompt, auth, or storage format changes.
  • The mapper only changes HTTP status selection. It does not rewrite the underlying AppError.

Pressure points touched:

  • Remote Runtime HTTP HttpError::into_response.

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

  • Before fix: cargo test --manifest-path src-tauri/Cargo.toml io_errors_map_to_storage_unavailable_http_status failed with left: 500, right: 503.
  • After fix: cargo test --manifest-path src-tauri/Cargo.toml http_status passed for read-only/permission-denied and locked-database IO status mapping.
  • After fix: cargo test --manifest-path src-tauri/Cargo.toml uncategorized_io_errors_keep_internal_server_error_status passed for the generic IO negative control.
  • cargo check --manifest-path src-tauri/Cargo.toml passed.
  • pnpm check:architecture passed.
  • pnpm check:frontend passed.
  • pnpm check:rust passed.
  • pnpm check:docs passed.
  • pnpm check:discovery passed.
  • pnpm check:unused passed.
  • git diff --check passed.
  • Full pnpm check is currently blocked before code checks by unrelated CRLF line-ending baseline failures in .github/workflows/bunny-review-command.yml, DESIGN.md, and custom_components/marinara_engine/{button.py,http.py,select.py,webhook.py}.
  • Bunny review pass: draft boundary accepted with the full-check limitation above disclosed; not ready-for-review until the baseline line-ending gate is clean or explicitly accepted.

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:

  • Bugfix only. No new user-discoverable feature or workflow.

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. This is a non-UI Remote Runtime HTTP error-mapping fix.


🔄 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/2083 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/2060-remote-storage-io-errors` --- ### 📝 Commits (2) - [`5de56f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5de56f37ab657e74532b5dd294403c47a4dfd1b8) Fix remote storage IO HTTP status - [`451a638`](https://github.com/Pasta-Devs/Marinara-Engine/commit/451a6386559de2e731a71d6cc9ed77226a79e977) Address storage IO review feedback ### 📊 Changes **1 file changed** (+105 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/http_server.rs` (+105 -12) </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 #2060 ## Why this change - Remote Runtime storage-backed `/api/invoke` commands could return a generic HTTP 500 when the underlying storage failed because it was read-only, locked, busy, full, or otherwise unavailable at command time. - Legacy handling exposed comparable storage availability failures as actionable 503-class responses, so this restores that behavior without changing unrelated internal IO failures. ## What changed - Extracted the hostable HTTP `AppError` status mapping into a small helper in `src-tauri/src/http_server.rs`. - Mapped storage-availability `io_error` signals to HTTP 503 Service Unavailable. - Kept generic uncategorized `io_error` responses on HTTP 500 so unrelated internal IO errors are not masked. - Added Rust unit coverage for read-only/permission-denied storage IO, locked database IO, and a should-not-match uncategorized IO case. ## Refactor impact Primary owner: Rust storage / remote runtime Impact areas reviewed: - Hostable Remote Runtime HTTP error mapping. - Storage-backed command error surface for `/api/invoke`. - Existing JSON error payload shape (`code`, `message`, `details`) remains unchanged. Boundary notes: - This stays in `src-tauri/src/http_server.rs`; no React, engine, shared API, schema, dependency, prompt, auth, or storage format changes. - The mapper only changes HTTP status selection. It does not rewrite the underlying `AppError`. Pressure points touched: - Remote Runtime HTTP `HttpError::into_response`. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] 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 - Before fix: `cargo test --manifest-path src-tauri/Cargo.toml io_errors_map_to_storage_unavailable_http_status` failed with `left: 500`, `right: 503`. - After fix: `cargo test --manifest-path src-tauri/Cargo.toml http_status` passed for read-only/permission-denied and locked-database IO status mapping. - After fix: `cargo test --manifest-path src-tauri/Cargo.toml uncategorized_io_errors_keep_internal_server_error_status` passed for the generic IO negative control. - `cargo check --manifest-path src-tauri/Cargo.toml` passed. - `pnpm check:architecture` passed. - `pnpm check:frontend` passed. - `pnpm check:rust` passed. - `pnpm check:docs` passed. - `pnpm check:discovery` passed. - `pnpm check:unused` passed. - `git diff --check` passed. - Full `pnpm check` is currently blocked before code checks by unrelated CRLF line-ending baseline failures in `.github/workflows/bunny-review-command.yml`, `DESIGN.md`, and `custom_components/marinara_engine/{button.py,http.py,select.py,webhook.py}`. - Bunny review pass: draft boundary accepted with the full-check limitation above disclosed; not ready-for-review until the baseline line-ending gate is clean or explicitly accepted. ## 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: - Bugfix only. No new user-discoverable feature or workflow. ## 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. This is a non-UI Remote Runtime HTTP error-mapping fix. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:11 +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#5425
No description provided.