Skip to content

Release v2.1.1 — Compose Module, Hardened Concurrency & ProGuard-safe Persistence#3

Merged
vietnguyentuan2019 merged 1 commit into
mainfrom
feature/krelay-compose-module
Apr 5, 2026
Merged

Release v2.1.1 — Compose Module, Hardened Concurrency & ProGuard-safe Persistence#3
vietnguyentuan2019 merged 1 commit into
mainfrom
feature/krelay-compose-module

Conversation

@vietnguyentuan2019
Copy link
Copy Markdown
Contributor

Summary

  • krelay-compose module: KRelayEffect<T> and rememberKRelayImpl<T> extracted to a standalone artifact (dev.brewkits:krelay-compose:2.1.1) with full Maven Central compliance
  • Atomic dispatch: closed TOCTOU window — impl lookup + queue insertion + persistence decision in a single lock
  • Identity-aware unregister: unregister(impl) only clears if the stored ref matches, preventing Compose recomposition from wiping a newer registration
  • ProGuard/R8-safe persistence: registerActionFactory / dispatchPersisted now require an explicit featureKey string; old overloads deprecated
  • Thread-safe KRelayMetrics: all operations lock-protected
  • iOS registration validation: registerFeature validates interface conformance at runtime
  • VoyagerDemo GC fix: navImpl hoisted into remember(navigator) to prevent K/N GC collecting it before first dispatch
  • Docs: README rewritten, COMPOSE_INTEGRATION.md patterns corrected (5 examples had the same GC bug), CHANGELOG accurate
  • CI: workflow now triggers on feature/** branches; krelay-compose added to build and publish pipeline
  • Tests: RegistryBehaviorTest added (identity unregister, same-class replacement, live metrics)
  • Logo: assets/logo.svg added

Test plan

  • ./gradlew :krelay:test — all unit tests pass
  • ./gradlew :krelay:linkDebugFrameworkIosSimulatorArm64 — iOS framework builds
  • ./gradlew :composeApp:assembleDebug — Android demo builds
  • CI: lint + test-android + test-ios + build all green

… Persistence

## What's new
- krelay-compose: KRelayEffect<T> and rememberKRelayImpl<T> extracted to a
  standalone artifact (dev.brewkits:krelay-compose:2.1.1) with full Maven
  Central compliance (POM, signing, javadoc jar)
- assets/logo.svg: new brand logo matching the brewkits library family style

## Concurrency & correctness
- Atomic dispatch: impl lookup + queue insertion + persistence decision all
  happen inside a single lock, closing the TOCTOU window that could strand
  an action indefinitely
- I/O outside lock: persistence save/remove called after releasing the lock
  so disk latency never blocks the dispatch path
- Identity-aware unregister: unregister(impl) only removes registration if
  the stored WeakRef points to the same object, preventing a recomposing
  Compose component from clearing a newer registration
- Thread-safe KRelayMetrics: all record*/get* operations are lock-protected

## API improvements
- KRelay.unregister<T>(impl: T? = null): identity-safe overload added to
  singleton API (consistent with KRelayInstance extension)
- ProGuard/R8-safe persistence: registerActionFactory and dispatchPersisted
  now require an explicit featureKey string; old overloads deprecated with
  replaceWith guidance
- getMetricsInternal: now returns live KRelayMetrics data (was emptyMap())

## iOS
- registerFeature validates interface conformance at runtime; crashes in
  debug mode, logs a clear warning in release
- KRelayKClassHelpers.kt added to iosMain for Swift KClass bridging
- KRelayIosHelper: removed duplicate getKClassForType function

## Bug fixes
- VoyagerDemo: navImpl hoisted into remember(navigator) to prevent K/N GC
  collecting it between registration and first dispatch
- COMPOSE_INTEGRATION.md: fixed 5 code examples with the same GC bug
  (impl created inside DisposableEffect setup block, not held by remember)
- KRelayBuilder: removed (v2.0.1) inline version annotations

## Docs
- README rewritten: modern structure, accurate What's New, persistent dispatch
  and scope tokens showcased, no false claims about actionExpiryMs change
- CHANGELOG 2.1.1 entry corrected and expanded
- RELEASE_NOTES_2.1.1.md corrected (removed wrong "1 min expiry" claim)

## CI
- workflow updated: triggers on feature/**, fix/**, release/** branches
- krelay-compose build added to build job
- composeApp iOS framework link added to build job
- publish-snapshot now publishes both krelay and krelay-compose

## Tests
- RegistryBehaviorTest (new): identity-aware unregister, same-class
  replacement, KRelay.getMetrics<T>() live data, metrics disabled,
  instance isolation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vietnguyentuan2019 vietnguyentuan2019 merged commit 26bcb8c into main Apr 5, 2026
2 of 8 checks passed
@vietnguyentuan2019 vietnguyentuan2019 deleted the feature/krelay-compose-module branch April 5, 2026 23:44
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