Conversation
totalItems = mainCategories.size + 3 counted three trailing items (Device Capabilities, Accounts, About) rendered by hand right after the loop, with a comment naming them — two sources of truth for the same fact. Whoever adds a fourth trailing item and forgets the literal breaks the last item's rounded corner. The plan's original justification for this fix was wrong (verified against code): adding a SettingsCategory does NOT trigger the bug, mainCategories.size is already dynamic. The real fragility is the literal +3 itself, disconnected from the three ExpressiveXxxItem calls it's supposed to count. Fix: a private TrailingSettingsItem enum (DEVICE_CAPABILITIES, ACCOUNTS, ABOUT) rendered via forEach + an exhaustive when, same pattern already used for mainCategories. totalItems = mainCategories.size + trailingItems.size — a real collection's size, not a literal. Adding a fourth item now needs a new enum entry, and the compiler refuses to compile until the when covers it — the bug class becomes impossible, not just less likely. Self-review (code-review skill, medium effort) found the fix was only half done: the loop's own exclusion filter (it != ABOUT && it != DEVICE_CAPABILITIES) was a second, independent list of the same two categories, never derived from the new enum. Fixed by giving TrailingSettingsItem a nullable `category: SettingsCategory?` (null for Accounts, which isn't a category) and deriving the loop's filter from it — one enum now drives both the count and the exclusion, so a category can't end up rendered twice or dropped by only remembering to update one of the two lists. Also renamed the enum's entries to UPPER_SNAKE_CASE to match the sibling SettingsCategory enum's convention in this same file (was PascalCase). Zero behavior change: same onClick, same colors, same order, same shapeFor()/itemIndex bookkeeping. Testing: no automated test added. SettingsScreen needs the full Hilt graph (NavController, PlayerViewModel with ~30 dependencies, SettingsViewModel via hiltViewModel()) to instantiate at all, and there's no existing Compose test for this screen to build on — standing that up just for a compiler-enforced, non-behavior-changing refactor is disproportionate. Attempted visual verification on-device instead; blocked by this session's sandbox not delivering synthetic input events to the emulator (adb shell input — confirmed via raw getevent capture, zero events for both taps and keys after ruling out disk space as the cause) — documented, not silently skipped. Verified instead: assembleDebug succeeds, full JVM baseline unaffected (5 pre-existing failures, none new), and the diff traced by hand against the original for behavioral equivalence. graphify-out/ refreshed per this repo's CLAUDE.md.
Author
|
Closing for now — reorganizing how this work is staged. It'll go through our fork first and we'll propose it upstream again, possibly bundled differently, once the larger feature it's part of is further along. Not a rejection, just a process change on our side. |
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.
What
totalItems = mainCategories.size + 3counts three trailing items (DeviceCapabilities, Accounts, About) rendered by hand right after the category
loop, with a comment naming them — two sources of truth for the same fact.
Whoever adds a fourth trailing item and forgets the literal breaks the last
item's rounded corner. One of the small independent fixes listed in #2813.
The original justification for this fix (as scoped) turned out to be
wrong, verified against the code: adding a
SettingsCategorydoes nottrigger the bug —
mainCategories.sizeis already dynamic. The realfragility is the literal
+ 3itself, disconnected from the threeExpressiveXxxItemcalls it's supposed to count.Change
A private
TrailingSettingsItemenum (DEVICE_CAPABILITIES,ACCOUNTS,ABOUT) rendered viaforEach+ an exhaustivewhen, the same patternalready used for
mainCategories.totalItems = mainCategories.size + trailingItems.size— a real collection's size, not a literal. Adding afourth item now needs a new enum entry, and the compiler refuses to build
until the
whencovers it — the bug class becomes impossible, not justless likely.
A self-review pass (before this PR went up) found the first version of this
fix only half-solved the duplication: the loop's own exclusion filter
(
it != ABOUT && it != DEVICE_CAPABILITIES) was a second, independentlist of the same two categories. Fixed by giving
TrailingSettingsItemanullable
category: SettingsCategory?(nullfor Accounts, which isn't acategory) and deriving the loop's filter from it — one enum now drives both
the count and the exclusion.
Zero behavior change: same
onClick, same colors, same order, sameshapeFor()/itemIndexbookkeeping.Testing
No automated test added —
SettingsScreenneeds the full Hilt graph(
NavController,PlayerViewModelwith ~30 dependencies,SettingsViewModelvia
hiltViewModel()) to instantiate at all, and there's no existing Composetest for this screen to build on; standing that up just for a
compiler-enforced, non-behavior-changing refactor felt disproportionate.
Attempted on-device visual verification instead; blocked by a sandbox
limitation in my own environment (synthetic input events never reached the
emulator — confirmed via raw
geteventcapture, unrelated to the app).Verified instead:
assembleDebugsucceeds, full JVM baseline unaffected (5pre-existing failures, none new), and the diff traced by hand against the
original for behavioral equivalence.