Skip to content

feat!: change Event.id from Long to String - #87

Open
tobiasschuerg wants to merge 1 commit into
masterfrom
feat/string-event-ids
Open

feat!: change Event.id from Long to String#87
tobiasschuerg wants to merge 1 commit into
masterfrom
feat/string-event-ids

Conversation

@tobiasschuerg

Copy link
Copy Markdown
Owner

Summary

  • Event.id (and the id param on Event.Single/Event.AllDay/Event.MultiDay) is now String instead of Long.
  • Long IDs invite accidental collisions when a consumer feeds events from more than one entity type into the same WeekData (e.g. two independent Room auto-increment primary keys can coincidentally match). A String ID 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 and EventOverlapCalculator's layout map are updated to String accordingly. All internal usages (key(), testTag, map lookups) are compatible with any type, so no other behavior changes.
  • Updated the sample app's demo data, unit tests, instrumented tests, and README examples to construct string IDs.

This is a breaking API change for anyone constructing Event.* directly; the commit is tagged feat!: 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

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.
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.

1 participant