-
Notifications
You must be signed in to change notification settings - Fork 375
feat: SDK-4210: Standardize BACKGROUND_THREADING feature flag key naming #2598
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
Merged
abdulraqeeb33
merged 1 commit into
main
from
ar/sdk-4210-standardize-background-threading-ff-key-naming
Mar 26, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...SDK/onesignal/core/src/test/java/com/onesignal/core/internal/features/FeatureFlagTests.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.onesignal.core.internal.features | ||
|
|
||
| import io.kotest.core.spec.style.FunSpec | ||
| import io.kotest.matchers.shouldBe | ||
|
|
||
| class FeatureFlagTests : FunSpec({ | ||
| test("feature flags use SDK_050800 style key naming") { | ||
| val keyPattern = Regex("^SDK_[0-9]{6}_[A-Z0-9_]+$") | ||
|
|
||
| FeatureFlag.entries.forEach { feature -> | ||
| keyPattern.matches(feature.key) shouldBe true | ||
| } | ||
| } | ||
|
|
||
| test("BACKGROUND_THREADING uses the expected canonical key") { | ||
| FeatureFlag.SDK_050800_BACKGROUND_THREADING.key shouldBe "SDK_050800_BACKGROUND_THREADING" | ||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🟡 Two catch-block warning messages still reference the old
BACKGROUND_THREADINGkey name after the PR renamed the canonical key toSDK_050800_BACKGROUND_THREADING. A developer searching logcat forSDK_050800_BACKGROUND_THREADINGwhen diagnosing startup threading failures would silently miss these warnings inStartupService.kt:24andOneSignalImp.kt:185. Update both strings to match the new canonical key.Extended reasoning...
This PR correctly renamed every
FeatureFlag.BACKGROUND_THREADINGenum reference toFeatureFlag.SDK_050800_BACKGROUND_THREADING, but the adjacent human-readable strings inside catch blocks were not updated to match.Affected locations:
StartupService.ktline 24: theLogging.warnmessage still saysBACKGROUND_THREADING in StartupServiceOneSignalImp.ktline 185: theLogging.warnmessage still saysBACKGROUND_THREADING featureHow the inconsistency manifests:
Both sites follow the same pattern: a
tryblock callsfeatureManager.isEnabled(FeatureFlag.SDK_050800_BACKGROUND_THREADING)(correctly updated) and acatch (t: Throwable)block logs a warning (not updated). When an exception occurs during flag resolution, the logged message saysBACKGROUND_THREADINGwhile every other trace in the system saysSDK_050800_BACKGROUND_THREADING.Concrete step-by-step proof:
StartupService.scheduleStart()callsfeatureManager.isEnabled(FeatureFlag.SDK_050800_BACKGROUND_THREADING).IFeatureManageris not yet registered andgetService()throws — the catch block fires.OneSignal: Failed to resolve BACKGROUND_THREADING in StartupService.SDK_050800_BACKGROUND_THREADINGto trace what happened — this warning is absent from results, misleading them into thinking the flag was never consulted.Why existing code does not prevent it:
Log message strings are plain string literals with no compile-time binding to the enum key. Renaming the enum entry produces no build error or warning for stale adjacent strings.
Impact:
No functional impact — the fallback value
falseis still returned correctly. The impact is purely on debuggability: stale log strings can mislead engineers triaging threading startup failures.Fix:
Update both log strings to reference the new canonical key name
SDK_050800_BACKGROUND_THREADING.