Fix monthly/weekly wallet usage ping parameter
See original GitHub issueDescription
Monthly and weekly usage flags for the wallet parameter in the usage ping, are set to true every day in the month and week. This results in inaccurate monthly and weekly user stats for the wallet.
The wallet usage monthly and weekly flags should only be set to true once during the relevant period, if the wallet was used in the period.
Steps to Reproduce
Testers can use the faketime CLI to fake the system time for the browser process.
MITM proxy is recommended to see the usage ping query parameters. The parameter to look out for is walletActive
. The value is a bitfield: LSB is daily use, second bit is weekly use, MSB is monthly use. Example: A walletActive
value of 7 would indicate a monthly, weekly and daily use.
- Set current date to Feb 8, 2022
- Install browser with a fresh state
- Allow usage ping to occur, activate wallet, close browser
- confirm usage ping walletActive=0 (inactive)
- Increment the date by one day
- Open browser, wait for usage ping, open wallet, and close the browser
- confirm usage ping walletActive=7 (daily, weekly, monthly)
- Increment the date by one day
- Open browser, wait for usage ping, and close the browser
- confirm usage ping walletActive=1 (daily)
- Increment the date by 7 days
- Open browser, wait for usage ping, open wallet, and close the browser
- confirm usage ping walletActive=0 (no use since last report)
- Increment the date by one day
- Open browser, wait for usage ping, and close the browser - confirm usage ping walletActive=3 (daily, weekly)
- Set date to the first day in the next month
- Open browser, wait for usage ping, open wallet, and close the browser - confirm usage ping walletActive=0 (no use since last report)
- Increment the date by one day
- Open browser, wait for usage ping, and close the browser - confirm usage ping walletActive=7 (monthly, daily, weekly)
Actual result:
Usage pings:
- Correct. walletActive=0
- Correct. walletActive=7
- Incorrect. walletActive=7
- Incorrect. walletActive=4
- Incorrect. walletActive=7
- Incorrect. walletActive=4
- Correct. walletActive=7
Expected result:
See notes in test plan above.
Reproduces how often:
Easily reproduced
Desktop Brave version:
Building from source.
Brave: 1.37.30 Chromium: 98.0.4758.87 (Developer Build) (64-bit) Revision: e4cd00f135fb4d8edc64c8aa6ecbe7cc79ebb3b2-refs/branch-heads/4758 OS: Linux
Version/Channel Information:
- Can you reproduce this issue with the current release? Yes
- Can you reproduce this issue with the beta channel? Yes
- Can you reproduce this issue with the nightly channel? Yes
Other Additional Information:
- Does the issue resolve itself when disabling Brave Shields? No
- Does the issue resolve itself when disabling Brave Rewards? No
- Is the issue reproducible on the latest version of Chrome? N/A
Miscellaneous Information:
Raising PR soon. Will request uplift for upcoming release.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
Removing
QA/Blocked
as https://github.com/brave/brave-core/pull/12449 was uplifted into1.36.x
. However, this should be QA’d alongside https://github.com/brave/brave-core/pull/12277 using1.36.109
or higher.As discussed during the b-b meeting, @GeetaSarvadnya will run through a subset of the cases as this was already thoroughly verified on Nightly.
As discussed over the call, monthly usage is determined by calendar month and weekly usage is determined by the ISO week number of the year