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

Fix part of #5343: Update Incorrect Link for the Oppia Android Code Coverage Wiki Page #5511

Merged
merged 8 commits into from
Aug 28, 2024

Conversation

Rd4dev
Copy link
Collaborator

@Rd4dev Rd4dev commented Aug 24, 2024

Explanation

Fixes Part of #5343

This PR includes

if: ${{ !cancelled() && needs.check_unit_tests_completed.result == 'success'}}
  • The code coverage comment got triggered even after assignment changes due to the presence of 'assigned' in the on pull_request_target triggered, fixed it by removing the 'assigned' trigger.
  • Utilized 'HtmlEscapers' to escape HTML characters from source code lines in CoverageReporter.kt as strings those already included html tags overlapped / conflicted with the report html templates.
  • Added limitations section to the 'Oppia-Android-Code-Coverage' wiki page
  • Filed all possible coverage gaps that exist right now based on the available pass cases.

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

If your PR includes UI-related changes, then:

  • Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes
  • For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see RTL guide)
  • Add a video showing the full UX flow with a screen reader enabled (see accessibility guide)
  • For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

@Rd4dev Rd4dev requested review from a team as code owners August 24, 2024 10:47
@Rd4dev Rd4dev requested a review from BenHenning August 24, 2024 10:47
@Rd4dev
Copy link
Collaborator Author

Rd4dev commented Aug 24, 2024

@BenHenning, I incorrectly referenced the wrong link in PR #5483; updated to the correct link here, can you PTAL?

Oh, and also should we include other coverage gaps to the "Limitations sections"?

Copy link

Coverage Report

Results

Coverage Analysis: SKIP ⏭️

This PR did not introduce any changes to Kotlin source or test files.

To learn more, visit the Oppia Android Code Coverage wiki page

@BenHenning
Copy link
Member

Thanks @Rd4dev. I think adding other limitations sounds like a good idea.

@BenHenning BenHenning assigned Rd4dev and unassigned BenHenning Aug 24, 2024
Copy link

Coverage Report

Results

Coverage Analysis: SKIP ⏭️

This PR did not introduce any changes to Kotlin source or test files.

To learn more, visit the Oppia Android Code Coverage wiki page

@Rd4dev
Copy link
Collaborator Author

Rd4dev commented Aug 24, 2024

Seems like I also had included assigned to the triggers,

on:
  pull_request_target:
    types: [assigned, opened, synchronize, reopened]

comment posted on assignment: #5511 (comment)
and its commenting on every assignment too :|, will add that fix too here ...


Coverage Gaps

  1. MathExpressionParser.kt -> As I don't understand the entire functionality just wanted to confirm if this is a missing parameter declaration causing the coverage miss or a jaCoCo coverage gap?

The lines are

  fun parseAlgebraicEquation(
    rawExpression: String,
    allowedVariables: List<String>,
    errorCheckingMode: ErrorCheckingMode = ErrorCheckingMode.ALL_ERRORS
  ): MathParsingResult<MathEquation> {
    println("Hitting...")
    return createAlgebraicParser(
      rawExpression, isPartOfEquation = true, allowedVariables, errorCheckingMode
    ).parseGenericEquationGrammar().map { it.stripParseInfo() }
  }

The test is:

  @Test
  fun testParseAlgebraicEquation_basicEquation_doesNotFail() {
    expectSuccessWhenParsingAlgebraicEquation("y = 2x + 3")
  }

    private fun parseAlgebraicEquation(expression: String): MathParsingResult<MathEquation> {
      return MathExpressionParser.parseAlgebraicEquation(
        expression, allowedVariables = listOf("x", "y", "z"), ALL_ERRORS
      )
    }

The report says:

image

This was a similarly observed with methods: parseAlgebraicExpression() and parseNumericExpression().

  1. Abstract methods:
    Same as above I don't completely understand the inner working but the TestCoroutineDispatcher.kt has few abstract methods:
abstract fun hasPendingTasks(): Boolean

abstract fun getNextFutureTaskCompletionTimeMillis(timeMillis: Long): Long?

abstract fun runCurrent(
  timeout: Long = DEFAULT_TIMEOUT_SECONDS,
  timeoutUnit: TimeUnit = DEFAULT_TIMEOUT_UNIT
)

and these are implemented in TestCorotineDispatcherRobolectricImpl.kt, TestCoroutineDispatchersRobolectricImpl.kt, TestCoroutineDispatchersEspressoImpl.kt, etc.

But as per jaCoCo documentation:

Abstract methods do not contain code, therefore code coverage cannot be evaluated. Indeed code coverage is recorded for subclasses implementing these methods

So, should the actual abstract methods in the TestCoroutineDispatcher.kt be uninstrumented as we only acquire coverage only from their respective test cases?

While most abstract methods are uninstrumented (highlighted as grey), the runCurrent shows as not covered (highlighted in red). Is this a coverage gap?

The html report:

image
image

  1. break:

The finally block was reported as uncovered in SurveyProgressController.kt

    is ControllerMessage.FinishSurveySession -> {
      try {
        controllerState.completeSurveyImpl(message.callbackFlow)
      } finally {
        println("Finally...")
        // Ensure the actor ends since the session requires no further message processing.
        break
      }
    }

The report with break statement:

image

But I think this will also align with the same exception gap, and the presence of break statement causes the partial coverage and commenting the break statement covers the finally block:

    } finally {
      println("Finally...")
      // Ensure the actor ends since the session requires no further message processing.
     // break
    }

The report without break statement:

image

If confirmed I will add it to the exception / termination statement #5506 issues.

  1. last curly brace:

While this one is not observed in most cases, but with CpuPerformanceSnapshotter.kt the generated report highlights the last curly brace as uncovered:

The code:

    @OptIn(ObsoleteCoroutinesApi::class)
    private fun createCommandQueueActor(): SendChannel<CommandMessage> {
      return coroutineScope.actor(capacity = Channel.UNLIMITED) {
        for (message in channel) {
         ...
        }
-     }
    }

The generated report:

image

Similarly observed in CommandExecutorImpl.kt

The generated report:

image

also with TodoOpenCheck.kt

The generated report:

image

One related issue that can be found is: jacoco/jacoco#1233

While I'm unsure if this is related to the test implementation or something that demands a configuration change or an actual coverage gap? If it is a coverage gap, then it will require further investigation on what specific cases they occur.

  1. classes with just companion object

It is observed with RepositoryFile.kt that the class line was reported as uncovered, the generated report:

image

and I doubt if they are related to :

same with TodoCollector.kt

image


  • There seems to be a timeout issue with my local machine run so will fix than and rerun and try updating the results for GenerateMavenDependenciesList.kt, MavenDependenciesListCheck, BazelClient.kt (if possible).
  • And I am even afraid to attempt running RunCoverage.kt, so I’m going to pass on that
  • Tried ComputeAffectedTestsTest, but I think I am skipping that too.
    If mandatory I can try running coverage on the above files later.

I think I ran coverages on most if not all of the Passing cases (not on exempted overridden files as most are reported as 0 or very low and figuring out gaps would be not straightforward) and based on the other reports it can be seen that most of the uncovered lines are based on unhit else or other branch cases, overrides and I tried adding tests to see if they can be hit for few of them and they do seem to get covered. So, I think once all filed and (the above-mentioned gaps) to be filed issues are addressed, we can achieve move towards 100% code coverage.

While I’m not sure if we’ll uncover more gaps once the source file incompatibility issues are resolved, that’s something we’ll only know once it’s done. Can you take a look at the above cases and direct if those can be filed as coverage gap or if any are uncovered with missing tests.

Once everything is filed, I will add them to the wiki limitations in one go.


Other issues (Not coverage gaps)

HTML reports with source code containing html tags / other tags mess up the reports. For eg: With CoverageReporter.kt, LiTagHandler.kt, TodoCollector.kt reports, since it already have tags as strings within them, when the report is generated it mix matches the report structure. One possible way is to move these html strings as templates to a separate place and refer them from there so the source code report generation would still preserve the format.

eg: chopped - TodoCollector.kt

image

formatted CoverageReport.kt

image

LiTagHandler.kt

image

Copy link

Coverage Report

Results

Coverage Analysis: SKIP ⏭️

This PR did not introduce any changes to Kotlin source or test files.

To learn more, visit the Oppia Android Code Coverage wiki page

@Rd4dev Rd4dev assigned BenHenning and unassigned Rd4dev Aug 25, 2024
Copy link

Coverage Report

Results

Coverage Analysis: SKIP ⏭️

This PR did not introduce any changes to Kotlin source or test files.

To learn more, visit the Oppia Android Code Coverage wiki page

@BenHenning
Copy link
Member

Thanks @Rd4dev. The code changes LGTM, but I'll need to process your last message a bit before I have any follow-up thoughts/suggestions.

Copy link

APK & AAB differences analysis

Note that this is a summarized snapshot. See the CI artifacts for detailed differences.

Dev

Expand to see flavor specifics

Universal APK

APK file size: 19 MiB (old), 19 MiB (new), 0 bytes (No change)

APK download size (estimated): 17 MiB (old), 17 MiB (new), 4 bytes (Added)

Method count: 259140 (old), 259140 (new), 0 (No change)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 6808 (old), 6808 (new), 0 (No change)

  • Anim: 43 (old), 43 (new), 0 (No change)
  • Animator: 26 (old), 26 (new), 0 (No change)
  • Array: 15 (old), 15 (new), 0 (No change)
  • Attr: 922 (old), 922 (new), 0 (No change)
  • Bool: 9 (old), 9 (new), 0 (No change)
  • Color: 967 (old), 967 (new), 0 (No change)
  • Dimen: 1048 (old), 1048 (new), 0 (No change)
  • Drawable: 379 (old), 379 (new), 0 (No change)
  • Id: 1272 (old), 1272 (new), 0 (No change)
  • Integer: 37 (old), 37 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 378 (old), 378 (new), 0 (No change)
  • Menu: 3 (old), 3 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • Raw: 2 (old), 2 (new), 0 (No change)
  • String: 848 (old), 848 (new), 0 (No change)
  • Style: 831 (old), 831 (new), 0 (No change)
  • Xml: 6 (old), 6 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 18 MiB (old), 18 MiB (new), 4 bytes (Added)
APK download size (estimated): 17 MiB (old), 17 MiB (new), 25 bytes (Added)

Configuration hdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 18 KiB (old), 18 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 49 KiB (old), 49 KiB (new), 0 bytes (No change)
APK download size (estimated): 14 KiB (old), 14 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change)
APK download size (estimated): 14 KiB (old), 14 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 86 KiB (old), 86 KiB (new), 0 bytes (No change)
APK download size (estimated): 29 KiB (old), 29 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 57 KiB (old), 57 KiB (new), 0 bytes (No change)
APK download size (estimated): 21 KiB (old), 21 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change)
APK download size (estimated): 29 KiB (old), 29 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Alpha

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 4 bytes (Added)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 2 bytes (Removed)

Method count: 115714 (old), 115714 (new), 0 (No change)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 5776 (old), 5776 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 820 (old), 820 (new), 0 (No change)
  • Dimen: 780 (old), 780 (new), 0 (No change)
  • Drawable: 341 (old), 341 (new), 0 (No change)
  • Id: 1218 (old), 1218 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 341 (old), 341 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 781 (old), 781 (new), 0 (No change)
  • Style: 472 (old), 472 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 11 MiB (old), 11 MiB (new), 4 bytes (Added)
APK download size (estimated): 10 MiB (old), 10 MiB (new), 0 bytes (No change)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Beta

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 4 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 7 bytes (Added)

Method count: 115720 (old), 115720 (new), 0 (No change)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 5776 (old), 5776 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 820 (old), 820 (new), 0 (No change)
  • Dimen: 780 (old), 780 (new), 0 (No change)
  • Drawable: 341 (old), 341 (new), 0 (No change)
  • Id: 1218 (old), 1218 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 341 (old), 341 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 781 (old), 781 (new), 0 (No change)
  • Style: 472 (old), 472 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 10 MiB (old), 10 MiB (new), 0 bytes (No change)
APK download size (estimated): 9 MiB (old), 9 MiB (new), 9 bytes (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Ga

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 4 bytes (Added)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 1 bytes (Added)

Method count: 115720 (old), 115720 (new), 0 (No change)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 5776 (old), 5776 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 820 (old), 820 (new), 0 (No change)
  • Dimen: 780 (old), 780 (new), 0 (No change)
  • Drawable: 341 (old), 341 (new), 0 (No change)
  • Id: 1218 (old), 1218 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 341 (old), 341 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 781 (old), 781 (new), 0 (No change)
  • Style: 472 (old), 472 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 10 MiB (old), 10 MiB (new), 8 bytes (Added)
APK download size (estimated): 9 MiB (old), 9 MiB (new), 15 bytes (Added)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

@BenHenning
Copy link
Member

(1) is probably a real gap. It looks like the tests never verify the default parameter since they always provide one.

(2) is touching on several different things:

  • We sometimes test abstract or interface classes as part of verifying their contracts (this is a case-by-case basis, and I don't think applies directly here).
  • JaCoCo is making Java-specific assumptions (which are actually not correct anymore since interfaces in Java can have default methods). Its conclusion isn't really correct per modern Java or Kotlin.
  • This is again, like (1), a case of default arguments seeming to not be verified so it's a real coverage gap on our end (assuming JaCoCo properly observes the coverage when it is tested).

(3) I'm not exactly sure if this is #5506 as-is, but I think it's reasonable to extend that issue to include this case. It definitely seems like a JaCoCo issue to me.

(4) Worth filing an issue for this case with the specific examples you've found. I suspect these are either coming from:

  • A case where the code is simply not finishing in the test (in which case we need to add a properly configured test for each unit to verify that it "cleans up" correctly).
  • Dead code being generated by the Kotlin compiler (similar to the Groovy problem mentioned in the JaCoCo issue that you linked).

Both will require investigation, and we need to rule out the first case before looking into the second one (which would require a bytecode analysis on the production code being instrumented).

(5) I suspect this is a case of the constructors not being called (since Kotlin generates public default constructors for classes) as we don't need to. If that's the case, we should just be turning the classes into public objects at the top-level if they don't need to be instances. This seems to be a coverage gap on our side, not a tooling issue.


At a high level:

  • I think skipping the tests you mentioned seems reasonable. The analysis you've performed so far looks very thorough and I'm happy to defer to your findings.
  • It looks like one new issue should be filed (per (4)) and one issue updated (per (3)).
  • The report generation can be fixed by escaping HTML tags (see https://stackoverflow.com/a/26572556/3689782 for a Guava-compatible way to do this without needing any additional dependencies). I think this is something that should be fixed, if possible, with a basic test in this PR.
  • The wiki page should still be updated to include the coverage gaps once the issues above are filed.

@BenHenning BenHenning assigned Rd4dev and unassigned BenHenning Aug 26, 2024
Copy link

Coverage Report

Results

Coverage Analysis: SKIP ⏭️

This PR did not introduce any changes to Kotlin source or test files.

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link

APK & AAB differences analysis

Note that this is a summarized snapshot. See the CI artifacts for detailed differences.

Dev

Expand to see flavor specifics

Universal APK

APK file size: 19 MiB (old), 19 MiB (new), 1672 bytes (Removed)

APK download size (estimated): 17 MiB (old), 17 MiB (new), 1564 bytes (Removed)

Method count: 259183 (old), 259140 (new), 43 (Removed)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 6808 (old), 6808 (new), 0 (No change)

  • Anim: 43 (old), 43 (new), 0 (No change)
  • Animator: 26 (old), 26 (new), 0 (No change)
  • Array: 15 (old), 15 (new), 0 (No change)
  • Attr: 922 (old), 922 (new), 0 (No change)
  • Bool: 9 (old), 9 (new), 0 (No change)
  • Color: 967 (old), 967 (new), 0 (No change)
  • Dimen: 1048 (old), 1048 (new), 0 (No change)
  • Drawable: 379 (old), 379 (new), 0 (No change)
  • Id: 1272 (old), 1272 (new), 0 (No change)
  • Integer: 37 (old), 37 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 378 (old), 378 (new), 0 (No change)
  • Menu: 3 (old), 3 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • Raw: 2 (old), 2 (new), 0 (No change)
  • String: 848 (old), 848 (new), 0 (No change)
  • Style: 831 (old), 831 (new), 0 (No change)
  • Xml: 6 (old), 6 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 18 MiB (old), 18 MiB (new), 1672 bytes (Removed)
APK download size (estimated): 17 MiB (old), 17 MiB (new), 1129 bytes (Removed)
Method count: 259183 (old), 259140 (new), 43 (Removed)

Configuration hdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 18 KiB (old), 18 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 49 KiB (old), 49 KiB (new), 0 bytes (No change)
APK download size (estimated): 14 KiB (old), 14 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change)
APK download size (estimated): 14 KiB (old), 14 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 86 KiB (old), 86 KiB (new), 0 bytes (No change)
APK download size (estimated): 29 KiB (old), 29 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 57 KiB (old), 57 KiB (new), 0 bytes (No change)
APK download size (estimated): 21 KiB (old), 21 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change)
APK download size (estimated): 29 KiB (old), 29 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Alpha

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 1324 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 5016 bytes (Removed)

Method count: 115727 (old), 115714 (new), 13 (Removed)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 5776 (old), 5776 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 820 (old), 820 (new), 0 (No change)
  • Dimen: 780 (old), 780 (new), 0 (No change)
  • Drawable: 341 (old), 341 (new), 0 (No change)
  • Id: 1218 (old), 1218 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 341 (old), 341 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 781 (old), 781 (new), 0 (No change)
  • Style: 472 (old), 472 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 11 MiB (old), 11 MiB (new), 1320 bytes (Removed)
APK download size (estimated): 10 MiB (old), 10 MiB (new), 2583 bytes (Removed)
Method count: 115727 (old), 115714 (new), 13 (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Beta

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 1804 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 3650 bytes (Removed)

Method count: 115733 (old), 115720 (new), 13 (Removed)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 5776 (old), 5776 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 820 (old), 820 (new), 0 (No change)
  • Dimen: 780 (old), 780 (new), 0 (No change)
  • Drawable: 341 (old), 341 (new), 0 (No change)
  • Id: 1218 (old), 1218 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 341 (old), 341 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 781 (old), 781 (new), 0 (No change)
  • Style: 472 (old), 472 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 10 MiB (old), 10 MiB (new), 1800 bytes (Removed)
APK download size (estimated): 9 MiB (old), 9 MiB (new), 2965 bytes (Removed)
Method count: 115733 (old), 115720 (new), 13 (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Ga

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 1684 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 3963 bytes (Removed)

Method count: 115733 (old), 115720 (new), 13 (Removed)

Features: 2 (old), 2 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 5776 (old), 5776 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 820 (old), 820 (new), 0 (No change)
  • Dimen: 780 (old), 780 (new), 0 (No change)
  • Drawable: 341 (old), 341 (new), 0 (No change)
  • Id: 1218 (old), 1218 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 341 (old), 341 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 781 (old), 781 (new), 0 (No change)
  • Style: 472 (old), 472 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 111 (old), 111 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 10 MiB (old), 10 MiB (new), 1684 bytes (Removed)
APK download size (estimated): 9 MiB (old), 9 MiB (new), 3441 bytes (Removed)
Method count: 115733 (old), 115720 (new), 13 (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

@Rd4dev
Copy link
Collaborator Author

Rd4dev commented Aug 27, 2024

@BenHenning, can you PTAL? and would it require any other verification on the Coverage Checks?

Ok, I found another case - https://github.com/oppia/oppia-android/pull/5522/checks, seems like evaluate runs irrespective of unit test failure and throwing "SKIP" status - #5522 (comment), will also adress that over here.

Log:


Thanks for the detailed information on each case.

val unescapedOutputReportText = outputReportText
  .replace("&quot;", "\"")
  .replace("&amp;", "&")
  .replace("&lt;", "<")
  .replace("&gt;", ">")

not sure if there is anything to unescape (and escaping expected report caused issues with other tags).

Edit:

Escaped CoverageReporter.html

image

  • I've also added the newly filed issues to the limitations section of the wiki.

Copy link

Coverage Report

Results

Coverage Analysis: SKIP ⏭️

This PR did not introduce any changes to Kotlin source or test files.

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link

Coverage Report

Results

Number of files assessed: 2
Overall Coverage: 95.59%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
RunCoverage.ktscripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
95.38% 186 / 195 70%
CoverageReporter.ktscripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt
95.70% 334 / 349 70%

To learn more, visit the Oppia Android Code Coverage wiki page

@Rd4dev Rd4dev assigned BenHenning and unassigned Rd4dev Aug 27, 2024
Copy link

Coverage Report

Results

Number of files assessed: 2
Overall Coverage: 95.59%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
RunCoverage.ktscripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
95.38% 186 / 195 70%
CoverageReporter.ktscripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt
95.70% 334 / 349 70%

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @Rd4dev! Generally LGTM, but had one comment--PTAL.

@BenHenning BenHenning assigned Rd4dev and unassigned BenHenning Aug 28, 2024
Copy link

Coverage Report

Results

Number of files assessed: 2
Overall Coverage: 95.59%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
RunCoverage.ktscripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
95.38% 186 / 195 70%
CoverageReporter.ktscripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt
95.70% 334 / 349 70%

To learn more, visit the Oppia Android Code Coverage wiki page

@BenHenning
Copy link
Member

@Rd4dev can you also please make sure the PR description is updated to include all of the new changes (since there have been a few iterations on this PR?).

@BenHenning
Copy link
Member

Hmm also I think the coverage report comment is reposting after PR event changes like assignees--are its triggers correct?

@Rd4dev
Copy link
Collaborator Author

Rd4dev commented Aug 28, 2024

Hmm also I think the coverage report comment is reposting after PR event changes like assignees--are its triggers correct?

Yeah, that shouldn't be triggering and spotted it earlier #5511 (comment) and included a fix for that too here - PR Changes

Ah, I’ve updated the PR description with the details—hopefully, they’ll stand out better now and won’t get lost in the mix.

@BenHenning, can you please confirm on this #5511 (comment) or other approaches that could be followed.

Edit:
Seems like Apache Commons does have unescape functionalities, but I think that will require additional dependency?

@Rd4dev Rd4dev assigned BenHenning and unassigned Rd4dev Aug 28, 2024
Copy link

Coverage Report

Results

Number of files assessed: 2
Overall Coverage: 95.59%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
RunCoverage.ktscripts/src/java/org/oppia/android/scripts/coverage/RunCoverage.kt
95.38% 186 / 195 70%
CoverageReporter.ktscripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt
95.70% 334 / 349 70%

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Ah, I forgot about the fact that the old version of the comment workflow is running since it's pull_request_target--thanks for pointing out that it should now be fixed @Rd4dev.

Since there's nothing left to resolve here, approving and merging. Thanks!

@BenHenning BenHenning merged commit 0ef7a46 into oppia:develop Aug 28, 2024
37 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.

2 participants