Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix monthly/weekly wallet usage ping parameter #20956

Closed
Tracked by #21437
DJAndries opened this issue Feb 7, 2022 · 10 comments · Fixed by brave/brave-core#12310
Closed
Tracked by #21437

Fix monthly/weekly wallet usage ping parameter #20956

DJAndries opened this issue Feb 7, 2022 · 10 comments · Fixed by brave/brave-core#12310
Labels

Comments

@DJAndries
Copy link
Collaborator

DJAndries commented Feb 7, 2022

Description

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.

  1. Set current date to Feb 8, 2022
  2. Install browser with a fresh state
  3. Allow usage ping to occur, activate wallet, close browser
    • confirm usage ping walletActive=0 (inactive)
  4. Increment the date by one day
  5. Open browser, wait for usage ping, open wallet, and close the browser
    • confirm usage ping walletActive=7 (daily, weekly, monthly)
  6. Increment the date by one day
  7. Open browser, wait for usage ping, and close the browser
    • confirm usage ping walletActive=1 (daily)
  8. Increment the date by 7 days
  9. Open browser, wait for usage ping, open wallet, and close the browser
    • confirm usage ping walletActive=0 (no use since last report)
  10. Increment the date by one day
  11. Open browser, wait for usage ping, and close the browser
    - confirm usage ping walletActive=3 (daily, weekly)
  12. Set date to the first day in the next month
  13. Open browser, wait for usage ping, open wallet, and close the browser
    - confirm usage ping walletActive=0 (no use since last report)
  14. Increment the date by one day
  15. Open browser, wait for usage ping, and close the browser
    - confirm usage ping walletActive=7 (monthly, daily, weekly)

Actual result:

Usage pings:

  1. Correct. walletActive=0
  2. Correct. walletActive=7
  3. Incorrect. walletActive=7
  4. Incorrect. walletActive=4
  5. Incorrect. walletActive=7
  6. Incorrect. walletActive=4
  7. 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.

@DJAndries DJAndries added OS/Android Fixes related to Android browser functionality OS/Desktop labels Feb 7, 2022
@DJAndries
Copy link
Collaborator Author

Related issue: #17059

@DJAndries
Copy link
Collaborator Author

DJAndries commented Feb 9, 2022

Please refer to the test plan in the issue description.

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Feb 24, 2022

@DJAndries Need a few clarifications on the test plan, please find my testing observations below:

  • wallet=7,3,4,1 what does these numbers indicate? I think wallet=0 is an inactive wallet (but when wallet is created also I am getting wallet=0 what is the difference then)

  • I have followed your test plan above. In step 8, I am getting the wallet=1 and usage pings are as below. But test plan says wallet should be wallet=0
    image

@DJAndries
Copy link
Collaborator Author

DJAndries commented Feb 24, 2022

@GeetaSarvadnya wallet is a bitfield.

Least significant bit = daily
Second bit = weekly
Most significant bit = monthly

Here is a description for each value:
0: no usage
1: daily
3: daily and weekly
5: monthly and daily
7: monthly, weekly, daily

Please note that the wallet usage values are totally independent from the browser usage flags (the monthly, weekly and daily URL parameters).

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Feb 25, 2022

@DJAndries The description is very ambiguous, e.g, for the value 6: monthly and weekly
In this case, what are the criteria to calculate the monthly usage ping as true? In a month period, how many days are considered for monthly pings calculation, what is the start and end day period in a month?

  • In a month if I use the wallet two days in each week (8days), does the monthly usage considered true?
  • In a month if I use the wallet only one day in 1st week, does the monthly usage considered true?
  • In a month if I use the wallet for 1 day in 1st week, and 3 weeks did not open the browser, does the monthly usage considered true?
  • In a month if I use my wallet for 2 days in the 1st week, 3 days in the 2nd week, 4 days in the 3rd week, and 5days in the 4th week, what should be the monthly usage pings? Is there any threshold value considered for the monthly usage ping calculation if so, what is the threshold value?

Also, how does the weekly usage calculation happen? what is the start and end day time period for weekly pings calculation? does it consider only Monday to Sunday time period?

I have verified the PR brave/brave-core#12310 and found a few bugs, looks like pings are not working as mentioned in the #20956 (comment). I have set up a call to discuss the wallet usage pings in detail. Thanks!

@DJAndries
Copy link
Collaborator Author

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

@kjozwiak
Copy link
Member

kjozwiak commented Mar 1, 2022

Will require 1.36.108 and brave/brave-core#12277 to be uplifted into 1.36.x as well. Labelling as QA/Blocked till brave/brave-core#12277 is uplifted.

@kjozwiak
Copy link
Member

kjozwiak commented Mar 1, 2022

Removing QA/Blocked as brave/brave-core#12449 was uplifted into 1.36.x. However, this should be QA'd alongside brave/brave-core#12277 using 1.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.

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Mar 2, 2022

Verification PASSED on


Brave | 1.36.109 Chromium: 99.0.4844.51 (Official Build) (64-bit)
-- | --
Revision | d537ec02474b5afe23684e7963d538896c63ac77-refs/branch-heads/4844@{#875}
OS | Windows 10 Version 21H2 (Build 19044.1526)

Clean profile

Case 1: Wallet=0_PASSED
  1. Launch Charles proxy
  2. Clean profile 1.36.109 and launch brave
  3. Confirmed that wallet usage pings are returned as wallet=0 as the wallet is inactive or not created yet
  4. Confirmed that browser usage pings daily=true, weekly=true and monthly=true
    image
Case 2: Wallet=7_PASSED
  1. Launch Charles proxy
  2. Clean profile 1.36.109 and launch brave and create a wallet today (2nd March)
  3. Close the browser
  4. Set the system date to 3rd March
  5. Relaunch the browser
  6. Confirmed that wallet usage pings are returned as wallet=7 as the wallet usage pings are sent for the 1st time
  7. Confirmed that browser usage pings daily=true, weekly=false, and monthly=false which is expected.
    image
Case 3: Wallet=1_PASSED
  1. Launch Charles proxy
  2. Clean profile 1.36.109 and launch brave and create a wallet today (2nd March)
  3. Close the browser
  4. Set the system date to 3rd March
  5. Relaunch the browser and unlock the wallet
  6. Close the browser
  7. Set the system date to 4th March
  8. Relaunch the browser and unlock the wallet
  9. Confirmed that wallet usage pings are returned as wallet=1 as the wallet usage pings are sent daily (user interacted with wallet daily)
  10. Confirmed that browser usage pings daily=true, weekly=false, and monthly=false which is expected.
    image
Case 4: Wallet=3_PASSED
  1. Launch Charles proxy
  2. Clean profile 1.36.109 and launch brave and create a wallet today (2nd March)
  3. Close the browser
  4. Set the system date to 3rd March
  5. Relaunch the browser and unlock the wallet
  6. Close the browser
  7. Set the system date to 4th March
  8. Relaunch the browser and unlock the wallet
  9. Close the browser
  10. Set the system date to 11th March
  11. Relaunch the browser and unlock the wallet
  12. Close the browser
  13. Set the system date to 19th March
  14. Relaunch the browser
  15. Confirmed that wallet usage pings are returned as wallet=3 as the wallet usage pings are sent daily and weekly
  16. Confirmed that browser usage pings daily=true, weekly=true, and monthly=false which is expected.
    image
Case 5: Wallet=5_PASSED
  • Set the system date to 31st March
  • Launch Charles
  • Clean profile 1.38.5 launch nightly and enable wallet
  • Verify https://laptop.updates.brave.com endpoint in Charles
  • Browser usage pings are true for daily/weekly/monthly which is expected
  • Close the browser
  • Set the system date to 1st April
  • Relaunch the browser and unlock the wallet
  • Browser reports the first wallet usage pings for daily, weekly, monthly and wallet = 7 which is expected
  • Close the browser
  • Set the system date to 2nd April
  • Relaunch the browser and unlock the wallet
  • The browser reports the wallet usage pings for (monthly and daily) wallet = 5 which is expected
    image

Upgrade profile

Case 1: Create wallet in 1.35.x and then upgrade to 1.36.x and check wallet usage pings_PASSED
  • Clean profile 1.35.103 and create a wallet today (2nd March)
  • Upgrade the profile to 1.36.109
  • Close the browser
  • Set the system date to 3rd March
  • Relaunch the browser and confirmed wallet usage pings are sent 1st time hence wallet=7 is returned and usage pings are daily=true, weekly=false, and monthly=false which is expected
1.35.x 1.36x
image image

@srirambv
Copy link
Contributor

srirambv commented Mar 3, 2022

Verification passed on Oppo Reno 5 with Android 12 running 1.36.109 x64 build

  • Verified test plan from issue description
Case 1: &wallet=0 - Passed
  • Set system date to today (March 3rd)
  • Clean install and launch browser
  • Verified wallet usage ping &wallet is appended to the browser usage ping
  • Verified wallet usage ping is wallet=0 as no wallet is created
  • Verified daily usage ping is as expected, daily=true , weekly=true & monthly=true
    image
Case 2: &wallet=7 - Passed
  • Set system date to today (March 3rd)
  • Clean install and launch browser
  • Verified wallet usage ping is wallet=0 as no wallet is created
  • Verified daily usage ping is as expected daily=true , weekly=true & monthly=true
  • Create wallet and then quit browser
  • Move device date ahead by 1 day to March 4th
  • Relaunch browser
  • Verified wallet usage ping is wallet=7 as expected
  • Verified daily usage ping is as expected, daily=true, weekly=false & monthly=false
    image
Case 3: &wallet=1 - Passed
  • Set system date to today (March 3rd)
  • Clean install and launch browser
  • Create wallet and quit browser
  • Move device date to 4th March
  • Relaunch browser and unlock wallet
  • Quit browser
  • Move device date to 5th March
  • Relaunch browser and unlock wallet
  • Verified wallet usage ping is wallet=1 as expected
  • Verified daily usage ping is as expected , daily=true, weekly=false & monthly=false
    image
Case 4: &wallet=3 - Passed
  • Set system date to today (March 3rd)
  • Clean install and launch browser and create wallet
  • Quit browser and move device date to 4th March
  • Relaunch browser and unlock wallet
  • Quit browser and move device date to 5th March
  • Relaunch browser and unlock wallet
  • Quit browser and move device date to 12 March
  • Relaunch browser and unlock wallet
  • Quit browser and move device date to 19 March
  • Relaunch browser and unlock wallet
  • Verified wallet usage ping is wallet=3 as expected
  • Verified browser usage ping is also as expected, daily=true, weekly=true&monthly=false`
    image
Case 5: &wallet=5 - Passed
  • Set system date to March 31st
  • Clean install and launch browser and create wallet
  • Quit browser and move device date to April 1st
  • Relaunch browser and unlock wallet
  • Quit browser and move device date to April 2nd
  • Relaunch browser and unlock wallet
  • Verified wallet usage ping is wallet=5 as expected
    image
Upgrade Profile
  • Install 1.35.102 and enable walelt
  • Upgrade to 1.36.109
  • Quit browser and move device date ahead by 1 day
  • Relaunch browser and verified wallet usage ping is set to wallet=7 as the pings are sent for the first time after upgrade
  • Verified browser usage pings are daily=true, weekly=false & monthly=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment