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

[HOLD for payment 2024-03-26] [$250] [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace #38167

Closed
mountiny opened this issue Mar 12, 2024 · 24 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Weekly KSv2

Comments

@mountiny
Copy link
Contributor

mountiny commented Mar 12, 2024

Problem

The getMemberAccountIDsForWorkspaceis a method that is used often in the App and if its performance degrades, it can have considerable impact on the App performance.

Solution

Let's add a measure function reassure test to cover various cases of this method call similarly as we have created such tests for ReportActionUtils methods for example.


Please refer to other tests in the repository, here is a readme for reassure tests which should help you get familiar with the tool.

All new tests should be written in TS.

Please provide a proposal stating, how you could write such test and scenarios for the method such that we test the slowest execution path as well.

cc @OlimpiaZurek

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012f1d655a8cb04a5b
  • Upwork Job ID: 1767636294734249984
  • Last Price Increase: 2024-03-12
Issue OwnerCurrent Issue Owner: @kevinksullivan
@mountiny mountiny added External Added to denote the issue can be worked on by a contributor Daily KSv2 NewFeature Something to build that is a new item. labels Mar 12, 2024
@mountiny mountiny self-assigned this Mar 12, 2024
@melvin-bot melvin-bot bot changed the title [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace [$500] [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace Mar 12, 2024
Copy link

melvin-bot bot commented Mar 12, 2024

Job added to Upwork: https://www.upwork.com/jobs/~012f1d655a8cb04a5b

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 12, 2024
Copy link

melvin-bot bot commented Mar 12, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @paultsimura (External)

Copy link

melvin-bot bot commented Mar 12, 2024

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Mar 12, 2024
@mountiny mountiny changed the title [$500] [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace [$250] [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace Mar 12, 2024
Copy link

melvin-bot bot commented Mar 12, 2024

Upwork job price has been updated to $250

@ShridharGoel
Copy link
Contributor

ShridharGoel commented Mar 12, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Add measureFunction test for getMemberAccountIDsForWorkspace.

What is the root cause of that problem?

New tests to ensure stability of performance in getMemberAccountIDsForWorkspace.

What changes do you think we should make in order to solve the problem?

Mock policy members and personal data.

Then, we can have scenarios like:

const scenarios = [
        {
            description: 'With multiple members without errors and login details',
            policyMembers: Array.from({length: 100}, (_, i) => ({errors: {}})),
            personalDetails: Array.from({length: 100}, (_, i) => ({login: `user${i}@example.com`})),
        },
        {
            description: 'With multiple members with errors and without login details',
            policyMembers: Array.from({length: 100}, (_, i) => ({errors: {someError: true}})),
            personalDetails: Array.from({length: 100}, (_, i) => ({})),
        },
        // More examples like these
    ];

We can run for all scenarios like this:

scenarios.forEach((scenario, index) => {
        test(`Scenario ${index + 1}: ${scenario.description}`, async () => {
            await measureFunction(() => getMemberAccountIDsForWorkspace(scenario.policyMembers, scenario.personalDetails));
        });
    });

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 12, 2024
@ghost
Copy link

ghost commented Mar 12, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

[Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace

What is the root cause of that problem?

New Feature of writing Tests

What changes do you think we should make in order to solve the problem?

This is the example test :

import {measureFunction} from 'perf-test-utils'; 
import {createMockPolicyMembers, createMockPersonalDetails} from 'test-data-utils';

describe('getMemberAccountIDsForWorkspace perf', () => {

  let policyMembers;
  let personalDetails;

  beforeEach(() => {
    // Create 10,000 mock policyMembers
    policyMembers = createMockPolicyMembers(10000);

    // Create 10,000 mock personalDetails
    personalDetails = createMockPersonalDetails(10000);
  });

  it('should handle 10,000 members', async () => {
    const result = await measureFunction(() => {
      getMemberAccountIDsForWorkspace(policyMembers, personalDetails);
    });
    
    // Assert performance is within expectations
    expect(result.duration).toBeLessThan(500); 
  });

  it('should handle 100,000 members', async () => {
    // Create 100,000 mock data
    policyMembers = createMockPolicyMembers(100000);
    personalDetails = createMockPersonalDetails(100000);

    const result = await measureFunction(() => {
      getMemberAccountIDsForWorkspace(policyMembers, personalDetails);
    });
    
    // Assert performance is still acceptable with 100K rows
    expect(result.duration).toBeLessThan(5000);
  });

});

The test creates mock policyMember and personalDetails data in different volumes. It times how long the getMemberAccountIDsForWorkspace function takes to process the data. It asserts the performance is within expected thresholds for different data sizes. This allows catching regressions as the data scales up.

What alternative solutions did you explore? (Optional)

N/A

@paultsimura
Copy link
Contributor

The proposal of @ShridharGoel looks good to me.
Just please note that the policyMembers is not an array, but an object.

@godofoutcasts94 I appreciate your intention to assert the execution time, but the measureFunction works a bit differently. Please refer to the Callstack's documentation for more details.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 13, 2024

Current assignee @mountiny is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 13, 2024
@mountiny
Copy link
Contributor Author

@ShridharGoel Can you please raise a PR? thanks!

Copy link

melvin-bot bot commented Mar 13, 2024

❌ There was an error making the offer to @paultsimura for the Reviewer role. The BZ member will need to manually hire the contributor.

Copy link

melvin-bot bot commented Mar 13, 2024

❌ There was an error making the offer to @ShridharGoel for the Contributor role. The BZ member will need to manually hire the contributor.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Mar 14, 2024
@ShridharGoel
Copy link
Contributor

PR: #38271

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 19, 2024
@melvin-bot melvin-bot bot changed the title [$250] [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace [HOLD for payment 2024-03-26] [$250] [Reassure] Add measureFunction test for getMemberAccountIDsForWorkspace Mar 19, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 19, 2024
Copy link

melvin-bot bot commented Mar 19, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.54-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-03-26. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 19, 2024

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@paultsimura] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.

@paultsimura
Copy link
Contributor

  • Determine if we should create a regression test for this bug: No – this was just an addition of a performance test.

@kevinksullivan
Copy link
Contributor

updated job here

https://www.upwork.com/jobs/~018339f69bac8f5267

@ShridharGoel lmk when you accept!

@ShridharGoel
Copy link
Contributor

@kevinksullivan Accepted, thanks.

@melvin-bot melvin-bot bot added the Overdue label Apr 8, 2024
@mountiny
Copy link
Contributor Author

mountiny commented Apr 8, 2024

@kevinksullivan @ShridharGoel @paultsimura can this be closed?

@paultsimura
Copy link
Contributor

From my side - all settled

@mountiny
Copy link
Contributor Author

mountiny commented Apr 9, 2024

Ok thanks!

@mountiny mountiny closed this as completed Apr 9, 2024
@melvin-bot melvin-bot bot removed the Overdue label Apr 9, 2024
@github-project-automation github-project-automation bot moved this from HIGH to Done in [#whatsnext] #quality Apr 9, 2024
@ShridharGoel
Copy link
Contributor

@kevinksullivan I think my payment is pending, can you check it?

@mountiny mountiny reopened this Apr 10, 2024
@ShridharGoel
Copy link
Contributor

@kevinksullivan Can you check this?

@melvin-bot melvin-bot bot added the Overdue label Apr 19, 2024
@kevinksullivan
Copy link
Contributor

All set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Weekly KSv2
Projects
Development

No branches or pull requests

4 participants