Skip to content

Document enum-flag converter requirement#195

Merged
kirich1409 merged 1 commit into
developfrom
docs/enum-flag-registerconverter
May 18, 2026
Merged

Document enum-flag converter requirement#195
kirich1409 merged 1 commit into
developfrom
docs/enum-flag-registerconverter

Conversation

@kirich1409
Copy link
Copy Markdown
Contributor

Summary

Consumers who declare enum(...) flags in the featured { } DSL hit a silent crash
at first read/write on Android/JVM, and have no path forward on iOS, because neither
requirement was documented. This PR adds KDoc and a README section to surface both.

  • FlagContainer.enum KDoc — explains that every storage-backed local provider
    (DataStoreConfigValueProvider, JavaPreferencesConfigValueProvider,
    SharedPreferencesProviderConfig) requires registerConverter(enumConverter<T>())
    before the first use; includes minimal Gradle DSL + runtime wiring examples.
  • enumConverter KDoc — appends a "Compatible providers" section listing which
    providers accept the converter, notes Firebase is automatic, and surfaces the
    NSUserDefaults caveat.
  • featured-gradle-plugin/README.md (new, minimal) — "Enum flags" section with a
    quick-reference table and the iOS workaround note.

No runtime code, type signatures, or ABI changed — checkLegacyAbi passes clean.

Files touched

  • core/src/commonMain/kotlin/dev/androidbroadcast/featured/TypeConverter.kt
  • featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/FlagContainer.kt
  • featured-gradle-plugin/README.md (new)

Related branches

Part of a documentation + fix trio for the enum-flag gap:

  • fix/configvalues-observe-catch — runtime fix
  • fix/sample-enum-converter — sample app wiring fix
  • docs/enum-flag-registerconverter — this PR

Test plan

  • ./gradlew :featured-gradle-plugin:compileKotlin passes
  • ./gradlew :core:compileKotlinMetadata passes
  • ./gradlew :core:checkLegacyAbi passes (no ABI diff)
  • ./gradlew spotlessCheck passes
  • git diff shows only KDoc and markdown lines changed

🤖 Generated with Claude Code

@kirich1409 kirich1409 force-pushed the docs/enum-flag-registerconverter branch from a814ab4 to cc88554 Compare May 18, 2026 10:39
@kirich1409 kirich1409 marked this pull request as ready for review May 18, 2026 10:52
Copilot AI review requested due to automatic review settings May 18, 2026 10:52
@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

The Gradle DSL accepts enum(...) flag declarations, but at runtime
every local storage-backed provider needs an explicit registerConverter
call with enumConverter<T>() to handle the enum — DataStore,
JavaPreferences, and SharedPreferences all throw IllegalArgumentException
otherwise, and NSUserDefaults has no converter API at all. Firebase
handles enums automatically via reflection. This was not documented
anywhere, so consumers hit a launch crash with no signal in the IDE.
Extend the KDoc on FlagContainer.enum, enumConverter, and the plugin
README to spell out the requirement and the iOS caveat.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Documentation-only PR that surfaces the previously undocumented runtime requirement to register an enumConverter on storage-backed local providers when using enum(...) flags declared via the featured { } Gradle DSL, and notes the missing iOS support. No runtime/ABI changes.

Changes:

  • Expanded KDoc on FlagContainer.enum(...) describing the converter requirement, affected providers, Firebase auto-handling, the iOS caveat, and adds Gradle DSL + runtime wiring examples.
  • Added a "Compatible providers" section to enumConverter KDoc in core/.../TypeConverter.kt.
  • New featured-gradle-plugin/README.md with an "Enum flags" section, provider/registration table, and iOS caveat.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
core/src/commonMain/kotlin/dev/androidbroadcast/featured/TypeConverter.kt Adds compatible-providers and iOS-caveat notes to enumConverter KDoc.
featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/FlagContainer.kt Expands enum(...) KDoc with converter requirement, affected providers, and examples.
featured-gradle-plugin/README.md New plugin README documenting enum-flag wiring and iOS workaround.

* ## Runtime converter requirement (Android / JVM)
*
* Storage-backed local providers serialize values as strings and require an explicit
* [enumConverter] registration before the first read or write of this flag. Without it the
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/FlagContainer.kt">

<violation number="1" location="featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/FlagContainer.kt:94">
P3: Unresolvable KDoc link: `[enumConverter]` is defined in the `core` module which is not a dependency of `featured-gradle-plugin`. This will produce a broken link or KDoc warning. Use a fully-qualified reference or backtick-quoted text instead.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

* ## Runtime converter requirement (Android / JVM)
*
* Storage-backed local providers serialize values as strings and require an explicit
* [enumConverter] registration before the first read or write of this flag. Without it the
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot May 18, 2026

Choose a reason for hiding this comment

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

P3: Unresolvable KDoc link: [enumConverter] is defined in the core module which is not a dependency of featured-gradle-plugin. This will produce a broken link or KDoc warning. Use a fully-qualified reference or backtick-quoted text instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At featured-gradle-plugin/src/main/kotlin/dev/androidbroadcast/featured/gradle/FlagContainer.kt, line 94:

<comment>Unresolvable KDoc link: `[enumConverter]` is defined in the `core` module which is not a dependency of `featured-gradle-plugin`. This will produce a broken link or KDoc warning. Use a fully-qualified reference or backtick-quoted text instead.</comment>

<file context>
@@ -84,8 +84,49 @@ public class FlagContainer {
+     * ## Runtime converter requirement (Android / JVM)
+     *
+     * Storage-backed local providers serialize values as strings and require an explicit
+     * [enumConverter] registration before the first read or write of this flag. Without it the
+     * provider throws [IllegalArgumentException] synchronously. Affected providers:
+     *
</file context>
Fix with Cubic

@kirich1409 kirich1409 merged commit 8196bae into develop May 18, 2026
10 checks passed
@kirich1409 kirich1409 deleted the docs/enum-flag-registerconverter branch May 18, 2026 11:02
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