Repository navigation
refactor: narrow plan, currency, chart, and video preview values - #103226
Conversation
Seatbelt-Operation: 4026f6b9-f9fe-4443-8cfd-07e619ccd7e8
Seatbelt-Operation: f8a19569-0abb-429e-a2e3-094cbd2debbc
Seatbelt-Operation: c422ddda-3c1b-403c-b8a4-eba3a6a14e3b
Seatbelt-Operation: 6df47529-1e13-4f81-ad41-bc184395612d
Seatbelt-Operation: 9ebe2014-21ca-44ee-b434-1dca06dab3fa
Seatbelt-Operation: main-20261030-103226-sign-494695ff-8d74-45c5-ab3f-23e8a4e94739
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4914605d05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Given no feature was selected | ||
| // When the real upgrade intro renders | ||
| render(<UpgradeIntro onUpgrade={jest.fn()} />); | ||
| // Then the generic view is shown |
There was a problem hiding this comment.
Explain why the new test expectations must hold
These Given/When/Then comments only repeat the adjacent render and expect; they do not explain why an unselected feature must fall back to the generic upgrade view. The Testing rule in AGENTS.md requires comments explaining why, and CONSISTENCY-14 prohibits comments that merely restate the code. Document the invariant or regression this scenario protects, and replace equivalent boilerplate in the other new tests, so future maintainers can distinguish intended behavior from incidental assertions.
AGENTS.md reference: AGENTS.md:L92-L92
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f93eb56. The Given/When/Then comments in the 14 new tests now explain why each behavior holds instead of restating the code.
Reword the Given/When/Then comments in the tests this PR added so they state the reason for each behavior. Comments only. Addresses Expensify#103226 (comment) Seatbelt-Operation: repair-codex-103226-sign-998d2349-438f-4c5d-b8d1-edfaf07d4f93 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seatbelt-Operation: merge-main-20261103-103226-sign-825c6367-0299-47ce-9c92-f004db296f80
|
@situchan Could you please take a look at this when you get a chance, Thanks! |
Seatbelt-Operation: merge-main-20261106-103226-sign-9b73006f-fd67-4113-ab83-7e2a8a79b984
| const illustrationIcon = Object.entries(illustrationIcons).find(([name]) => name === feature.icon)?.[1]; | ||
| const illustration = Object.entries(illustrations).find(([name]) => name === feature.icon)?.[1]; | ||
| const isIllustration = feature.icon in illustrations; | ||
| const isIllustrationIcon = feature.icon in illustrationIcons; | ||
| let iconSrc; | ||
| if (isIllustrationIcon) { | ||
| iconSrc = illustrationIcons[feature.icon as keyof typeof illustrationIcons]; | ||
| if (feature.icon in illustrationIcons) { | ||
| iconSrc = illustrationIcon; | ||
| } else if (isIllustration) { | ||
| iconSrc = illustrations[feature.icon as keyof typeof illustrations]; | ||
| iconSrc = illustration; |
There was a problem hiding this comment.
Icon lookup done twice
illustrationIcon and illustration are already found with Object.entries(...).find, but the in checks are kept to pick between them.
Fix: const iconSrc = illustrationIcon ?? illustration; and drop the in checks.
There was a problem hiding this comment.
Done. It now uses const iconSrc = illustrationIcon ?? illustration;. isIllustration is now illustration !== undefined, so all the in checks are gone.
…y check Address review: iconSrc is illustrationIcon ?? illustration, and isIllustration comes from the found illustration, so the in checks are gone.
Pass the upgradeSentryLabel prop that main made required in the UpgradeIntro tests.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safaritest.movtest2.mov |
|
Please update Tests steps to be more readable. Like this: There should be 4 test cases (chart label, video preview, preferred currency, workspace upgrade) |
|
Updated. The Tests section now has the 4 cases you listed: chart label, video preview, preferred currency and workspace upgrade. Each has a precondition, numbered steps and a "Verify that …" check. |
|
@situchan Both points are addressed: the icon lookup now uses |
blimpich
left a comment
There was a problem hiding this comment.
LGTM
– written by Claude on Ben's behalf
|
🚧 blimpich has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/blimpich in version: 9.5.37-0 🚀
|
|
No help site update needed — this PR refactors type handling while preserving existing user-facing behavior, adds no new workflow, and makes no existing article sentence incorrect. |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.37-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Remove unsafe type assertions from five production paths: workspace plan selection, upgrade artwork lookup, preferred currency, video attachment preview, and chart label units. Preserve the supported plan choices, currency precedence, artwork lookup, and chart formatting. The video preview accepts a nullable source-load event before requesting a thumbnail.
Changed files
src/pages/workspace/DynamicWorkspaceOverviewPlanTypePage.tsxsrc/pages/workspace/upgrade/UpgradeIntro.tsxsrc/hooks/usePreferredCurrency.tssrc/components/AttachmentPreview.tsxsrc/components/Charts/hooks/useChartLabelFormats.tstests/unit/DynamicWorkspaceOverviewPlanTypePageTest.tsxtests/unit/UpgradeIntroTest.tsxtests/unit/usePreferredCurrencyTest.tsxtests/unit/AttachmentPreviewTest.tsxtests/unit/components/Charts/useChartLabelFormats.test.tsFixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Tests
Use a signed-in ordinary test account that owns a Collect workspace.
1. Chart label
Precondition: the account has at least 3 USD expenses with different categories.
$10.2. Video preview (Android and iOS apps only, because sharing into Expensify uses the phone's share sheet)
Precondition: a short MP4 video is saved in the phone's photo gallery.
3. Preferred currency
Precondition: the account has no payment card added.
4. Workspace upgrade
Precondition: the Collect workspace has not been upgraded. Do not complete an upgrade during this test.
Unit tests also cover these paths:
useChartLabelFormats.test.ts,AttachmentPreviewTest,usePreferredCurrencyTest,DynamicWorkspaceOverviewPlanTypePageTestandUpgradeIntroTest.Offline tests
N/A for additional offline testing: the changes do not alter a network, persistence, retry, or reconnect path.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Screenshots/Videos (1)
Advanced Approvals artwork desktop and phone-sized
PR-103226-C01-DM.mp4