Skip to content

Deprecate and add lint rule to limit the usage of daysSinceInstalled#8136

Merged
YoussefKeyrouz merged 1 commit intodevelopfrom
feature/youssef/add_lint_deny_dayssinceinstalled
Apr 7, 2026
Merged

Deprecate and add lint rule to limit the usage of daysSinceInstalled#8136
YoussefKeyrouz merged 1 commit intodevelopfrom
feature/youssef/add_lint_deny_dayssinceinstalled

Conversation

@YoussefKeyrouz
Copy link
Copy Markdown
Collaborator

@YoussefKeyrouz YoussefKeyrouz commented Mar 28, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/1212810093780571/task/1213839965185097?focus=true

Description

This PR deprecates UserBrowserProperties.daysSinceInstalled() and add Lint rule to limit future usage (with baseline for current usages)

TLDR
UserBrowserProperties.daysSinceInstalled() is a less reliable implementation of the existing PackageInfo.firstInstallTime and PackageInfo.lastUpdateTime. It introduces a race condition that might break the logic if used on startup coroutines (e.g. if called from RealDuckChat.cacheUserSettings()). So it’s better and more reliable to use the existing time android provides, or APIs that leverage those values such as AppBuildConfig.isNewInstall()

Steps to test this PR (Optional, Can only be tested via code pull)

  • Pull the changes on the branch
  • Manually call UserBrowserProperties.daysSinceInstalled() from anywhere
  • verify lint fails
  • Line does not fail for existing usage

Note

Low Risk
Low risk: changes are limited to deprecating an API and adding a lint check with a baseline to prevent new call sites, with no runtime behavior changes unless callers migrate.

Overview
Deprecates UserBrowserProperties.daysSinceInstalled() and steers callers toward more reliable install-time APIs.

Adds a custom lint rule that flags new usages of daysSinceInstalled() while allowing existing usages via a baseline, preventing further adoption without breaking current builds.

Written by Cursor Bugbot for commit 4ada182. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Collaborator

@aitorvs aitorvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thanks for doing this

@YoussefKeyrouz YoussefKeyrouz force-pushed the feature/youssef/add_lint_deny_dayssinceinstalled branch from e831f5a to 4ada182 Compare April 3, 2026 18:31
@YoussefKeyrouz YoussefKeyrouz merged commit b68a987 into develop Apr 7, 2026
13 checks passed
@YoussefKeyrouz YoussefKeyrouz deleted the feature/youssef/add_lint_deny_dayssinceinstalled branch April 7, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants