You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-07-04] Remove call to getReportNameValuePairs() in canEditWriteCapability() #64014
canEditWriteCapability() is not a pure function because it references the report's NVPs from a global variable here. This is an anti-pattern that we are actively trying to unwind.
Solution
Using test driven development:
Make sure a unit test exists for canEditWriteCapability() in its current form (or create one if it doesn't exist)
Refactor canEditWriteCapability() to be a pure function, adding isReportArchived = false as a new parameter
Implement the new parameter in all code that calls canEditWriteCapability()
Ensure the unit tests still pass
Important
Please be sure that your proposal follows these best practices:
Don't add any more references to data obtained via Onyx.connect
Don't add any more references to isArchivedReport(nameValuePairs) unless absolutely necessary
Focus on connecting to the data in a UI component and passing the data all the way down with params
The React hook useReportIsArchived() is very useful for these
Look for existing references in the functions for the report's NVPs or see if isReportArchived has already been passed or calculated
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.71-11 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@DylanDylann@isabelastisser@DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
@DylanDylann The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment:
@DylanDylann If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
@DylanDylann If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
getReportNameValuePairs()#59961melvin-bot commentedon Jun 11, 2025
Triggered auto assignment to @isabelastisser (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.FitseTLT commentedon Jun 11, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-06-11 20:25:23 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Remove call to getReportNameValuePairs() in canEditWriteCapability()
What is the root cause of that problem?
Refactor
What changes do you think we should make in order to solve the problem?
Update the line here by
isArchivedparam passed tocanEditWriteCapabilityApp/src/libs/ReportUtils.ts
Line 8666 in fb250c6
and pass isArchived argument from all components here and here getting the value from
useReportIsArchivedhookWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Update the tests for canEditWriteCapability and also add one by passing isArchived param.
What alternative solutions did you explore? (Optional)
DylanDylann commentedon Jun 12, 2025
@tgolen Could I help on this stuff as C+?
DylanDylann commentedon Jun 12, 2025
@FitseTLT This issue is straighforward, I expect the contributor can give a more detailed unit test for canEditWriteCapability function
Your statement is so general
25 remaining items
melvin-bot commentedon Jun 27, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jun 27, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.71-11 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 2025-07-04. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jun 27, 2025
@DylanDylann @isabelastisser @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
isabelastisser commentedon Jul 1, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
@DylanDylann The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment:
@DylanDylann If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
@DylanDylann If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
DylanDylann commentedon Jul 2, 2025
This is a refactor, I think we don't need the checklist
melvin-bot commentedon Jul 4, 2025
Payment Summary
Upwork Job
BugZero Checklist (@isabelastisser)
isabelastisser commentedon Jul 7, 2025
Payment summary:
@FitseTLT paid in Upwork, $250 for proposal.
@DylanDylann requires payment through NewDot Manual Requests, $250 for C+ review.
FitseTLT commentedon Jul 7, 2025
Offer Accepted @isabelastisser 👍
trjExpensify commentedon Oct 3, 2025
approved $250 for @DylanDylann.