Skip to content

🧹 chore: copy the forwarder name before storing it in the refused-request test - #4819

Merged
ReneWerner87 merged 1 commit into
mainfrom
fix/proxy-refused-test-key-copy
Oct 29, 2026
Merged

ReneWerner87 merged 1 commit into
mainfrom
fix/proxy-refused-test-key-copy

Conversation

@ReneWerner87

@ReneWerner87 ReneWerner87 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Test_Proxy_RefusedRequestIsNotForwarded failed in a CI run on #4799: the DomainForward subtest got a 200 from the upstream, but hits.Load("DomainForward accepted") found nothing.

The upstream handler stored c.Get("X-Forwarder") as the map key. That string points into the request header buffer, and Forward, DomainForward and BalancerForward share one client, so a later subtest's request that reuses the idle upstream connection overwrites the stored key in place ("DomainForward accepted" reads back as "Forward acceptedcepted"). The key is now copied with utils.CopyString.

Tests

  • Sending the DomainForward request and then the Forward request one after the other misses the key every time with the old handler and finds it with the copy.
  • go test -race -shuffle=on ./middleware/proxy/ and golangci-lint are clean.

🤖 Maintainers: /generate re-runs the code generators on this branch

Copilot AI balanced review requested due to automatic review settings October 29, 2026 20:11
@ReneWerner87
ReneWerner87 requested a review from a team as a code owner October 29, 2026 20:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T20:12:34.188366Z 0c0e410 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ced9c0a1-e105-4be9-9e06-b6ea4fb13501
Commits

Reviewing files that changed from the base of the PR and between 50ac995 and 0c0e410.

Files selected for processing: 1
  • middleware/proxy/proxy_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The refused-request test now copies the X-Forwarder value before storing it in hits.

Changes

Proxy test update

Layer / File(s) Summary
Copy header value in test capture
middleware/proxy/proxy_test.go
The test copies the value returned by c.Get before storing it in hits.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: gaby

Merge Risk: Minimal · up to 0c0e4

No merge-blocking risk remains from this change.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly describes the test change: copy the forwarder name before storing it. It is specific and relevant, though somewhat long.
Description check Passed The description explains the failure, its cause, the fix, and the reported tests. It omits several template sections and checklists, but includes the main information needed for this focused test chan…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the failure, its cause, the fix, and the reported tests. It omits several template sections and checklists, but includes the main information needed for this focused test change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the proxy test,
And copies headers for the best.
The value hops into its place,
Stored safely in the test’s embrace.
Then thumps its feet and takes a rest.

Comment @coderabbitai help to get the list of available commands.

@ReneWerner87 ReneWerner87 added this to v3 Oct 29, 2026
@ReneWerner87 ReneWerner87 added this to the v3 milestone Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.86%. Comparing base (50ac995) to head (0c0e410).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4819   +/-   ##
=======================================
  Coverage   95.86%   95.86%           
=======================================
  Files         153      153           
  Lines       19312    19312           
=======================================
  Hits        18513    18513           
- Misses        499      500    +1     
+ Partials      300      299    -1     
Flag Coverage Δ
unittests 95.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ReneWerner87
ReneWerner87 merged commit f137170 into main Oct 29, 2026
33 checks passed
@ReneWerner87
ReneWerner87 deleted the fix/proxy-refused-test-key-copy branch October 29, 2026 20:18
@github-project-automation github-project-automation Bot moved this to Done in v3 Oct 29, 2026
@ReneWerner87 ReneWerner87 modified the milestones: v3, v3.7.0 Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants