-
Notifications
You must be signed in to change notification settings - Fork 344
Update kxrpc tutorial to 0.10.0 #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughBumps Kotlin, Ktor, and kotlinx-rpc plugin/dependencies to newer versions, changes Client HttpClient KRPC install to configure JSON serialization, and adjusts tutorial code-block include line ranges in the topic file. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt (1)
9-9
: Remove duplicate import.The same import
kotlinx.rpc.krpc.serialization.json.json
appears on both Line 9 and Line 14.Apply this diff to remove the duplicate:
import kotlinx.rpc.krpc.ktor.client.KtorRpcClient import kotlinx.rpc.krpc.ktor.client.installKrpc import kotlinx.rpc.krpc.ktor.client.rpc import kotlinx.rpc.krpc.ktor.client.rpcConfig -import kotlinx.rpc.krpc.serialization.json.json
Also applies to: 14-14
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
codeSnippets/snippets/tutorial-kotlin-rpc-app/build.gradle.kts
(2 hunks)codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
(1 hunks)topics/tutorial-first-steps-with-kotlin-rpc.topic
(7 hunks)
🔇 Additional comments (2)
codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt (1)
18-20
: LGTM! Serialization configuration updated correctly.The change from
waitForServices = true
to explicit JSON serialization configuration aligns with the 0.10.0 API.codeSnippets/snippets/tutorial-kotlin-rpc-app/build.gradle.kts (1)
17-22
: LGTM! Dependency versions updated consistently.All kotlinx-rpc dependencies have been updated to version 0.10.0 consistently, which aligns with the plugin version update.
kotlin("jvm") version "2.2.20" | ||
kotlin("plugin.serialization") version "2.2.20" | ||
id("io.ktor.plugin") version "3.3.0" | ||
id("org.jetbrains.kotlinx.rpc.plugin") version "0.10.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify plugin versions exist and check for security advisories.
The plugin versions have been updated to:
- Kotlin: 2.2.20
- Ktor: 3.3.0
- kotlinx-rpc: 0.10.0
Ensure these versions are valid and check for any associated security advisories.
Run the following script to verify the versions:
🏁 Script executed:
#!/bin/bash
# Verify Kotlin version 2.2.20 exists
echo "=== Checking Kotlin 2.2.20 ==="
curl -s "https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/2.2.20/" | grep -q "2.2.20" && echo "✓ Kotlin 2.2.20 exists" || echo "✗ Kotlin 2.2.20 not found"
# Verify Ktor version 3.3.0 exists
echo -e "\n=== Checking Ktor 3.3.0 ==="
curl -s "https://repo1.maven.org/maven2/io/ktor/ktor-gradle-plugin/3.3.0/" | grep -q "3.3.0" && echo "✓ Ktor 3.3.0 exists" || echo "✗ Ktor 3.3.0 not found"
# Verify kotlinx-rpc version 0.10.0 exists
echo -e "\n=== Checking kotlinx-rpc 0.10.0 ==="
curl -s "https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-rpc-krpc-client/0.10.0/" | grep -q "0.10.0" && echo "✓ kotlinx-rpc 0.10.0 exists" || echo "✗ kotlinx-rpc 0.10.0 not found"
# Check for security advisories
echo -e "\n=== Checking for security advisories ==="
gh api graphql -f query='
{
securityVulnerabilities(first: 10, ecosystem: MAVEN, package: "org.jetbrains.kotlin:kotlin-gradle-plugin") {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
firstPatchedVersion {
identifier
}
}
}
}'
Length of output: 262
Fix invalid Ktor plugin version: id("io.ktor.plugin") version "3.3.0"
is not published on Maven Central. Update to a valid release (see https://repo1.maven.org/maven2/io/ktor/ktor-gradle-plugin/).
🤖 Prompt for AI Agents
In codeSnippets/snippets/tutorial-kotlin-rpc-app/build.gradle.kts around lines 2
to 5, the Ktor Gradle plugin version "3.3.0" is invalid (not published); replace
it with a published release by updating the id("io.ktor.plugin") version to a
valid version from Maven Central (check
https://repo1.maven.org/maven2/io/ktor/ktor-gradle-plugin/ for available
versions) and ensure the chosen version is compatible with the Kotlin and
serialization plugin versions in the file.
<code-block lang="kotlin" | ||
src="snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt" | ||
include-lines="1-13,14-37,39-40,59-60" | ||
include-lines="1-14,15-38,40-41,60-61" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify that the updated line ranges correctly reflect the Client.kt changes.
Multiple include-lines
attributes have been updated to account for the new import and serialization configuration in Client.kt. Ensure these line ranges accurately match the intended code sections.
Run the following script to verify the line ranges:
Also applies to: 242-242, 254-254, 263-263, 279-279, 291-291, 497-497, 505-505
🏁 Script executed:
#!/bin/bash
# Extract and display the specified line ranges from Client.kt
echo "=== Lines 1-14 (imports section) ==="
sed -n '1,14p' codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
echo -e "\n=== Lines 15-38 (main function setup) ==="
sed -n '15,38p' codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
echo -e "\n=== Lines 40-41 (commented pizza order) ==="
sed -n '40,41p' codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
echo -e "\n=== Line 60 (client close) ==="
sed -n '60p' codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
echo -e "\n=== Lines 43-50 (multiple orders) ==="
sed -n '43,50p' codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
echo -e "\n=== Lines 52-58 (collect results) ==="
sed -n '52,58p' codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt
Length of output: 1817
🏁 Script executed:
#!/bin/bash
topic="topics/tutorial-first-steps-with-kotlin-rpc.topic"
client="codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt"
# 1. Confirm closing brace at line 61
echo "=== Lines 59-62 (closing brace check) ==="
sed -n '59,62p' "$client"
# 2. For each updated include-lines (topic lines 222,242,254,263,279,291,497,505), extract and display code segments
grep -n 'include-lines="' "$topic" | grep -E ':(222|242|254|263|279|291|497|505):' | while IFS=: read path line attr; do
ranges=$(echo "$attr" | sed -E 's/.*include-lines="([^"]+)".*/\1/')
echo -e "\n=== topic:$line → include-lines=\"$ranges\" ==="
IFS=, read -ra parts <<< "$ranges"
for r in "${parts[@]}"; do
echo "--- Client.kt lines $r ---"
sed -n "${r}p" "$client"
done
done
Length of output: 67
🏁 Script executed:
#!/bin/bash
grep -n 'include-lines=' topics/tutorial-first-steps-with-kotlin-rpc.topic
Length of output: 1035
🏁 Script executed:
#!/bin/bash
client="codeSnippets/snippets/tutorial-kotlin-rpc-app/src/main/kotlin/Client.kt"
echo "=== Lines 17-21 ==="
sed -n '17,21p' "$client"
echo -e "\n=== Lines 23-35 ==="
sed -n '23,35p' "$client"
echo -e "\n=== Line 37 ==="
sed -n '37p' "$client"
echo -e "\n=== Lines 40-41 ==="
sed -n '40,41p' "$client"
echo -e "\n=== Lines 43-50 ==="
sed -n '43,50p' "$client"
echo -e "\n=== Lines 52-58 ==="
sed -n '52,58p' "$client"
echo -e "\n=== Line 60 ==="
sed -n '60p' "$client"
Length of output: 1207
🏁 Script executed:
#!/bin/bash
sed -n '230,260p' topics/tutorial-first-steps-with-kotlin-rpc.topic
Length of output: 1874
Update runBlocking snippet range
In topics/tutorial-first-steps-with-kotlin-rpc.topic at the snippet on line 242, change include-lines="16,61" to include-lines="15,61" so the runBlocking
invocation (fun main() = runBlocking {
) is shown.
🤖 Prompt for AI Agents
In topics/tutorial-first-steps-with-kotlin-rpc.topic around lines 222 to 222,
the snippet include-lines attribute currently uses "16,61" which omits the
runBlocking invocation; update the include-lines value to "15,61" so the snippet
shows the `fun main() = runBlocking {` line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update, @Mr3zee ! 🙏
No description provided.