Skip to content

Conversation

@ShankhanilSaha
Copy link
Contributor

Explanation

Fix #2143

  • Move InteractionObjectTestBuilder.kt to app/src/main/java/org/oppia/android/app/player/state/testing/.
  • Update all imports using the InteractionObjectTestBuilder.kt file.
  • Move the related kt_android_library code blocks from domain/BUILD.bazel to app/BUILD.bazel.
  • Update scripts/assets/kdoc_validity_exemptions.textproto and scripts/assets/test_file_exemptions.textproto accordingly to change file paths to InteractionObjectTestBuilder.kt.

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).

@ShankhanilSaha ShankhanilSaha requested review from a team as code owners October 17, 2025 14:53
@ShankhanilSaha
Copy link
Contributor Author

I made the changes shown in the commits but upon making those i am getting some build errors related to .proto files, i have been facing some trouble on fixing them. Uploading the logs here :

ERROR: /home/shankhanil/opensource/oppia-android/app/BUILD.bazel:610:19: KotlinCompile @//app:app_kt { kt: 429, java: 0, srcjars: 0 } for armeabi-v7a failed: (Exit 1): build failed: error executing command

// The errors all occur in this file:
app/src/main/java/org/oppia/android/app/player/state/testing/InteractionObjectTestBuilder.kt

// Here are the specific compilation errors:
app/src/main/java/org/oppia/android/app/player/state/testing/InteractionObjectTestBuilder.kt:9:41: error: unresolved reference: InteractionObject
  fun createNonNegativeInt(value: Int): InteractionObject {
                                          ^
app/src/main/java/org/oppia/android/app/player/state/testing/InteractionObjectTestBuilder.kt:10:12: error: unresolved reference: InteractionObject
    return InteractionObject.newBuilder().setNonNegativeInt(value).build()
           ^
app/src/main/java/org/oppia/android/app/player/state/testing/InteractionObjectTestBuilder.kt:72:7: error: unresolved reference: Fraction
      Fraction.newBuilder()
      ^
app/src/main/java/org/oppia/android/app/player/state/testing/InteractionObjectTestBuilder.kt:113:70: error: unresolved reference: NumberUnit
  fun createNumberWithUnitsForFraction(number: Fraction, units: List<NumberUnit>):
                                                                     ^
... (and many more similar unresolved references) ...

FAILED: Build did NOT complete successfully

@adhiamboperes
Copy link
Collaborator

@ShankhanilSaha, I believe that you need to update Bazel BUILD files to make sure the new package is properly updated/included. If you check the project view, you should see a BUILD file in the package where InteractionObjectTestBuilder previously was. The library should be moved to the BUILD file in the new package.

@adhiamboperes
Copy link
Collaborator

It’s basically a way to manage dependencies with Bazel.

@ShankhanilSaha
Copy link
Contributor Author

ShankhanilSaha commented Oct 18, 2025

  • Move the related kt_android_library code blocks from domain/BUILD.bazel to app/BUILD.bazel.

@adhiamboperes as mentioned in my rationale I have already done that.

@ShankhanilSaha
Copy link
Contributor Author

ShankhanilSaha commented Oct 18, 2025

While moving and refactoring, for some reason android studio missed the imports in the InteractionObjectTestBuilder.kt itself. I have added them manually and it builds just fine now.
I have run the ktlin checks and everything seems to be in order.

@ShankhanilSaha
Copy link
Contributor Author

Hi @adhiamboperes , I think my approach to this was a bit off. After moving the file from domain/ to app/ rather than updating their respective BUILD.bazel files i should keep the kt_android_library code block where it originally was and just update the src path defined in it, since moving that code block also means excluding the interaction_object_test_builder dependency in the TEST_DEPS list inside the domain/BUILD.bazel file. Which according to me is the reason for many tests failing due to unresolved dependencies.

Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

@ShankhanilSaha, I took a look at what might be the issue, and left a suggestion. PTAL.

@ShankhanilSaha
Copy link
Contributor Author

Hi @adhiamboperes was a bit busy this week due to exams, I already moved the kt_android_library I checked the logs and seems like instead moving interaction_object_test_builder to app/BUILD.bazel I have to include it in domain/BUILD.bazel with correct path. Your suggestion of changing it to //app:interaction_object_test_builder should do the trick. The issue of having the kt_android_library in app may still arise which i will move to domain if workflow runs are to fail.

@github-actions
Copy link

Coverage Report

Results

Number of files assessed: 38
Overall Coverage: 0.00%
Coverage Analysis: PASS

Exempted coverage

Files exempted from coverage
File Exemption Reason
InteractionObjectTestBuilder.ktapp/src/main/java/org/oppia/android/app/player/state/testing/InteractionObjectTestBuilder.kt
This file is exempted from having a test file; skipping coverage check.
AnswerClassificationController.ktdomain/src/main/java/org/oppia/android/domain/classify/AnswerClassificationController.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumberWithUnitsIsEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numberwithunits/NumberWithUnitsIsEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumberWithUnitsIsEquivalentToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numberwithunits/NumberWithUnitsIsEquivalentToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
RatioInputHasSpecificTermEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/ratioinput/RatioInputHasSpecificTermEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
RatioInputIsEquivalentRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/ratioinput/RatioInputIsEquivalentRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
RatioInputEqualsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/ratioinput/RatioInputEqualsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
RatioInputHasNumberOfTermsEqualToClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/ratioinput/RatioInputHasNumberOfTermsEqualToClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TextInputEqualsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/textinput/TextInputEqualsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TextInputFuzzyEqualsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/textinput/TextInputFuzzyEqualsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TextInputContainsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/textinput/TextInputContainsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TextInputStartsWithRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/textinput/TextInputStartsWithRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
DragDropSortInputIsEqualToOrderingWithOneItemAtIncorrectPositionClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/dragAndDropSortInput/DragDropSortInputIsEqualToOrderingWithOneItemAtIncorrectPositionClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
DragDropSortInputHasElementXBeforeElementYClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/dragAndDropSortInput/DragDropSortInputHasElementXBeforeElementYClassifierProvider.kt
This file is exempted from having a test file; skipping coverage check.
DragDropSortInputIsEqualToOrderingClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/dragAndDropSortInput/DragDropSortInputIsEqualToOrderingClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
DragDropSortInputHasElementXAtPositionYClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/dragAndDropSortInput/DragDropSortInputHasElementXAtPositionYClassifierProvider.kt
This file is exempted from having a test file; skipping coverage check.
NumericInputIsLessThanOrEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputIsLessThanOrEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumericInputIsWithinToleranceRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputIsWithinToleranceRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumericInputIsLessThanRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputIsLessThanRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumericInputEqualsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputEqualsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumericInputIsInclusivelyBetweenRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputIsInclusivelyBetweenRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumericInputIsGreaterThanRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputIsGreaterThanRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
NumericInputIsGreaterThanOrEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/numericinput/NumericInputIsGreaterThanOrEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputIsGreaterThanRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputIsGreaterThanRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputIsExactlyEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputIsExactlyEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputHasIntegerPartEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputHasIntegerPartEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputIsLessThanRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputIsLessThanRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputHasNoFractionalPartRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputHasNoFractionalPartRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputIsEquivalentToAndInSimplestFormRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputIsEquivalentToAndInSimplestFormRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputHasNumeratorEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputHasNumeratorEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputHasFractionalPartExactlyEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputHasFractionalPartExactlyEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputIsEquivalentToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputIsEquivalentToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
FractionInputHasDenominatorEqualToRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/fractioninput/FractionInputHasDenominatorEqualToRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ItemSelectionInputEqualsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/itemselectioninput/ItemSelectionInputEqualsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ItemSelectionInputIsProperSubsetOfRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/itemselectioninput/ItemSelectionInputIsProperSubsetOfRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ItemSelectionInputDoesNotContainAtLeastOneOfRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/itemselectioninput/ItemSelectionInputDoesNotContainAtLeastOneOfRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ItemSelectionInputContainsAtLeastOneOfRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/itemselectioninput/ItemSelectionInputContainsAtLeastOneOfRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.
MultipleChoiceInputEqualsRuleClassifierProvider.ktdomain/src/main/java/org/oppia/android/domain/classify/rules/multiplechoiceinput/MultipleChoiceInputEqualsRuleClassifierProvider.kt
This file is incompatible with code coverage tooling; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

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

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.

Move InteractionObjectTestBuilder to a main-level testing library

2 participants