Add VersionMath.isSameVersion for prefix-tolerant equality checks#466
Conversation
….3' and '3.1.3' aren't treated as different
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a semantic version equality helper Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt`:
- Around line 257-261: The UI uses two different version-equality checks which
can produce contradictory states: replace the local normalizeVersion usage in
the Open/Uninstall gate with the centralized VersionMath.isSameVersion check so
both the install button branch and the Open/Uninstall branch use the same
comparison; update the Open/Uninstall logic in SmartInstallButton to call
VersionMath.isSameVersion(installedApp.installedVersion,
state.selectedRelease?.tagName) (handling the nullable selectedRelease/tagName)
instead of normalizeVersion so the composable consistently treats semantically
equal versions the same.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ae7243a7-637d-41bf-a2dd-20f20d2c4b79
📒 Files selected for processing (4)
core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/util/VersionMath.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/DetailsState.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/AppHeader.ktfeature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt
…s with the install branch
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt`:
- Around line 97-102: The isSameVersionInstalled check uses
VersionMath.isSameVersion with possibly blank/null installedApp.installedVersion
and state.selectedRelease?.tagName, which treats two blank values as equal and
incorrectly drives the CTA; before calling VersionMath.isSameVersion (in the
isSameVersionInstalled computation and the analogous code around the other
branch), normalize both versions and require they are non-empty (e.g., val
normInstalled = installedApp.installedVersion?.trim()?.takeIf { it.isNotBlank()
} and val normSelected = state.selectedRelease?.tagName?.trim()?.takeIf {
it.isNotBlank() }) and only call VersionMath.isSameVersion(normInstalled,
normSelected) when both normInstalled and normSelected are non-null/non-blank;
also use the non-blank normalized selected tag when rendering install_version
fallback so you never render an empty tag.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4b282982-591e-4cc8-8465-230dcd114807
📒 Files selected for processing (1)
feature/details/presentation/src/commonMain/kotlin/zed/rainxch/details/presentation/components/SmartInstallButton.kt
…onMath.isSameVersion
Summary by CodeRabbit
New Features
Bug Fixes