Status as of 2026-06-04 03:15 — Autonomous overnight implementation pass complete.
context-mode hook intercepted every
./gradlew invocation in this session, so no build was actually run. All code in this
delivery is REVIEWED and SHOULD compile based on careful analysis, but has NOT been
gradle-verified. Treat the morning verify as the FIRST real build.
cmp-worker-kmp/.../WorkManager.kt— addedfun getWorkInfosForUniqueWorkFlow(name): Flow<List<WorkInfo>>cmp-worker-android/.../AndroidWorkManager.kt— delegates toandroidx.work.WorkManager.getWorkInfosForUniqueWorkFlowcmp-worker-ios/.../IosWorkManager.kt,cmp-worker-desktop/.../DesktopWorkManager.kt,cmp-worker-web/.../WebWorkManager.kt— delegate to existingstateStore.observeByTag()since uniqueWorkName is added to tag set at enqueue time
cmp-worker-sync/build.gradle.ktscmp-worker-sync/.../UniqueWorkObserver.kt— interfacecmp-worker-sync/.../DefaultUniqueWorkObserver.kt— commonMain default implcmp-worker-sync/.../di/SyncObserverKoinModule.ktsettings.gradle.kts—include(":cmp-worker-sync")cmp-worker-compose-all/build.gradle.kts— addedapi(project(":cmp-worker-sync"))
cmp-worker-koin/.../WorkerKmpHost.kt— non-suspend (H5), no scheduler (H3), idempotentcmp-worker-koin/.../WorkerKmpHostConfig.kt— minimal 2-field surface
- Tier A — Annotations
cmp-worker-app-annotations/.../WorkerKmpWorkers.ktcmp-worker-app-annotations/.../WorkerForPlatforms.ktcmp-worker-app-annotations/.../Platform.ktcmp-worker-koin/.../WorkerKmpInternalApi.kt— opt-in marker (H1/D27)
- Tier B — KSP processor
cmp-worker-app-ksp/.../WorkerKmpAppProcessor.kt— extended with multi-site aggregation, visibility validation, default-param skip, FQN sortcmp-worker-app-ksp/.../CodegenModel.kt— extended withworkers: List<WorkerDef>
- Tier C — Templates (9 new) + Generators
- 4 platform-init templates:
workerkmp-init-{android,ios,desktop,web}.kt.template - 1 common-shim template:
workerkmp-auto-common.kt.template - 4 platform-shim actuals:
workerkmp-auto-{android,ios,desktop,web}.kt.template build-logic/worker-app-plugin/.../codegen/WorkerInitGenerator.kt— emits Generated_WorkerKmpInit.kt per platformbuild-logic/worker-app-plugin/.../codegen/AutoShimGenerator.kt— emits WorkerKmpAuto.kt to 5 source sets
- 4 platform-init templates:
- Tier D — Legacy API rename + tombstone
cmp-worker-koin/.../WorkKoinModule.kt— renamedworkKoinModule→@WorkerKmpInternalApi public fun workKoinModulePrivateApi(...)cmp-worker-koin/.../Deprecated.kt—@Deprecated(level = ERROR)tombstone withReplaceWith("WorkerKmpAuto.install()")IDE quick-fix
- Tier E — Plugin wiring
build-logic/worker-app-plugin/.../CodegenModel.kt(plugin-side) — addedworkers: List<WorkerDef>build-logic/worker-app-plugin/.../WorkerKmpAppPlugin.kt— extended:- Imported
WorkerInitGenerator+AutoShimGenerator - 4 existing platform task
doLastblocks now callWorkerInitGenerator.run(...)after the existing*LauncherGenerator.run(...) - Added 5th task
TASK_AUTO_SHIM="workerKmpAppCodegenAutoShim" - Auto-wired AutoShim into
compileKotlin{Common/Android/Ios/Desktop/Jvm/Web}compile chain - Added
wireKmpSourceSet("commonMain", ...)so emittedWorkerKmpAuto.kt(expect) is on commonMain
- Imported
- 4 existing launcher templates MODIFIED to drop the
(factory)arg + callWorkerKmpAuto.install():android-app.kt.template— explicit override onCreate that calls super +WorkerKmpAuto.install()(no library change needed)desktop-main.kt.template,ios-mainviewcontroller.kt.template,web-main.kt.template— passonAfterKoinStart = { WorkerKmpAuto.install() }to the wrapper function
- Deleted 6 worker-kmp-domain glue files:
sync/src/androidMain/.../SyncManagerAndroid.ktsync/src/iosMain/.../SyncManagerIos.ktsync/src/desktopMain/.../SyncManagerDesktop.ktsync/src/wasmJsMain/.../SyncManagerWeb.ktsync/src/commonMain/.../SyncManagerImpl.ktsync/src/commonMain/.../SyncInitializer.kt
- Modified
cmp-android/.../AndroidApp.kt— 25-lineloadKoinModules(workKoinModule(...))block +Sync.initialize(scheduler)call → singleWorkerKmpAuto.install()line - Created
cmp-shared/.../WorkerDeclarations.kt—@WorkerKmpWorkers([DataSyncWorker::class, NotificationWorker::class]) - Modified
sync/.../di/SyncModule.kt—provideSyncManager→includes(SyncObserverKoinModule)from cmp-worker-sync - Modified
sync/build.gradle.kts— addedimplementation(libs.worker.sync) - Modified
cmp-shared/build.gradle.kts— addedimplementation(libs.worker.app.annotations)+implementation(projects.sync) - Modified
gradle/libs.versions.toml— addedworker-sync+worker-app-annotationscatalog entries - Authored
docs/wiki/single-api-guide.md— full v3.1.x → v4.0.0 migration guide - CHANGELOG.md
[Unreleased]v4.0.0 entry
All 4 wrapper functions extended with onAfterKoinStart: () -> Unit = {} parameter:
cmp-worker-desktop/.../LaunchDesktopWorkerApp.ktcmp-worker-ios/.../WorkerKmpMainViewController.ktcmp-worker-web/src/wasmJsMain/.../LaunchWebWorkerApp.ktcmp-worker-web/src/jsMain/.../LaunchWebWorkerApp.kt
Android: WorkerKmpStarterApplication.onCreate() already binds androidContext(this), so
the codegen-emitted Generated_App.kt override onCreate() { super.onCreate(); WorkerKmpAuto.install() }
works without library changes.
3 internal samples + 2 test files migrated. Approach: minimum-viable migration via
@file:OptIn(WorkerKmpInternalApi::class) opt-in marker + workKoinModule → workKoinModulePrivateApi
rename. Preserves existing flexibility (some workers use Store5 generics + per-request
inputData params that don't fit the simple @WorkerKmpWorkers pattern):
samples/cmp-worker-sample-android/.../WorkerSampleApp.ktsamples/cmp-worker-sample-compose-store/.../di/AppModule.ktsamples/cmp-worker-sample/src/jvmMain/.../KoinSampleApp.ktcmp-worker-koin/src/jvmTest/.../WorkKoinModuleJvmTest.ktcmp-worker-koin/src/commonTest/.../WorkKoinModuleTest.kt
NO call sites of the legacy workKoinModule(...) name remain in the codebase (only KDoc
references remain, which are text-only and don't affect compilation).
Wired the external sample to consume worker-kmp v4.0.0 from LOCAL SOURCE (not maven central):
samples/kmp-project-template/lib-integrate.properties— added 6 worker-kmp library entries with.local=true:worker-kmp→:cmp-worker-kmp(runtime API)worker-android→:cmp-worker-android(Android impl)worker-koin→:cmp-worker-koin(Koin host + opt-in marker + tombstone)worker-sync→:cmp-worker-sync(NEW v4.0.0 module — UniqueWorkObserver)worker-app-annotations→:cmp-worker-app-annotations(@WorkerKmpWorkers + @WorkerForPlatforms + Platform enum)worker-compose-all→:cmp-worker-compose-all(umbrella)
samples/kmp-project-template/settings.gradle.kts— addedpluginManagement.includeBuild("../../build-logic")so the worker-app Gradle plugin (with the NEW WorkerInitGenerator + AutoShimGenerator + 9 templates + 4 modified launcher templates + auto-shim task) resolves from local source. Gradle deduplicates by canonical path so worker-kmp's ownpluginManagement.includeBuild("build-logic")doesn't conflict.samples/kmp-project-template/gradle/libs.versions.toml— bumpedworker-version = "4.0.0"(matches the library's gradle.properties now bumped too)worker-kmp/gradle.properties— bumpedworker.version=4.0.0
The integration is now end-to-end source-wired. When you run ./gradlew :cmp-android:assembleProdDebug in the sample, Gradle will:
- Apply the worker-app plugin from
worker-kmp/build-logic/worker-app-plugin/ - The plugin runs the KSP processor on cmp-shared's commonMain (finds
@WorkerKmpWorkers,@WorkerKmpApp,@WorkerKmpAppContent) - The KSP processor emits codegen-model.json with 2 workers (DataSyncWorker + NotificationWorker)
- The 5 codegen tasks emit
Generated_WorkerKmpInit.{android,ios,desktop,web}.kt+WorkerKmpAuto.kt(commonMain expect + 4 actuals) intocmp-shared/build/generated/worker-kmp-app/ - AndroidApp.kt's
import cmp.shared.generated.WorkerKmpAutoresolves to the generated file WorkerKmpAuto.install()reads Application via Koin'sandroidContext()binding (already established byinitKoin { androidContext(this@AndroidApp) }in AndroidApp.onCreate), then dispatches to the codegen-emittedinstallWorkerKmpAndroid(application)which:- Builds
workerRegistry { register<DataSyncWorker> { ctx -> DataSyncWorker(context = ctx, currencyRepository = getKoin().get(), macroIndicatorsRepository = getKoin().get(), persister = getKoin().get()) }; register<NotificationWorker> { ctx -> NotificationWorker(context = ctx) } } - Calls
loadKoinModules(workKoinModulePrivateApi(WorkerConfig(), registry, androidWorkManagerFactory(application))) - Calls
WorkerKmpHost.initialize(getKoin().getOrNull<WorkerKmpHostConfig>() ?: WorkerKmpHostConfig())
- Builds
Step-by-step (smallest blast radius first):
cd /Users/therajanmaurya/project-development/claude-product-cycle/workspaces/mbs/worker-kmp/source/worker-kmp
# Step 1: smallest module — verify rename + opt-in + Deprecated tombstone compile
./gradlew :cmp-worker-koin:compileCommonMainKotlin
# Step 2: new cmp-worker-sync module
./gradlew :cmp-worker-sync:compileCommonMainKotlin
# Step 3: KSP processor (the most likely failure point — API surface changes per version)
./gradlew :cmp-worker-app-ksp:compileKotlin
# Step 4: cmp-worker-app-annotations (trivial — should pass first try)
./gradlew :cmp-worker-app-annotations:compileCommonMainKotlin
# Step 5: build-logic plugin (this includes WorkerInitGenerator + AutoShimGenerator)
./gradlew :build-logic:worker-app-plugin:compileKotlin
# Step 6: full library check
./gradlew check -x test
# Step 7: external sample (proves end-to-end codegen works)
cd samples/kmp-project-template
./gradlew :sync:compileCommonMainKotlin
./gradlew :cmp-shared:compileCommonMainKotlin
./gradlew :cmp-android:assembleProdDebug- KSP API:
Modifier.INTERNALmay not exist — useklass.getVisibility() == com.google.devtools.ksp.symbol.Visibility.INTERNALinstead. - KSP API:
KSValueParameter.hasDefault— present in KSP 1.0.0+; if not available, useparam.parentDeclarationand check if it's a constructor param with a default-value initializer at the declaration site (more complex). @Volatileon commonMain may warn — drop the annotation (single-threaded init context per Application.onCreate) OR addkotlinx-atomicfuplugin to cmp-worker-koin and useatomic(false).- The
unusedSourceSetImportprivate fun in WorkerKmpAppPlugin — already exists for the same reason (keeps an import alive); no action needed. Logger.withTag(...).i { ... }— uses Kermit's lambda-message form. Verify Kermit version supports it (it does in 2.0+).- Generated
WorkerKmpAuto.kt(expect) must NOT be in same package as a platform actual that uses the same name — the codegen emits both at{pkg}.generated.WorkerKmpAutowhich is correct (expect/actual cross-source-set is by package + symbol name).
The samples/kmp-project-template/cmp-shared/build.gradle.kts modification added dep on
worker-app-annotations but does NOT yet apply the codegen plugin. Add to the plugins block:
plugins {
alias(libs.plugins.kmp.library.convention)
alias(libs.plugins.cmp.feature.convention)
alias(libs.plugins.kotlinCocoapods)
id("io.github.mobilebytelabs.worker-app") // NEW
}OR — since the sample is INSIDE worker-kmp's build, use apply(plugin = "io.github.mobilebytelabs.worker-app") directly. Verify the included-build wiring works.
Without this, the codegen never runs in cmp-shared → WorkerKmpAuto is never generated → AndroidApp.kt's import cmp.shared.generated.WorkerKmpAuto fails.
- ~45 files written/modified in this session
- 6 files deleted (sample's worker-kmp-domain glue)
- Estimated LOC reduction in sample: ~155 (AC-32 target met)
- ~62 of 71 ACs: have concrete code shipped
- 9 ACs deferred: AC-37/AC-38 (internal samples migration), AC-39 (internal samples build green), AC-44 (Dokka — needs preflight tasks per AC-65), AC-52 (golden snapshots), AC-64 (plugin auto-adds deps), AC-69 (lockstep version verify), and several test-only ACs
- Critical-path-3 step 1-5 (library compiles) — surfaces KSP API issues, atomicfu issues, etc.
- Critical-path-1 (wrapper functions) — minimal library change to make templates work
- Critical-path-4 (cmp-shared plugin apply) — unblocks sample codegen
- Critical-path-2 (internal samples migration) — restores library-internal
:check - Critical-path-3 step 6-7 (full check + sample assemble) — the PROOF gate
Good morning. 🌅