Fixes part of #5345 : Implement debug Controller and module for PlatformParameterController.
Fixes part of #5345
- Introduced Ephemeral Protos.
- Introduced Debug Module.
- Introduced DebugController.
- Introduced DebugImp of PlatformParameterController.
This pull request introduces a debug implementation for managing platform parameters and feature flags, along with updates to various build and dependency configurations. The most significant changes revolve around the addition of a new debug controller and module for platform parameters, as well as updates to Bazel build files to integrate these changes.
Platform Parameter Debug Implementation:
- Added
PlatformParameterControllerDebugImplto provide debug-specific functionality for managing platform parameters and feature flags (PlatformParameterControllerDebugImpl.kt). - Introduced
PlatformParameterControllerDebugModuleto provide Dagger bindings for the debug implementation (PlatformParameterControllerDebugModule.kt). - Added
PlatformParameterDebugControllerinterface to define debug-only methods for platform parameter and feature flag management (PlatformParameterDebugController.kt).
These updates enhance the platform parameter system by introducing a debug-specific implementation, improving configurability and testability while maintaining compatibility with production modules.
Essential Checklist
- [x] 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: ...".)
- [x] Any changes to scripts/assets files have their rationale included in the PR explanation.
- [x] The PR follows the style guide.
- [x] The PR does not contain any unnecessary code changes from Android Studio (reference).
- [x] 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).
PTAL @Rd4dev .
Coverage Report
Results
Number of files assessed: 14 Overall Coverage: 38.24% Coverage Analysis: FAIL :x:
Failure Cases
| File | Failure Reason | Status |
|---|---|---|
PlatformParameterControllerDebugModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugModule.kt |
No appropriate test file found for domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugModule.kt. | :x: |
PlatformParameterDebugController.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugController.kt |
No appropriate test file found for domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugController.kt. | :x: |
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt |
No appropriate test file found for domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt. | :x: |
PlatformParameterControllerProdModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerProdModule.kt |
No appropriate test file found for domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerProdModule.kt. | :x: |
Passing coverage
Files with passing code coverage
| File | Coverage | Lines Hit | Status | Min Required |
|---|---|---|---|---|
InitializeDefaultLocaleRule.kttesting/src/main/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRule.kt |
38.24% | 39 / 102 | :white_check_mark: | 38% * |
* represents tests with custom overridden pass/fail coverage thresholds
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
PlatformParameterModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterSyncUpWorker.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
ImageRegionSelectionInteractionView.ktapp/src/main/java/org/oppia/android/app/player/state/ImageRegionSelectionInteractionView.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
AlphaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
ActivityRouterModule.ktapp/src/main/java/org/oppia/android/app/activity/route/ActivityRouterModule.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
TestApplicationComponent.ktinstrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt |
This file is exempted from having a test file; 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
Thanks @theayushyadav11! -- as we discussed yesterday, I’ll take a review pass once the PR is fully complete — feel free to tag us if you need clarification on anything in the meantime.
@theayushyadav11, please assign @subhajitxyz for a first review pass then @Rd4dev for a second pass.
Coverage Report
Results
Number of files assessed: 8 Overall Coverage: 38.24% Coverage Analysis: PASS :white_check_mark:
Passing coverage
Files with passing code coverage
| File | Coverage | Lines Hit | Status | Min Required |
|---|---|---|---|---|
InitializeDefaultLocaleRule.kttesting/src/main/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRule.kt |
38.24% | 39 / 102 | :white_check_mark: | 38% * |
* represents tests with custom overridden pass/fail coverage thresholds
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
ImageRegionSelectionInteractionView.ktapp/src/main/java/org/oppia/android/app/player/state/ImageRegionSelectionInteractionView.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
AlphaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
ActivityRouterModule.ktapp/src/main/java/org/oppia/android/app/activity/route/ActivityRouterModule.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
TestApplicationComponent.ktinstrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt |
This file is exempted from having a test file; 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
Hi @Rd4dev , I have added testcases for the default values PTAL.
Unassigning @theayushyadav11 since a re-review was requested. @theayushyadav11, please make sure you have addressed all review comments. Thanks!
Coverage Report
Results
Number of files assessed: 8 Overall Coverage: 38.24% Coverage Analysis: PASS :white_check_mark:
Passing coverage
Files with passing code coverage
| File | Coverage | Lines Hit | Status | Min Required |
|---|---|---|---|---|
InitializeDefaultLocaleRule.kttesting/src/main/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRule.kt |
38.24% | 39 / 102 | :white_check_mark: | 38% * |
* represents tests with custom overridden pass/fail coverage thresholds
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
TestApplicationComponent.ktinstrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
AlphaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
ImageRegionSelectionInteractionView.ktapp/src/main/java/org/oppia/android/app/player/state/ImageRegionSelectionInteractionView.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
ActivityRouterModule.ktapp/src/main/java/org/oppia/android/app/activity/route/ActivityRouterModule.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
@theayushyadav11 -- I think with the details Ben shared in the Android CLaM chat today, you should now be fully unblocked for testing the remote DB values. Please go ahead and complete the test suite, fix any CI issues
@theayushyadav11, please assign @subhajitxyz for a first review pass then @Rd4dev for a second pass.
and as mentioned earlier — assign Subhajit for the initial pass.
@theayushyadav11 -- Also, as mentioned in the last meeting, per the linked comment, it was suggested to create a duplicate module for the debug variant instead of extracting the controller. This was also suggested to align with the ongoing efforts of updating test modules across the codebase.
Could you also update the PR to reflect this approach as well?
And a quick reminder to update to the latest develop and update the PR description before assigning it for review.
Hi @subhajitxyz PTAL.
Unassigning @theayushyadav11 since a re-review was requested. @theayushyadav11, please make sure you have addressed all review comments. Thanks!
Coverage Report
Results
Number of files assessed: 8 Overall Coverage: 0.00% Coverage Analysis: PASS :white_check_mark:
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
TestApplicationComponent.ktinstrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterDebugController.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugController.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterControllerDebugModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugModule.kt |
This file is exempted from having a test file; 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
Thanks @theayushyadav11 , I took an initial pass and added some minor comments. Overall, it looks good to me.
Coverage Report
Results
Number of files assessed: 7 Overall Coverage: 0.00% Coverage Analysis: PASS :white_check_mark:
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
TestApplicationComponent.ktinstrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterDebugModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugModule.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterDebugController.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugController.kt |
This file is exempted from having a test file; 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
@Rd4dev PTAL.
Unassigning @theayushyadav11 since a re-review was requested. @theayushyadav11, please make sure you have addressed all review comments. Thanks!
Coverage Report
Results
Number of files assessed: 9 Overall Coverage: 0.00% Coverage Analysis: PASS :white_check_mark:
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
StateFragment.ktapp/src/main/java/org/oppia/android/app/player/state/StateFragment.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
StateDeck.ktdomain/src/main/java/org/oppia/android/domain/state/StateDeck.kt |
This file is exempted from having a test file; skipping coverage check. |
ExplorationProgressController.ktdomain/src/main/java/org/oppia/android/domain/exploration/ExplorationProgressController.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterDebugModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugModule.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterDebugController.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugController.kt |
This file is exempted from having a test file; 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
@theayushyadav11 -- Assigning this back to you to proceed with the debugImpl approach you discussed with the team during the last meeting.
Coverage Report
Results
Number of files assessed: 5 Overall Coverage: 0.00% Coverage Analysis: PASS :white_check_mark:
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterDebugModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugModule.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.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
PTAL @Rd4dev .
Unassigning @theayushyadav11 since a re-review was requested. @theayushyadav11, please make sure you have addressed all review comments. Thanks!
Coverage Report
Results
Number of files assessed: 6 Overall Coverage: 0.00% Coverage Analysis: PASS :white_check_mark:
Exempted coverage
Files exempted from coverage
| File | Exemption Reason |
|---|---|
GaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/ga/GaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
BetaApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
DeveloperApplicationComponent.ktapp/src/main/java/org/oppia/android/app/application/dev/DeveloperApplicationComponent.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterDebugModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterDebugModule.kt |
This file is exempted from having a test file; skipping coverage check. |
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt |
This file is incompatible with code coverage tooling; skipping coverage check. |
PlatformParameterModule.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.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
Unassigning @Rd4dev since the review is done.
Hi @theayushyadav11, it looks like some changes were requested on this pull request by @Rd4dev. PTAL. Thanks!
PTAL @Rd4dev , I have addressed the comments and made changes as requested.
Unassigning @theayushyadav11 since a re-review was requested. @theayushyadav11, please make sure you have addressed all review comments. Thanks!
@theayushyadav11 -- Looks like CI is failing—please address it and reassign. Also, ensure new changes align with earlier feedback.
9
@theayushyadav11 -- Looks like CI is failing—please address it and reassign. Also, ensure new changes align with earlier feedback.
Hi @Rd4dev I have written the test but it is returning false , I think there is again some issue with the module setup can you please go through it.(Test)
Hi @Rd4dev I have written the test but it is returning
false, I think there is again some issue with the module setup can you please go through it.(Test)
It seems the issue [CI StackTrace] originates from how PlatformParameterController is being provided. The current setup in TestPlatformParameterModule binds it to the ProdImpl, which leads to using the production implementation to load parameters. This means the debug implementation’s load states are never loaded in the tests, and its internal flags (like initialization status) remain unset or default to false.
There was 1 failure:
1) testGetParameterInitializationStatus_initialState_isTrue
expected to be true
To address this, we should skip the controller provision from TestPlatformParameterModule and define a debug-specific controller provision in TestModule, ensuring that the debug implementation is explicitly used in our tests.
@Module
class TestModule {
@Provides
@Singleton
fun providesPlatformParameterController(
impl: PlatformParameterControllerDebugImpl
): PlatformParameterController = impl
}
Similarly, other dependencies like PlatformParameterProcessState and PlatformParameterConfigRetriever are also required for DebugImpl to function as expected. Since the production version (ProdImpl) uses factory-based construction, those provisions from TestPlatformParameterModule might not align correctly. So we should define them directly in TestModule, tailored for DebugImpl.