fix(relay): satisfy clippy lint warnings on admin auth changes - #4630
Merged
elifoster-block merged 1 commit intoAug 3, 2026
Conversation
`authorize_request` returned `Result<(), Response>`, tripping `clippy::result_large_err` (the axum `Response` Err variant is >=128 bytes). Return `ApiError` instead and convert at the two call sites. Also drops a redundant closure in the config test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Eli Foster <efoster@squareup.com>
elifoster-block
merged commit Aug 3, 2026
dc2df16
into
block:codex/security-admin-host-origin-auth
3 checks passed
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.
Stacked on #4606 — targets
codex/security-admin-host-origin-auth, notmain.#4606 fails Rust Lint and Windows Rust on two clippy errors under
-D warnings. Neither is a real bug; both are style rules the repo enforces strictly enough to block a merge. No user-visible behavior changes.1.
clippy::result_large_errcrates/buzz-relay/src/api/admin/mod.rs:30A
Resultis always sized to fit its larger variant, and it gets moved on every return — including the success path.authorize_requestreturnedResult<(), Response>: nothing on success, a fully-built axumResponse(≥128 bytes) on failure. So every successful admin request was carrying a 128-byte payload to deliver zero bytes.The fix stops building the HTTP response inside that function. It now returns
ApiError— a status code, two&'static str, and a bool — and the tworouter.rscall sites convert with.into_response()at the point they actually need a response. Same responses go out; the expensive object is constructed one frame later, only on the failure path.admin::errorwas promoted topub(crate) modas bookkeeping for that: once apub(crate) fnhandsApiErrorback, the type has to be nameable by its callers, or Rust flags it as a private interface leak.2.
clippy::redundant_closurecrates/buzz-relay/src/config.rs:1122, in a test.Identical behavior, one less layer.
Why the two jobs reported different errors
Rust Lint (Linux) hit #1 and bailed before compiling the test target, so it never saw #2. Windows Rust compiles
lib testand caught both.Testing
Not built locally — no Rust toolchain on the authoring machine, so clippy never ran before push. Relying on CI. Staying a draft until Rust Lint and Windows Rust are green.