fix(theme): reach Material's default arguments, and measure the theme resolvers (M12 phase 8) #40
Reference in New Issue
Block a user
No description provided.
Delete Branch "chore/m12-phase-8-coverage-and-cutover"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
M12 phase 8 — the last phase. Scoped as docs, coverage and cutover prep; the AC-5 on-device walk turned it into a phase with code in it, which is what the walk existed to do.
1. Two theming defects the walk found
Both are phase 2's trap repeating: Material takes some themed values as default arguments, not from the theme. Phase 2 found it for card elevation and swept every
Card(intoShardCard(. Nobody then asked whether colour and shape had the same problem.ShardCarddrew in Material's grey, not the shard's panel colour.CardDefaults.cardColors()takes its container fromsurfaceContainerHighest—FilledCardTokens.ContainerColor, checked in the material3 1.3.0 bytecode — andshardColorSchememappedsurfaceContainer,…Highand…Lowbut not…Highest. 26 call sites in 20 files.FeatureCardwas unaffected because it readsLocalShardPalettedirectly, which is why Home looked right and every other screen did not.--radius-pill.NavigationDrawerItemtakesshapeas a default argument (CircleShape); the three call sites setcolors, nevershape.The card fix changes the untouched app, deliberately. The grey cards are not an M12 regression — an untouched instance draws them too and has since M5. Fixing it moves the shipped app's cards to
--panel-flat: the milestone's second deliberate change to a shard that has set nothing, alongside phase 2's shadow. There is no variant that spares untouched instances, because the shipped palette is therunic-gatewaypreset. AC-1 records the change rather than absorbing it — every other role is still asserted byte-for-byte against the verbatim pre-M12 scheme, and the two that moved are named, given new values, and checked to have genuinely differed before, so the test cannot pass by coincidence.Role sweep, so nobody redoes it: of the roles left at
darkColorScheme()defaults, exactly one had a live reader —surfaceContainerHighest. Checked against the token class of every Material component the app draws (NavigationDrawerTokens,SheetBottomTokens,AssistChipTokens,FilterChipTokens,TopAppBarSmallTokens,BadgeTokens); all read only mapped roles.scrimis read by the modal drawer and stays Material's black on purpose. The rest are latent — the app draws no Snackbar, tonal button, or elevated/outlined card.2. Sonar coverage exclusion narrowed
sonar.coverage.exclusionscarried aui/theme/**directory glob from the M11 coverage push, when that directory held only constants and composables. M12 put three pure resolvers in it —ShardPalette,ShardStructure,ShardTypeface, at 98% / 100% / 100% — and the glob discarded all of them. Now scoped toui/theme/Theme.kt, the one composable left.This does not rescue the gate: M12's already-measured code (
data/appearance/100%,ui/navigation/93–100%) clearsnew_coverage ≥ 50on its own. It makes the number honest about which code the tests actually hold.Pairs with the docs phase 8 PR. Both target
edge; the cutover is a separateedge→mainPR.How it was tested
./gradlew testDebugUnitTest lintDebug— 477 unit tests green (476 + the new card-container assertion), lint clean,assembleDebugclean.adb reverse tcp:3000 tcp:3000, so the debugnetwork_security_config's loopback exception is used unchanged):CustomTabActivityindumpsys activity, not by eye).My houses.ShardCards on the shard screen now paint--panel-flatbrown, and the selected drawer row is the 4px rectangle Fantasy asks for.nav_publicsha verified equal; test theme, brand-asset rows and uploaded files removed).Checklist
AI-assisted contributions (required)
Claude Code (Opus 5). I have reviewed and understandevery change, and take responsibility for it. AI-authored commits are
marked with a
Co-Authored-By/Assisted-Bytrailer.License
(GNU GPL v3.0 or later), and I have the right to contribute it.