Skip to content

fix: fix AnalyticsScreen LazyColumn crash and expand list key test coverage - #68

Merged
MaxMichel2 merged 6 commits into
mainfrom
fix/lazycolumn-key-crash-and-tests
Jul 22, 2026
Merged

fix: fix AnalyticsScreen LazyColumn crash and expand list key test coverage#68
MaxMichel2 merged 6 commits into
mainfrom
fix/lazycolumn-key-crash-and-tests

Conversation

@MaxMichel2

Copy link
Copy Markdown
Collaborator

Summary

  • Crash fix (devview-analytics)AnalyticsScreen LazyColumn was keyed on log.timestamp (epoch-milliseconds), which is not unique under rapid logging. Changed filteredAnalytics to use analytics.withIndex() so each item carries its original list position, then keys on item.index — guaranteed unique since AnalyticsLogger.logs is append-only.
  • Regression test (devview-analytics) — fixed log() helper (all tests defaulted to the same timestamp, silently broken); added logsWithSameTimestampAllRender test that verifies three same-timestamp logs all render without crashing.
  • LazyColumn stability tests — added multi-item render tests to FeatureFlipScreenTest and NetworkMockScreenTest as regression guards for their respective item keys.
  • Contributing docs — added "Compose List Keys" section to code-style.md (uniqueness, stability, semantic meaning rules) and a matching item to the PR checklist in pull-requests.md.

Test plan

  • Build: .\gradlew.bat assembleDebug -Pandroidx.baselineprofile.skipgeneration
  • Unit tests: .\gradlew.bat testAndroidHostTest -Pandroidx.baselineprofile.skipgeneration
  • Device tests: .\gradlew.bat connectedAndroidDeviceTest -Pandroidx.baselineprofile.skipgeneration
  • Lint: .\gradlew.bat detektFull
  • Manual: log multiple analytics events in rapid succession — screen must show all events without crashing

🤖 Generated with Claude Code

MaxMichel2 and others added 5 commits July 22, 2026 13:50
Key on the log's original position in the analytics list (via withIndex())
instead of log.timestamp — timestamps are not unique under rapid logging and
caused IllegalArgumentException when multiple events shared the same millisecond.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix log() helper: counter-based default timestamp prevents tests from
  silently sharing the same key when default is used
- Add logsWithSameTimestampAllRender: verifies three logs with identical
  timestamps all render, catching any future key regression

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that local and remote features of mixed types all render as
distinct list items, acting as a regression guard for the item key.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that multiple endpoint cards (getUser + createUser) both render
in the staging group, acting as a regression guard for the compositeKey.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…guide

Adds Compose List Keys section to code-style.md covering: uniqueness,
stability under state changes, and semantic meaning. Adds matching item
to PR checklist in pull-requests.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaxMichel2 MaxMichel2 self-assigned this Jul 22, 2026
@MaxMichel2
MaxMichel2 requested a review from matthiaslao July 22, 2026 11:56
@MaxMichel2 MaxMichel2 added the bug Something isn't working label Jul 22, 2026
@MaxMichel2 MaxMichel2 added this to the 0.2.0 milestone Jul 22, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaxMichel2
MaxMichel2 merged commit 88ffa33 into main Jul 22, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants