refactor(core): remove inert maxServeErrors option (#278) - #308
Merged
Conversation
`maxServeErrors` was documented as "consecutive accept-loop errors before the serve loop terminates (default 5)" and plumbed from the JS API through every adapter into core `ServeOptions.max_serve_errors`, but the accept loop never consumed it. Wiring it turns out to be unsafe: in iroh, `Endpoint::accept()` returns `Option` (`None` = endpoint closed, already handled), so the only accept-loop error is a per-connection QUIC handshake failure. Terminating the loop on a run of those would let any peer kill a server with a short burst of connection resets — a trivial DoS — and directly contradicts the `accept_loop_survives_connect_reset_flood` resilience invariant. There is no safe systemic-error surface for the option to react to, so it is dead weight. Remove it entirely: core `ServeOptions`, the node/deno/tauri adapter serve-option shapes, the `iroh-http-shared` types, the docs (spec, tuning, server-limits), and the `serve_options_defaults` assertion. No behavior change (the option was inert); the resilience invariant is untouched. Closes #278 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
momics
force-pushed
the
momics-wire-max-serve-errors
branch
from
July 6, 2026 14:15
1a4b252 to
3fffb10
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maxServeErrorswas documented as "consecutive accept-loop errors before the serve loop terminates (default 5)" and plumbed from the JS API through every adapter into coreServeOptions.max_serve_errors— but the accept loop never consumed it (#278).Per maintainer decision, this removes the option entirely rather than wiring it.
Why remove instead of wire
In iroh,
Endpoint::accept()returnsOption(None= endpoint closed, already handled), so the only accept-loop error is a per-connection QUIC handshake failure. Terminating the serve loop on a run of those would let any peer kill a server with a short burst of connection resets — a trivial DoS — and directly contradicts the existingaccept_loop_survives_connect_reset_floodresilience invariant (which requires the loop to survive exactly that). There is no safe systemic-error surface for the option to act on, so it was dead weight.Changes
max_serve_errorsfromServeOptions(options.rs) and theserve_options_defaultsassertion (endpoint.rs).src/lib.rs+ generatedindex.d.ts), deno (dispatch.rs), tauri (commands.rs+guest-js/index.ts), andiroh-http-shared(IrohAdapter.ts,serve.ts).specification.md,tuning.md,server-limits.md.tests/resilience.rs::accept_loop_survives_connect_reset_floodstays as the invariant.No behavior change (the option was inert).
grepconfirms zero remainingmaxServeErrors/max_serve_errorsreferences.Verification
npm run ci→ All checks passed (fmt, clippy, rust/tauri/node/deno tests, interop). Build churn reverted (index.jscodegen,deno.lock);package-lock.jsonclean. No version-field bumps.Closes #278