[PR #2338] [MERGED] Preserve invoke rate-limit headers #5540

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/invoke-rate-limit-headers-2332


📝 Commits (1)

  • 5c30931 Preserve invoke rate-limit headers

📊 Changes

1 file changed (+47 additions, -1 deletions)

View changed files

📝 src-tauri/src/http_server.rs (+47 -1)

📄 Description

Linked issue

Closes #2332

Why this change

  • /api/invoke responses were losing command-specific rate-limit advisory headers because the API middleware reapplied the coarse pre-extraction bucket after the handler set the command bucket.

What changed

  • Preserve handler-owned ratelimit-* headers when present after /api/invoke dispatch.
  • Added a router-level regression test that exercises the production middleware path and verifies update_apply reports its command-specific limit.

Refactor impact

Primary owner:

Rust remote runtime / HTTP server

Impact areas reviewed:

  • /api/invoke middleware rate-limit headers
  • Command-specific invoke rate-limit enforcement
  • API security and no-store header application order

Boundary notes:

  • Rust-only server runtime change in src-tauri/src/http_server.rs.
  • No React, engine, shared API, storage schema, or command-registration boundary changes.

Pressure points touched:

  • None.

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

  • Red repro before fix: cargo test --manifest-path src-tauri/Cargo.toml api_invoke_router_preserves_command_specific_rate_limit_headers -- --nocapture failed with ratelimit-limit returning 6000 instead of 5.
  • After fix: cargo test --manifest-path src-tauri/Cargo.toml api_invoke_ -- --nocapture passed.
  • cargo check --manifest-path src-tauri/Cargo.toml passed.
  • cargo fmt --manifest-path src-tauri/Cargo.toml --check passed.
  • git diff --check passed.
  • pnpm check passed.

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:

  • Server runtime advisory-header bugfix only; no new user-discoverable behavior.

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; server runtime header fix only.


🔄 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/2338 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/invoke-rate-limit-headers-2332` --- ### 📝 Commits (1) - [`5c30931`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5c3093192b1da2d44337264b39b77a8958422759) Preserve invoke rate-limit headers ### 📊 Changes **1 file changed** (+47 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/http_server.rs` (+47 -1) </details> ### 📄 Description ## Linked issue Closes #2332 ## Why this change - `/api/invoke` responses were losing command-specific rate-limit advisory headers because the API middleware reapplied the coarse pre-extraction bucket after the handler set the command bucket. ## What changed - Preserve handler-owned `ratelimit-*` headers when present after `/api/invoke` dispatch. - Added a router-level regression test that exercises the production middleware path and verifies `update_apply` reports its command-specific limit. ## Refactor impact Primary owner: Rust remote runtime / HTTP server Impact areas reviewed: - `/api/invoke` middleware rate-limit headers - Command-specific invoke rate-limit enforcement - API security and no-store header application order Boundary notes: - Rust-only server runtime change in `src-tauri/src/http_server.rs`. - No React, engine, shared API, storage schema, or command-registration boundary changes. Pressure points touched: - None. ## 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 - Red repro before fix: `cargo test --manifest-path src-tauri/Cargo.toml api_invoke_router_preserves_command_specific_rate_limit_headers -- --nocapture` failed with `ratelimit-limit` returning `6000` instead of `5`. - After fix: `cargo test --manifest-path src-tauri/Cargo.toml api_invoke_ -- --nocapture` passed. - `cargo check --manifest-path src-tauri/Cargo.toml` passed. - `cargo fmt --manifest-path src-tauri/Cargo.toml --check` passed. - `git diff --check` passed. - `pnpm check` passed. ## 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: - Server runtime advisory-header bugfix only; no new user-discoverable behavior. ## 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 ## UI evidence N/A; server runtime header fix only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17: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#5540
No description provided.