Skip to content

feat(git): configure upstream request scheme - #6

Merged
jhaynie merged 2 commits into
mainfrom
feat/git-upstream-scheme
Aug 14, 2026
Merged

feat(git): configure upstream request scheme#6
jhaynie merged 2 commits into
mainfrom
feat/git-upstream-scheme

Conversation

@jhaynie

@jhaynie jhaynie commented Aug 14, 2026

Copy link
Copy Markdown
Member

Summary

  • add git.Config.UpstreamScheme with http and https overrides
  • preserve request TLS inference when the value is empty
  • use one scheme resolver for streaming and buffered upstream requests
  • reject invalid values in Config.Validate and git.New

Verification

  • go test ./...
  • go vet ./...
  • go test -race ./git

Summary by CodeRabbit

  • New Features
    • Added configuration to select the scheme (http or https) used for upstream requests.
    • When no scheme is configured, upstream requests automatically match the incoming request’s security scheme.
  • Bug Fixes
    • Invalid upstream scheme values are now rejected during configuration validation.
    • Scheme selection is applied consistently to streaming and buffered requests.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 622410c2-b1c1-4e72-acc0-bd8ee8fa0bec

📥 Commits

Reviewing files that changed from the base of the PR and between 59eba86 and db46420.

📒 Files selected for processing (1)
  • git/config_test.go

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c8cc4eda-8592-4057-b864-2db3e398903d

📥 Commits

Reviewing files that changed from the base of the PR and between 48c0fe8 and 59eba86.

📒 Files selected for processing (3)
  • git/config_test.go
  • git/git.go
  • git/handler.go
📜 Recent review details
🧰 Additional context used
🪛 golangci-lint (2.12.2)
git/config_test.go

[error] 145-145: Error return value of resp.Body.Close is not checked

(errcheck)


[error] 110-110: net/http/httptest.NewRequest must not be called. use net/http/httptest.NewRequestWithContext

(noctx)

🔇 Additional comments (6)
git/git.go (1)

84-88: LGTM!

Also applies to: 190-192, 364-366, 380-386

git/config_test.go (4)

4-10: LGTM!

Also applies to: 44-84, 160-163


86-109: LGTM!

Also applies to: 111-144, 146-158


110-110: 📐 Maintainability & Code Quality

Use the context-aware request constructor.

Line 110 triggers the reported noctx violation. If golangci-lint is a merge gate, this test fails lint. Replace httptest.NewRequest with httptest.NewRequestWithContext after confirming that the declared Go target supports the selected context source.

Source: Linters/SAST tools


145-145: 📐 Maintainability & Code Quality

Handle the response body close error.

Line 145 triggers the reported errcheck violation. If golangci-lint is a merge gate, this test fails lint. Check and report the error from resp.Body.Close().

Source: Linters/SAST tools

git/handler.go (1)

534-534: LGTM!

Also applies to: 549-549, 562-570


📝 Walkthrough

Walkthrough

Changes

The proxy now supports a configurable upstream request scheme. It validates the option during configuration and applies it to streaming and buffered requests, with fallback to the incoming request’s TLS state.

Upstream scheme configuration

Layer / File(s) Summary
Scheme option and validation
git/git.go, git/config_test.go
Config.UpstreamScheme accepts empty, http, or https. New and Config.Validate reject other values. Tests cover defaults and validation errors.
Upstream request scheme resolution
git/handler.go, git/config_test.go
Streaming and buffered requests use the configured scheme or derive http or https from the incoming request. Tests capture upstream URLs and request bodies.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

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

@jhaynie
jhaynie merged commit 289e141 into main Aug 14, 2026
3 checks passed
@jhaynie
jhaynie deleted the feat/git-upstream-scheme branch August 14, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant