[GH-ISSUE #2066] Hostable remote runtime lacks legacy API abuse/body/cache policy #1013

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

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

Originally assigned to: @cha1latte on GitHub.

Summary

The hostable Rust remote runtime does not visibly preserve legacy API abuse, payload, and JSON cache controls. Legacy Fastify had global and route-specific API rate limits with Retry-After, 256 MB body/upload limits, and default Cache-Control: no-store for API JSON responses.

Expected behavior

Remote/runtime HTTP paths should preserve the legacy safety envelope:

  • API requests have bounded abuse controls, including route-specific limits for hot or privileged paths.
  • 429 responses include Retry-After so the refactor client's retryAfterMs path can work.
  • Large JSON/multipart payloads are bounded similarly to legacy profile/import flows.
  • API JSON responses default to Cache-Control: no-store unless a route deliberately overrides it.

Actual behavior

Static parityscan of the current refactor slice found client-side support for parsing Retry-After, but no Rust hostable runtime source that emits API 429 rate-limit responses or preserves the legacy global body/cache policy.

Refactor evidence:

  • src/shared/api/remote-runtime.ts reads retry-after into retryAfterMs.
  • src/shared/api/query-retry.ts only retries 429 when retryAfterMs exists.
  • src-tauri/src/http_server.rs defines the hostable routes and error mapping, but the scanned slice did not find a rate-limit/body-limit/no-store policy equivalent.

Legacy evidence:

  • packages/server/src/middleware/rate-limit.ts had a default 600/min API bucket plus route-specific limits and emitted RateLimit-* plus Retry-After.
  • packages/server/src/app.ts configured bodyLimit, multipart fileSize, registered rateLimitHook, and added default Cache-Control: no-store for /api/*.

Steps to reproduce

  1. Compare legacy main:packages/server/src/middleware/rate-limit.ts and main:packages/server/src/app.ts.
  2. Search refactor hostable runtime for Retry-After, RateLimit, 429, bodyLimit, Cache-Control, no-store, and rate-limit terms in src-tauri/src/http_server.rs and src/shared/api.
  3. Observe that refactor client preserves retry metadata if provided, but the Rust hostable runtime has no matching API throttling/body/cache policy in this slice.

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/src/http_server.rs
  • src/shared/api/remote-runtime.ts
  • src/shared/api/query-retry.ts
  • main:packages/server/src/middleware/rate-limit.ts
  • main:packages/server/src/app.ts

Regression notes

Legacy main had these API policy controls in the Node/Fastify server. Current refactor hostable Rust runtime appears to lack the equivalent controls, so remote clients may miss 429 retry metadata, payload bounds, or no-store headers that legacy users had.

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: add hostable HTTP policy coverage for API throttling, route-specific hot/privileged limits, request body/upload bounds, no-store defaults for JSON API responses, and tests proving 429 + Retry-After reaches ApiError.details.retryAfterMs.

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/2066 Originally assigned to: @cha1latte on GitHub. ## Summary The hostable Rust remote runtime does not visibly preserve legacy API abuse, payload, and JSON cache controls. Legacy Fastify had global and route-specific API rate limits with `Retry-After`, 256 MB body/upload limits, and default `Cache-Control: no-store` for API JSON responses. ## Expected behavior Remote/runtime HTTP paths should preserve the legacy safety envelope: - API requests have bounded abuse controls, including route-specific limits for hot or privileged paths. - 429 responses include `Retry-After` so the refactor client's `retryAfterMs` path can work. - Large JSON/multipart payloads are bounded similarly to legacy profile/import flows. - API JSON responses default to `Cache-Control: no-store` unless a route deliberately overrides it. ## Actual behavior Static parityscan of the current refactor slice found client-side support for parsing `Retry-After`, but no Rust hostable runtime source that emits API 429 rate-limit responses or preserves the legacy global body/cache policy. Refactor evidence: - `src/shared/api/remote-runtime.ts` reads `retry-after` into `retryAfterMs`. - `src/shared/api/query-retry.ts` only retries 429 when `retryAfterMs` exists. - `src-tauri/src/http_server.rs` defines the hostable routes and error mapping, but the scanned slice did not find a rate-limit/body-limit/no-store policy equivalent. Legacy evidence: - `packages/server/src/middleware/rate-limit.ts` had a default 600/min API bucket plus route-specific limits and emitted `RateLimit-*` plus `Retry-After`. - `packages/server/src/app.ts` configured `bodyLimit`, multipart `fileSize`, registered `rateLimitHook`, and added default `Cache-Control: no-store` for `/api/*`. ## Steps to reproduce 1. Compare legacy `main:packages/server/src/middleware/rate-limit.ts` and `main:packages/server/src/app.ts`. 2. Search refactor hostable runtime for `Retry-After`, `RateLimit`, `429`, `bodyLimit`, `Cache-Control`, `no-store`, and rate-limit terms in `src-tauri/src/http_server.rs` and `src/shared/api`. 3. Observe that refactor client preserves retry metadata if provided, but the Rust hostable runtime has no matching API throttling/body/cache policy in this slice. ## 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/src/http_server.rs` - `src/shared/api/remote-runtime.ts` - `src/shared/api/query-retry.ts` - `main:packages/server/src/middleware/rate-limit.ts` - `main:packages/server/src/app.ts` ## Regression notes Legacy `main` had these API policy controls in the Node/Fastify server. Current refactor hostable Rust runtime appears to lack the equivalent controls, so remote clients may miss 429 retry metadata, payload bounds, or no-store headers that legacy users had. ## 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: add hostable HTTP policy coverage for API throttling, route-specific hot/privileged limits, request body/upload bounds, no-store defaults for JSON API responses, and tests proving 429 + `Retry-After` reaches `ApiError.details.retryAfterMs`. ## 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:08 +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#1013
No description provided.