Skip to content
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

Upgrade Kotlin Version from 1.5.10 to 1.7.20 #5158

Closed
kartikaykaushik14 opened this issue Mar 1, 2023 · 7 comments · Fixed by #5164
Closed

Upgrade Kotlin Version from 1.5.10 to 1.7.20 #5158

kartikaykaushik14 opened this issue Mar 1, 2023 · 7 comments · Fixed by #5164
Assignees

Comments

@kartikaykaushik14
Copy link
Contributor

What is the user problem or growth opportunity you want to see solved?

As part of this issue and based on this comment, before migrating from Mapbox to MapLibre, we require certain upgrades in dependencies in our application. This enhancement is to upgrade the Kotlin version from 1.5.10 to 1.7.20.

Apart from satisfying the requirements of MapLibre, the upgrade in Kotlin has several advantages -

  • Bug fixes: Each new version of Kotlin includes bug fixes and stability improvements, which can make your code more reliable and prevent unexpected issues.
  • Performance improvements: New versions of Kotlin often include optimizations that can make your code run faster and use fewer resources.
  • New language features: Kotlin is a rapidly evolving language, and new versions often include new language features that can improve the expressiveness and readability of your code.
  • Security updates: As with any software, new versions of Kotlin may include important security updates that can help protect your application from vulnerabilities and attacks.

How do you know that this problem exists today? Why is this important?

No response

Who will benefit from it?

No response

Anything else you would like to add?

No response

@kartikaykaushik14
Copy link
Contributor Author

@nicolas-raoul Could you please assign this issue to me?

@nicolas-raoul
Copy link
Member

@kartikaykaushik14 Done, thanks!

@kartikaykaushik14
Copy link
Contributor Author

I have been incrementally updating the Kotlin version of the app, and I was able to successfully upgrade the Kotlin version from 1.5.10 to 1.6.10.

However, during the process of incrementing from 1.6.10 to 1.6.20, I encountered some errors in the tests that need to be addressed. Specifically in org.wikipedia.dataclient.mwapi.page.MwMobileViewPageLeadTest and org.wikipedia.dataclient.mwapi.page.MwPageClientTest.

    java.lang.AssertionError: Not completed (latch = 0, values = 0, errors = 1, completions = 0)
    at io.reactivex.observers.BaseTestConsumer.fail(BaseTestConsumer.java:189)
    at io.reactivex.observers.BaseTestConsumer.assertComplete(BaseTestConsumer.java:242)
    at org.wikipedia.dataclient.page.BasePageClientTest.testLeadTitle(BasePageClientTest.java:47)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:591)
    at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:274)
    at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:88)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)


    Caused by:
    org.wikipedia.dataclient.mwapi.MwException: Unrecognized value for parameter "action": mobileview.
        at org.wikipedia.dataclient.mwapi.MwResponse.postProcess(MwResponse.java:20)
        at org.wikipedia.json.PostProcessingTypeAdapter$1.read(PostProcessingTypeAdapter.java:28)
        at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
        at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
        at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:227)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:190)
        at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:45)
        at io.reactivex.Observable.subscribe(Observable.java:12267)
        at org.wikipedia.dataclient.page.BasePageClientTest.testLeadTitle(BasePageClientTest.java:46)
        ... 18 more

I investigated the issue in MediaWiki and checked the exact URL we were passing as part of the test. I received the following output on running this URL manually -

{"errors":[{"code":"badvalue","text":"Unrecognized value for parameter \"action\": mobileview.","module":"main"}],"docref":"See https://en.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.","servedby":"mw2292"}

Also, on checking this link, I found out that there is indeed no action for "mobileview". Please advise on how to proceed from here.

@nicolas-raoul
Copy link
Member

Interesting, do you have any idea why the same test was not failing with Kotlin 1.6.10?

If no immediate fix is found, disabling these unit tests temporarily might also be considered. In such a case, please let us know about how many unit tests would be impacted.

Thanks a lot!

@kartikaykaushik14
Copy link
Contributor Author

kartikaykaushik14 commented Mar 5, 2023

I found 6 test cases that would be impacted if we plan to disable them temporarily.

The build on my local is quite unstable. It sometimes fails even for the latest changes on the Master branch. Is there a way I could run the CI pipeline on my own for my branch to test changes?

Also, it appears that MobileView API was deprecated and has been replaced by Mobile Content Service. See Link and Mobile Content Service

@nicolas-raoul
Copy link
Member

Thanks a lot! I think it is OK to disable 6 test cases temporarily if that helps get us on F-Droid.

Very interesting, would you mind creating a new issue ("bug" type) about Mobile Content Service? Thanks!

@nicolas-raoul
Copy link
Member

Is there a way I could run the CI pipeline on my own for my branch to test changes?

CI unit tests run every time you push, right?

If you want to re-run for any reason, feel free to push a dummy commit. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants