-
Notifications
You must be signed in to change notification settings - Fork 549
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
Fixes #5556: Feature flags failing to log correctly #5715
base: develop
Are you sure you want to change the base?
Conversation
Coverage ReportResultsNumber of files assessed: 3 Failure Cases
Passing coverageFiles with passing code coverage
|
return when (syncStatus.toString()) { | ||
"SYNC_STATUS_UNSPECIFIED" -> 1 | ||
"NOT_SYNCED_FROM_SERVER" -> 2 | ||
"SYNCED_FROM_SERVER" -> 3 | ||
else -> -1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just when
on the enum directly since then no conversion happens (and it can be exhaustive so else
can be omitted).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could we maybe just use the SyncStatus's number or index field that proto generates? That is a stable integer representation of the enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NTS: Use syncStatus.number
to get the index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ENABLE_NPS_SURVEY -> 11 | ||
ENABLE_ONBOARDING_FLOW_V2 -> 12 | ||
ENABLE_MULTIPLE_CLASSROOMS -> 13 | ||
else -> -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use zero to avoid negatives for the error case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
val featureFlagSyncStatuses = featureFlagsList.map { | ||
featureFlagSyncStatusConverter.convertToInteger(it.flagSyncStatus) | ||
} | ||
|
||
val featureFlagEnabledStates = featureFlagsList.map { it.flagEnabledState } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, this should be replaced with 1s and 0s for trues and falses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NTS: Use syncStatus.compareTo(false)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/** | ||
* | ||
*/ | ||
class FeatureFlagNameToIntegerConverter @Inject constructor() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be injectable and can just be an object to avoid instantiation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, let's use 'NumericId' instead of 'Integer' here and below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Coverage ReportResultsNumber of files assessed: 2 Passing coverageFiles with passing code coverage
|
@adhiamboperes this is ready for another pass. PTAL |
APK & AAB differences analysisNote that this is a summarized snapshot. See the CI artifacts for detailed differences. DevExpand to see flavor specificsUniversal APKAPK file size: 19 MiB (old), 19 MiB (new), 779 bytes (Added) APK download size (estimated): 17 MiB (old), 17 MiB (new), 1083 bytes (Removed) Method count: 260308 (old), 260274 (new), 34 (Removed) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 6832 (old), 6820 (new), 12 (Removed)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 18 MiB (old), 18 MiB (new), 791 bytes (Added)
Configuration hdpiAPK file size: 50 KiB (old), 50 KiB (new), 8 bytes (Removed) Configuration ldpiAPK file size: 49 KiB (old), 49 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 86 KiB (old), 86 KiB (new), 8 bytes (Removed) Configuration xhdpiAPK file size: 57 KiB (old), 57 KiB (new), 8 bytes (Removed) Configuration xxhdpiAPK file size: 63 KiB (old), 63 KiB (new), 8 bytes (Removed) Configuration xxxhdpiAPK file size: 63 KiB (old), 63 KiB (new), 8 bytes (Removed) AlphaExpand to see flavor specificsUniversal APKAPK file size: 11 MiB (old), 11 MiB (new), 5015 bytes (Added) APK download size (estimated): 10 MiB (old), 10 MiB (new), 3583 bytes (Added) Method count: 115790 (old), 115792 (new), 2 (Added) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 5800 (old), 5788 (new), 12 (Removed)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 11 MiB (old), 11 MiB (new), 5015 bytes (Added)
Configuration hdpiAPK file size: 43 KiB (old), 43 KiB (new), 8 bytes (Removed) Configuration ldpiAPK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 73 KiB (old), 73 KiB (new), 8 bytes (Removed) Configuration xhdpiAPK file size: 50 KiB (old), 50 KiB (new), 8 bytes (Removed) Configuration xxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 8 bytes (Removed) Configuration xxxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 8 bytes (Removed) BetaExpand to see flavor specificsUniversal APKAPK file size: 11 MiB (old), 11 MiB (new), 4919 bytes (Added) APK download size (estimated): 10 MiB (old), 10 MiB (new), 3943 bytes (Added) Method count: 115796 (old), 115798 (new), 2 (Added) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 5800 (old), 5788 (new), 12 (Removed)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 10 MiB (old), 10 MiB (new), 4919 bytes (Added)
Configuration hdpiAPK file size: 43 KiB (old), 43 KiB (new), 8 bytes (Removed) Configuration ldpiAPK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 73 KiB (old), 73 KiB (new), 8 bytes (Removed) Configuration xhdpiAPK file size: 50 KiB (old), 50 KiB (new), 8 bytes (Removed) Configuration xxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 8 bytes (Removed) Configuration xxxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 8 bytes (Removed) GaExpand to see flavor specificsUniversal APKAPK file size: 11 MiB (old), 11 MiB (new), 5055 bytes (Added) APK download size (estimated): 10 MiB (old), 10 MiB (new), 844 bytes (Added) Method count: 115796 (old), 115798 (new), 2 (Added) Features: 2 (old), 2 (new), 0 (No change) Permissions: 6 (old), 6 (new), 0 (No change) Resources: 5800 (old), 5788 (new), 12 (Removed)
Lesson assets: 111 (old), 111 (new), 0 (No change) AAB differencesExpand to see AAB specificsSupported configurations:
Base APKAPK file size: 10 MiB (old), 10 MiB (new), 5055 bytes (Added)
Configuration hdpiAPK file size: 43 KiB (old), 43 KiB (new), 8 bytes (Removed) Configuration ldpiAPK file size: 44 KiB (old), 44 KiB (new), 0 bytes (No change) Configuration mdpiAPK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change) Configuration tvdpiAPK file size: 73 KiB (old), 73 KiB (new), 8 bytes (Removed) Configuration xhdpiAPK file size: 50 KiB (old), 50 KiB (new), 8 bytes (Removed) Configuration xxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 8 bytes (Removed) Configuration xxxhdpiAPK file size: 55 KiB (old), 55 KiB (new), 8 bytes (Removed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kkmurerwa! Implementation looks good, but the PR description could benefit from a thorough write up since we havent documented the character length issues elswehere(AFAIK) and why we chose this solution. The description could also benefit from sample logs as copied over from println debug and Firebase logs.
/** | ||
* | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete KDoc.
* @param flagName The flag name to convert. | ||
* @return An integer representation of the event name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param flagName The flag name to convert. | |
* @return An integer representation of the event name. | |
* @param flagName the string constant flag name to convert. | |
* @return an integer representation of the flag name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per last weeks discussion, we don't want to re-use the integers. We should make a note of that in the KDoc.
"expectedValue=13" | ||
) | ||
fun testConvertToIntegerName_returnsCorrectIntegerForEach() { | ||
val nameInteger = converter.convertToInteger(flagName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe?
val nameInteger = converter.convertToInteger(flagName) | |
val integerName = converter.convertToInteger(flagName) |
Explanation
Fixes #5556: Feature flags failing to log correctly
Essential Checklist