Fix - incremental setup dependency - #2
Merged
AkshayChordiya merged 1 commit intoAug 14, 2026
Merged
Conversation
Edit any composable, rebuild, and every preview in the module comes back unthemed
with a `PG024`, even though the `@PoseSetup` object is right there and untouched.
Clean build fixes it until the next edit.
`getSymbolsWithAnnotation` only returns symbols from KSP's dirty file set. Nothing
in user source connects a composable to the config object. That edge only exists
in the code Pose emits, as `AppPose.Theme { ... }`. So on any round that didn't
touch the config file, the processor couldn't see it and took the no-config path.
Generated previews now declare the setup object's file as a `Dependencies` source
alongside their own, which keeps it in the dirty set:
```kotlin
val sources = listOfNotNull(containingFile, setupFile).distinct()
Dependencies(aggregating = false, *sources.toTypedArray())
```
I tried `aggregating = true` first. It doesn't work: only declared sources land in
the dirty set, so you regenerate more files and still lose the theme. Previews stay
isolating and incremental cost is unchanged.
Parameter types, sealed subtypes and `PreviewParameterProvider` classes don't need
the same treatment. They're all named in user source, so Kotlin already dirties the
composable when they change. I reproduced both to check.
To reproduce: put `@PoseSetup` in its own file, build, add a comment to any `@Pose`
composable, build again.
No tests in this PR, to keep the diff to the fix. Repro needs two compilations and
`CompileHarness` is one-shot, so covering it means a TestKit source set. I have that
working on a branch if you want it as a follow-up.
AkshayChordiya
self-requested a review
August 14, 2026 15:44
Owner
|
Great find and thank you so much for the fix, will merge it in! |
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.
Editing any composable makes Pose regenerate every preview in the module without its theme, warning PG024, until the next clean build.
getSymbolsWithAnnotationonly returns symbols from KSP's dirty file set. Nothing in user source connects a composable to the config object. That edge only exists in the code Pose emits, asAppPose.Theme { ... }. So on any round that didn't touch the config file, the processor couldn't see it and took the no-config path.Generated previews now declare the setup object's file as a
Dependenciessource alongside their own, which keeps it in the dirty set:I tried
aggregating = truefirst. It doesn't work: only declared sources land in the dirty set, so you regenerate more files and still lose the theme. Previews stay isolating and incremental cost is unchanged.Parameter types, sealed subtypes and
PreviewParameterProviderclasses don't need the same treatment. They're all named in user source, so Kotlin already dirties the composable when they change. I reproduced both to check.To reproduce: put
@PoseSetupin its own file, build, add a comment to any@Posecomposable, build again.Note
I was going to add tests, but wanted to keep the diff only related to the fix.
Repro and tests needs two compilations and
CompileHarnessis one-shot, so covering it means a TestKit source set. I have that working on a branch if you want it as a follow-up.