[PR #4410] [MERGED] Mod registry: answer refused submissions after the upload, JSON 413, name a slow GitHub #5612

Closed
opened 2026-11-03 05:13:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4410
Author: @ludovic111
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ludovic111

Base: main ← Head: fix/mod-submit-errors


📝 Commits (1)

  • b086d42 Mod registry: answer refused submissions after the upload, JSON 413, name a slow GitHub

📊 Changes

5 files changed (+207 additions, -37 deletions)

View changed files

📝 crates/horizon-mod-registry/Cargo.toml (+2 -1)
📝 crates/horizon-mod-registry/README.md (+4 -0)
📝 crates/horizon-mod-registry/src/github.rs (+37 -1)
📝 crates/horizon-mod-registry/src/lib.rs (+87 -24)
📝 crates/horizon-mod-registry/tests/submit.rs (+77 -11)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Why

A contributor's submissions on playhorizon.dev/mods/submit failed with "The service didn't answer" (2026-10-30, 13:06–13:09Z). Railway's http logs show all ten requests ending as 499 ("client has closed the request") after 1 ms. The browser aborted each upload before sending any of the file, because the picked file had changed on disk since it was picked. That client-side cause is fixed in horizon-rust/horizon-site#23 (merged).

While reproducing it I found a related gap here: the registry could also produce "didn't answer" on its own.

  • Refusing before the body was read. A submission refused before its body was read (signed out, CSRF, the hourly limit), or partway through (a file over 64 MiB), got its answer while the browser was still uploading. The connection was then closed with the rest unread, so the browser reported a network error instead of the reason. The new test a_refusal_waits_for_the_upload shows it over a real TCP connection: without the drain, the client's upload fails with BrokenPipe.
  • One 60 s timeout for everything. That included a 64 MiB upload to GitHub. A timeout came back as the generic "GitHub didn't answer as expected".

What changes

  • Draining. A refused submission now reads and drops the rest of the upload, capped at the body limit, before it answers. A request whose Content-Length is already over the limit is answered 413 at once and is not drained.
  • 413 in JSON. A file over 64 MiB gets 413 with {"error": "the file is over 64 MiB"}. That holds both for our own check and for axum's body limit (it was a 400 before).
  • GitHub timeouts. Each call gets 30 s, the file's upload to the staging release gets 5 min, and connecting gets 10 s. A call that times out returns 504 {"error": "GitHub is slow right now: try again in a few minutes"}.
  • README. Documents the error answers.

Tests (mock GitHub, tests/submit.rs):

  • 413 for a file just over MAX_FILE and for one over the whole body's limit;
  • 504 with the message for a GitHub that is slower than call_timeout;
  • the TCP drain test.

cargo test, cargo clippy --all-targets -D warnings and cargo fmt --check pass in the crate's own workspace.

Deploy: Railway rebuilds horizon-mod-registry from main because of railway.json's watchPatterns (/crates/horizon-mod-registry/**). Merging redeploys it; no manual step is needed.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at d5f484c89, 9 min 28 s)

Check Result
Scope ✅ 5 files, +207 −37
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (1 min 25 s)
rustfmt ✅ (5 s)
clippy ✅ (2 min 40 s)
tests: workspace ✅ 2659 passed (4 min 6 s)
doc tests ✅ 0 passed (7 s)
content root tests ✅ 5 passed (1 min 2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The 1 affected parity harness (lan_integration) runs in CI. The registry crate is its own workspace; its CI is mod-registry.yml.

🤖 Generated with Claude Code


🔄 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/horizon-rust/horizon/pull/4410 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mod-submit-errors` --- ### 📝 Commits (1) - [`b086d42`](https://github.com/horizon-rust/horizon/commit/b086d4298b9974e4878a79caf96148e9772ea020) Mod registry: answer refused submissions after the upload, JSON 413, name a slow GitHub ### 📊 Changes **5 files changed** (+207 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-mod-registry/Cargo.toml` (+2 -1) 📝 `crates/horizon-mod-registry/README.md` (+4 -0) 📝 `crates/horizon-mod-registry/src/github.rs` (+37 -1) 📝 `crates/horizon-mod-registry/src/lib.rs` (+87 -24) 📝 `crates/horizon-mod-registry/tests/submit.rs` (+77 -11) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## Why A contributor's submissions on playhorizon.dev/mods/submit failed with "The service didn't answer" (2026-10-30, 13:06–13:09Z). Railway's http logs show all ten requests ending as 499 ("client has closed the request") after 1 ms. The browser aborted each upload before sending any of the file, because the picked file had changed on disk since it was picked. That client-side cause is fixed in horizon-rust/horizon-site#23 (merged). While reproducing it I found a related gap here: the registry could also produce "didn't answer" on its own. - **Refusing before the body was read.** A submission refused before its body was read (signed out, CSRF, the hourly limit), or partway through (a file over 64 MiB), got its answer while the browser was still uploading. The connection was then closed with the rest unread, so the browser reported a network error instead of the reason. The new test `a_refusal_waits_for_the_upload` shows it over a real TCP connection: without the drain, the client's upload fails with `BrokenPipe`. - **One 60 s timeout for everything.** That included a 64 MiB upload to GitHub. A timeout came back as the generic "GitHub didn't answer as expected". ## What changes - **Draining.** A refused submission now reads and drops the rest of the upload, capped at the body limit, before it answers. A request whose `Content-Length` is already over the limit is answered 413 at once and is not drained. - **413 in JSON.** A file over 64 MiB gets 413 with `{"error": "the file is over 64 MiB"}`. That holds both for our own check and for axum's body limit (it was a 400 before). - **GitHub timeouts.** Each call gets 30 s, the file's upload to the staging release gets 5 min, and connecting gets 10 s. A call that times out returns 504 `{"error": "GitHub is slow right now: try again in a few minutes"}`. - **README.** Documents the error answers. Tests (mock GitHub, `tests/submit.rs`): - 413 for a file just over `MAX_FILE` and for one over the whole body's limit; - 504 with the message for a GitHub that is slower than `call_timeout`; - the TCP drain test. `cargo test`, `cargo clippy --all-targets -D warnings` and `cargo fmt --check` pass in the crate's own workspace. Deploy: Railway rebuilds `horizon-mod-registry` from `main` because of `railway.json`'s watchPatterns (`/crates/horizon-mod-registry/**`). Merging redeploys it; no manual step is needed. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at d5f484c89, 9 min 28 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +207 −37 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (1 min 25 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (2 min 40 s) | | tests: workspace | ✅ 2659 passed (4 min 6 s) | | doc tests | ✅ 0 passed (7 s) | | content root tests | ✅ 5 passed (1 min 2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The 1 affected parity harness (`lan_integration`) runs in CI. The registry crate is its own workspace; its CI is `mod-registry.yml`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:46 +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
horizon-rust/horizon#5612
No description provided.