Skip to content

Conversation

@rainxchzed
Copy link
Owner

@rainxchzed rainxchzed commented Jan 12, 2026

Adds a commented-out proxy configuration block to the Ktor HttpClient engine settings. This allows for easier enabling and configuration of an HTTP proxy for debugging or network testing purposes.

Summary by CodeRabbit

  • Chores
    • Infrastructure updates to network configuration. No user-facing changes.

✏️ Tip: You can customize this high-level summary in your review settings.

Adds a commented-out proxy configuration block to the Ktor `HttpClient` engine settings. This allows for easier enabling and configuration of an HTTP proxy for debugging or network testing purposes.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

Walkthrough

Added HTTP engine configuration infrastructure to the GitHub client, including proxy builder imports and an engine block with a commented proxy setup. The proxy configuration remains disabled, preserving current behavior.

Changes

Cohort / File(s) Summary
HTTP Engine Configuration
composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/network/GitHubClient.kt
Added imports for ProxyBuilder and HTTP engine; introduced engine block in buildGitHubHttpClient with commented proxy configuration (proxy disabled via comments).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A little proxy waits in comments so sweet,
Infrastructure ready when proxy and client shall meet,
For now it sleeps, disabled and at rest,
A foundation prepared for when it does its best!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding proxy setting infrastructure to the HttpClient, matching the PR's objective of introducing proxy configuration capability.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
@composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/network/GitHubClient.kt:
- Around line 42-44: The engine { } block in GitHubClient.kt cannot live in
commonMain because Ktor engines are platform-specific; remove the engine { }
configuration from the common HttpClient creation (e.g., from
buildGitHubHttpClient() / HttpClient in GitHubClient) and implement the engine
in platform-specific source sets instead using either an expect/actual
buildGitHubHttpClient() pair or by creating the HttpClient with the platform
engine in androidMain/iosMain and calling a shared function in commonMain to
install common features; also ensure any proxy URL is populated before
re-enabling the proxy line.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63f0c11 and 2d04b38.

📒 Files selected for processing (1)
  • composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/network/GitHubClient.kt
🔇 Additional comments (1)
composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/network/GitHubClient.kt (1)

8-9: Imports are correctly added for proxy support.

The imports for ProxyBuilder and http are valid Ktor utilities for proxy configuration. They will be used when the proxy line is uncommented.

Comment on lines +42 to +44
engine {
// proxy = ProxyBuilder.http("")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's locate and read the GitHubClient.kt file
fd "GitHubClient.kt" --type f

Repository: rainxchzed/Github-Store

Length of output: 147


🏁 Script executed:

# Once we have the path, let's examine the code around lines 42-44 and the HttpClient setup
cat -n composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/network/GitHubClient.kt | head -60

Repository: rainxchzed/Github-Store

Length of output: 2602


🌐 Web query:

Ktor HttpClient engine block configuration Kotlin Multiplatform commonMain

💡 Result:

Short answer
You cannot configure a platform-specific engine (the engine { ... } block) from commonMain. Engine configuration is platform-specific, so create the HttpClient (or at least supply the engine) in each platform source set and keep common installs/configuration in commonMain.

Why

  • Ktor engines are platform-specific and their config types live in platform modules, not commonMain. [1]
  • Use expect/actual or provide a factory implemented in platformMain to supply an HttpClient or engine. [2][3]

Minimal patterns

  1. Preferred — create client per platform, share common setup
  • commonMain:
    • put shared installs and helper functions that accept HttpClient.
    • optionally expose an expect factory.

Example (commonMain)
expect fun createHttpClient(): HttpClient
// shared code uses createHttpClient()

  • androidMain / iosMain (actual):
    actual fun createHttpClient(): HttpClient = HttpClient(Android) {
    // engine-specific options here
    engine { connectTimeout = 100_000; socketTimeout = 100_000 }
    // common installs also allowed here if desired
    }
  1. Alternative — create engine-less client in common and supply engine in platform
  • commonMain:
    fun createSharedClient(configure: HttpClientConfig<>.() -> Unit = {}): HttpClient =
    HttpClient { configure(); /
    shared installs here */ }

  • platformMain:
    val client = HttpClient(Android) { engine { /* AndroidEngineConfig / }; / call or duplicate shared installs if needed */ }

Notes

  • Keep protocol-level installs (Json, Logging, HttpTimeout, Auth) in commonMain. Configure engine details (timeouts, proxy, OkHttp/Android/Darwin options) only in platformMain. [1][3]
  • Use expect/actual or dependency injection to avoid duplicating shared install code. [2][3]

Sources

  • Ktor client engines and engine configuration. [1]
  • Kotlin Multiplatform expect/actual guidance. [2]
  • Community discussion confirming engine config must live in platform source sets. [3]

Move engine {} configuration to platform-specific source sets.

Engine configuration is platform-specific in Ktor and cannot be configured in commonMain. The engine {} block requires a concrete engine type, which is not available in the common source set.

Move engine configuration to platform-specific source sets (androidMain, iosMain, etc.) using either:

  1. expect/actual pattern for buildGitHubHttpClient()
  2. Per-platform HttpClient creation with shared install logic in commonMain

Additionally, ensure the proxy URL is populated (currently an empty string) before uncommenting.

🤖 Prompt for AI Agents
In
@composeApp/src/commonMain/kotlin/zed/rainxch/githubstore/network/GitHubClient.kt
around lines 42 - 44, The engine { } block in GitHubClient.kt cannot live in
commonMain because Ktor engines are platform-specific; remove the engine { }
configuration from the common HttpClient creation (e.g., from
buildGitHubHttpClient() / HttpClient in GitHubClient) and implement the engine
in platform-specific source sets instead using either an expect/actual
buildGitHubHttpClient() pair or by creating the HttpClient with the platform
engine in androidMain/iosMain and calling a shared function in commonMain to
install common features; also ensure any proxy URL is populated before
re-enabling the proxy line.

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.

2 participants