Repository navigation
[AI:zf-builder] refactor(server): drop vestigial error return from newRateLimitMiddleware - #174
Merged
Merged
Conversation
…ware Task: zf-z-b28a74de refactor(server): drop vestigial error return from newRateLimitMiddleware (Ponytail Rung 1)
Deploying zerohub with
|
| Latest commit: |
06b8587
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://80da3bda.zerohub.pages.dev |
| Branch Preview URL: | https://task-zf-z-b28a74de.zerohub.pages.dev |
ntsd
commented
Nov 20, 2026
ntsd
left a comment
Contributor
Author
There was a problem hiding this comment.
[AI:zf-reviewer] [Reviewer Feedback] Round 1: Approved for human review.
Ponytail gatekeeping (7-Rung Ladder)
- Rung 1 / 6 (YAGNI & Simplicity): This PR is itself the fix — it removes a
provably-deaderrorreturn fromnewRateLimitMiddleware(the body only
picks a key getter and returns a fresh struct; thenilerror could never
fire). Dead defensive checks at both call sites are gone. No new
abstraction, wrapper, or premature interface introduced. - Rung 7 (Diff Scope & Hygiene): Tight, surgical diff — exactly the 3 files
the task names, 4 insertions / 10 deletions. No drive-by reformatting, no
unrelated churn, no leftover debug code.gofmtclean on all touched
files. - Rungs 3 & 5 (Dependency Veto): No new packages added or removed.
Correctness verification
- Signature is now
func newRateLimitMiddleware(trustProxy bool) *rateLimitMiddleware
(server/pkg/handler/ratelimit.go:118); doc comment describes only the
keying semantics (no implied error path — no comment change needed). - Repo-wide grep confirms the only two callers (
handler.go:244inServe,
ratelimit_test.go:18instartRateLimitedServer) are updated; no other
call sites remain. - Behavior is byte-for-byte identical: same struct, same key-getter selection
(remoteAddrKeyvsforwardedIPKey).
Test adequacy (auto-merge strict pass)
cd server && go build ./... && go vet ./...— PASS.go test ./pkg/handler/ -count=1— PASS, including all 8 rate-limit tests
that exercisenewRateLimitMiddlewarethroughstartRateLimitedServer
with bothtrustProxybranches
(TestRateLimitSingleKeyPerSocket,TestRateLimitDefaultIgnoresRealIPHeader,
TestRateLimitTrustProxyKeysByForwardedIP, plus 5 limiter unit tests).- Full
go test ./... -count=1server suite — PASS. - No new tests are required: the removed code paths were unreachable, and the
existing suite already covers both construction branches.
Mergeability
mergeable: MERGEABLE,mergeStateStatus: CLEAN— no conflicts with main.
Approved.
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.
[AI:zf-builder] Task: zf-z-b28a74de
refactor(server): drop vestigial error return from newRateLimitMiddleware (Ponytail Rung 1)
Automated PR for task zf-z-b28a74de
Completed by: @zf-builder