fix: upgrade Ktor for coroutines 1.11 - #44
Merged
Conversation
zhukaihan
requested review from
vaibhav-jain-exp
and
a balanced review from Copilot
and removed request for
Copilot
August 27, 2026 18:54
There was a problem hiding this comment.
Pull request overview
Upgrades the Kotlin/Ktor stack for coroutines 1.11 compatibility and migrates affected server APIs and build configuration.
Changes:
- Upgrades Ktor, Kotlin, serialization, coroutines, and Gradle.
- Migrates Ktor 3 request-body, logging, shutdown, and test APIs.
- Adds regression tests for POST body parsing and the OkHttp engine.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
build.gradle.kts |
Updates the root Kotlin plugin. |
gradle.properties |
Centralizes upgraded dependency versions. |
gradle/wrapper/gradle-wrapper.properties |
Upgrades Gradle to 8.11.1. |
gradlew |
Updates the Unix wrapper script. |
gradlew.bat |
Updates the Windows wrapper script. |
core/build.gradle.kts |
Migrates compiler settings and serialization plugin. |
core/src/main/kotlin/cohort/CohortApi.kt |
Removes an obsolete Ktor import. |
core/src/test/kotlin/project/ProjectApiTest.kt |
Adds a real OkHttp regression test. |
service/build.gradle.kts |
Upgrades plugins and replaces the server test artifact. |
service/src/main/kotlin/Server.kt |
Migrates request-body and shutdown APIs. |
service/src/main/kotlin/plugins/Monitoring.kt |
Updates the CallLogging package. |
service/src/test/kotlin/ServerTest.kt |
Tests Ktor 3 request-body parsing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
vaibhav-jain-exp
approved these changes
Aug 28, 2026
vaibhav-jain-exp
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Verify load test runs before merging.
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.
Summary
Ktor 3 migration guide audit
Verified against the official guide: https://ktor.io/docs/migrating-3.html
Applicable changes:
The repository does not use the other affected APIs in the guide: legacy ApplicationEngineEnvironment builders, withTestApplication/withApplication, Locations, WebSockets duration configuration, socket bind, multipart/file APIs, session encryption, HttpResponse.content, SocketTimeoutException, AttributeKey type mismatches, or the removed empty io.ktor:ktor artifact. The existing embeddedServer and streamed cohort bodyAsChannel/toInputStream paths compile and test successfully on Ktor 3.3.3.
Compiler verification also identified required Ktor 3.3.3 adjustments for ShutDownUrl and ktor-server-test-host.
Verification
Context: https://amplitude.slack.com/archives/C016HQFUASD/p1787608443150739
Note
Medium Risk
Large dependency bump (Ktor 2→3, Kotlin 2.2) changes how POST evaluation requests read JSON bodies; risk is mitigated by targeted tests but still warrants careful review of vardata POST paths.
Overview
Upgrades the build stack to Kotlin 2.2.21, Ktor 3.3.3, kotlinx-coroutines 1.11.0, and kotlinx-serialization 1.9.0, with Gradle 8.11.1 and the Kotlin
compilerOptionsJVM target DSL replacing deprecatedkotlinOptions.Ktor 3 follow-ups in runtime code: CallLogging import package fix,
ShutDownUrlconstructor API, and POST user parsing now usescall.receiveText()instead of the removedio.ktor.util.toByteArrayon the request channel. Service tests switch fromktor-server-tests-jvmtoktor-server-test-host-jvm.Adds regression coverage: a loopback OkHttp
ProjectApitest (coroutines 1.11) and atestApplicationtest forgetUserFromBody.Reviewed by Cursor Bugbot for commit 34ce619. Bugbot is set up for automated code reviews on this repo. Configure here.