Conversation
Reviewer's GuideRefines project and module documentation, clarifies contribution workflow, and introduces platform-specific browser detection to adjust MSMP WebSocket authentication headers for browser vs non-browser environments. Sequence diagram for MSMP WebSocket connection header selectionsequenceDiagram
participant MsmpLifecycleManager
participant WebSocketClient
participant WebSocketServer
MsmpLifecycleManager->>WebSocketClient: webSocketSession(target, config)
alt isBrowser true
WebSocketClient-->>WebSocketServer: CONNECT with header SecWebSocketProtocol: minecraft-v1,token
else isBrowser false
WebSocketClient-->>WebSocketServer: CONNECT with header Authorization: Authorization token
end
WebSocketServer-->>WebSocketClient: WebSocketSession established or failure
WebSocketClient-->>MsmpLifecycleManager: Boolean connectionResult
Class diagram for platform browser detection and MSMP lifecycle usageclassDiagram
class MsmpLifecycleManager {
-target String
-token String
-config MsmpClientConfig
+connectSession() Boolean
}
class PlatformEnvironment {
<<interface>>
+isBrowser Boolean
}
class CommonPlatform {
+isBrowser Boolean
}
class JsPlatform {
+isBrowser Boolean
}
class WasmJsPlatform {
+isBrowser Boolean
}
class JvmPlatform {
+isBrowser Boolean
}
class NativePlatform {
+isBrowser Boolean
}
MsmpLifecycleManager ..> PlatformEnvironment : uses
PlatformEnvironment <|.. CommonPlatform
PlatformEnvironment <|.. JsPlatform
PlatformEnvironment <|.. WasmJsPlatform
PlatformEnvironment <|.. JvmPlatform
PlatformEnvironment <|.. NativePlatform
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `mcutils-msmp/src/commonMain/kotlin/tech/aliorpse/mcutils/internal/MsmpLifecycleManager.kt:150` </location>
<code_context>
+ if (isBrowser) {
+ header(HttpHeaders.SecWebSocketProtocol, "minecraft-v1,$token")
+ } else {
+ header(HttpHeaders.Authorization, "Authorization $token")
+ }
timeout { connectTimeoutMillis = config.connectTimeout }
</code_context>
<issue_to_address>
**issue (bug_risk):** Non-browser branch appears to send an `Authorization` header with a non-standard value instead of `Bearer`.
This changes the non-browser path from sending `Bearer $token` to sending `Authorization $token` as the `Authorization` header value, which is non-standard and will likely break existing clients expecting a Bearer token. If you want to preserve prior behavior, this should remain `Bearer $token` (or another explicit scheme) so servers continue to accept these requests.
</issue_to_address>
### Comment 2
<location> `README.md:13-15` </location>
<code_context>
+
+* **Kotlin/JVM**
+* **Kotlin/JS, WasmJS** on
+ * nodejs
+ * browser *(except modules depends on ktor-network, see [build.gradle.kts](build.gradle.kts) for more details)*
+* **Kotlin/Native** on
+ * linuxX64 (X64/Arm64)
</code_context>
<issue_to_address>
**suggestion (typo):** Fix capitalization of "Node.js" and adjust grammar in the browser note.
Consider updating the entries to:
- `* Node.js`
- `* browsers *(except modules that depend on ktor-network, see [build.gradle.kts](build.gradle.kts) for more details)*`
```suggestion
* **Kotlin/JS, WasmJS** on
* Node.js
* browsers *(except modules that depend on ktor-network, see [build.gradle.kts](build.gradle.kts) for more details)*
```
</issue_to_address>
### Comment 3
<location> `CONTRIBUTING.md:11` </location>
<code_context>
+2. Fork the repository and create a new branch named like `feat/my-feature`, code in it.
+3. add `Pfull-build=true` to abi-validating related tasks, for full build is disabled to boost dev build speed.
+4. run `./gradlew checkLegacyAbi` to check your changes. If including a breaking change, run `./gradlew updateLegacyAbi`.
+5. When creating PR, use a concise, descriptive PR title with prefixes like `feat:` or `fix:`. Please pull to `main` branch.
+
+
</code_context>
<issue_to_address>
**suggestion (typo):** Adjust phrasing around PR creation and targeting the main branch.
For clearer grammar, consider: "5. When creating a PR, use a concise, descriptive PR title with prefixes like `feat:` or `fix:`. Please open the PR against the `main` branch."
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
mcutils-msmp/src/commonMain/kotlin/tech/aliorpse/mcutils/internal/MsmpLifecycleManager.kt
Outdated
Show resolved
Hide resolved
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.
No description provided.