Skip to content

Conversation

@leigaol
Copy link
Contributor

@leigaol leigaol commented May 7, 2025

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

enable @Sage by passing feature config to mynahUI
Screenshot 2025-05-07 at 2 15 15 PM
Screenshot 2025-05-07 at 4 49 51 PM

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@leigaol leigaol requested review from a team as code owners May 7, 2025 21:29
// format: '[["key1", {"name":"Feature1","variation":"A","value":true}]]'
fun getFeatureConfigJsonString(): String {
val jsonString = featureConfigs.entries.map { (key, value) ->
"[\"$key\",${Gson().toJson(value)}]"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I use objectMapper here then this function would be blocked on IO forever and webview will never load.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and Gson formatted string happens to match what MynahUI requires.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@leigaol leigaol May 7, 2025

Choose a reason for hiding this comment

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

If I implement it in this way

val jsonString = featureConfigs.entries.map { (key, value) ->
            "[\"$key\",${jacksonObjectMapper().writeValueAsString(value)}]"
        }

then it would stuck at public native void park(boolean isAbsolute, long time); of Unsafe.java. It may have sometime to do with featureConfigs list being not thread safe but I don't find a easy fix.

It can also hang at handleMessage function of StreamMessageProducer.java

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why the key value pairs are not modelled as json in mynah-ui

// format: '[["key1", {"name":"Feature1","variation":"A","value":true}]]'
fun getFeatureConfigJsonString(): String {
val jsonString = featureConfigs.entries.map { (key, value) ->
"[\"$key\",${Gson().toJson(value)}]"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why the key value pairs are not modelled as json in mynah-ui

val jsonString = featureConfigs.entries.map { (key, value) ->
"[\"$key\",${Gson().toJson(value)}]"
}
return """
Copy link
Contributor

Choose a reason for hiding this comment

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

can we return jsonstring directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it will fail. I spent 6 hours making it correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is trying to deserialize as a typescript MAP on MynahUI end

@rli rli merged commit 6a32b39 into aws:feature/q-lsp-chat May 8, 2025
2 of 9 checks passed
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.

4 participants