feat!: change Event.id from Long to String - #87
Open
tobiasschuerg wants to merge 1 commit into
Open
Conversation
Long IDs invite accidental collisions when a consumer app has more than one entity type feeding events into the same WeekData (e.g. lessons and holidays with independent auto-increment primary keys) - two unrelated entities can end up with the same numeric ID and trip requireUniqueId. A String ID lets consumers namespace IDs by entity type instead of relying on numeric tricks. BREAKING CHANGE: Event.id (and the id parameter on Event.Single, Event.AllDay, Event.MultiDay) is now String instead of Long.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Event.id(and theidparam onEvent.Single/Event.AllDay/Event.MultiDay) is nowStringinstead ofLong.WeekData(e.g. two independent Room auto-increment primary keys can coincidentally match). AStringID lets consumers namespace IDs by entity type (e.g."lesson-12"vs"holiday-12") instead of relying on numeric tricks like negation.WeekData's internal ID set andEventOverlapCalculator's layout map are updated toStringaccordingly. All internal usages (key(),testTag, map lookups) are compatible with any type, so no other behavior changes.This is a breaking API change for anyone constructing
Event.*directly; the commit is taggedfeat!:so the release automation major-bumps the version.Test plan
./gradlew library:testDebugUnitTest- all unit tests pass./gradlew app:compileDebugKotlin ktlintCheck- sample app compiles, lint clean./gradlew library:compileDebugAndroidTestKotlin- instrumented tests compile🤖 Generated with Claude Code
https://claude.ai/code/session_01C3MDc4VpwBCe1vv5siWaXM