[No QA] feat: add AI reviewer rule for catching invalid usage of loading components - #81479
Conversation
|
@kacper-mikolajczak @adhorodyski could you give this one a look? |
kacper-mikolajczak
left a comment
There was a problem hiding this comment.
Overal this looks LGTM! Curious how it is going to help with migration and usage later on 🤞
|
@Krishna2323 @Julesssss One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbdf164726
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| ### [UI-1] Use the correct loading indicator based on navigation context | ||
|
|
||
| - **Search patterns**: `FullscreenLoadingIndicator`, `ActivityIndicator` |
There was a problem hiding this comment.
Include
FullScreenLoadingIndicator in search patterns
This rule’s Search patterns only lists FullscreenLoadingIndicator, but the codebase also uses the FullScreenLoadingIndicator identifier extensively (e.g., many imports alias the same component this way). Because the reviewer instructions later require using each rule’s search patterns to grep large files, this omission will miss violations in files that use the FullScreen... spelling and create systematic false negatives for UI-1.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Yeah minor point but needs a capitol S
|
|
||
| - **Condition**: Flag ONLY when ANY of these patterns is found: | ||
| - `FullscreenLoadingIndicator` and `HeaderWithBackButton` (or other navigation like close button) are **both under the same JSX tree** (not separated by conditionals) | ||
| - `FullscreenLoadingIndicator` without `shouldUseGoBackButton` prop when **no navigation component** is visible alongside it |
There was a problem hiding this comment.
no navigation component is visible alongside it
This seems a bit vauge and open to interpretation
There was a problem hiding this comment.
Hmmmmm I was afraid that it might be not efficient to list all navigation components 🤔
I'm curious what do you think about it.
Also regarding this part " is visible alongside it", what about changing it to "in the same render branch"?
There was a problem hiding this comment.
Actually I can try to experiment with different variants of this prompts
There was a problem hiding this comment.
Happy with your suggestion here. It'll never be perfect 😅
There was a problem hiding this comment.
Excited to try this. Do you have any test output you could share? It's hard to know how our friend Claude will perform, but it looks great overall.
Update: Could you create a draft PR that breaks these rules, with some additional cases that SHOULD NOT be flagged as false positives? I'll run the workflow against it
adamgrzybowski
left a comment
There was a problem hiding this comment.
Good comments from @Julesssss, but overall LGTM
Sure! I'm gonna improve the prompt a bit and try to create a few draft PRs with different corner cases to see how it performs after changes |
|
@Julesssss I ran reviewer on different PRs that somehow use different loading indicators and here are the results PR #64 — Violations (should flag all)
PR #65 — Correct patterns (should NOT flag UI-1)
PR #66 — Edge cases (mixed)
|
|
Thank you, the results look great. Lets move forward! I'll create an issue to recheck manually in a month or so, as. secondary check. |
Julesssss
left a comment
There was a problem hiding this comment.
No comments about the specific rule data. LGTM
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.3.21-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.3.21-4 🚀
|
Explanation of Change
This PR adds an AI reviewer rule [UI-1] to support the ongoing migration by preventing new violations, and to serve as a permanent guard once the migration is complete.
The rule flags:
-
FullscreenLoadingIndicatorused alongside visible navigation (likeHeaderWithBackButton) - should useActivityIndicatorinstead-
FullscreenLoadingIndicatorwithoutshouldUseGoBackButtonprop when nonavigation is visible (users get trapped if loading hangs)
-
ActivityIndicatoras the sole screen content without any navigation (shoulduse
FullscreenLoadingIndicatorwithshouldUseGoBackButton)Why this matters:
If loading hangs indefinitely, users need an escape route. The
shouldUseGoBackButtonprop shows an emergency "Go Back" button after 10 secondstimeout. This rule ensures engineers use the correct component based on whether
navigation is already visible.
Fixed Issues
$ #79729
PROPOSAL:
Tests
.github/scripts/extractAllowedRules.shUI-1appears in output - if missing, the rule cannot be used by thereviewer
Test 1: Verify violation is flagged
ScreenWrapperandHeaderWithBackButton<FullscreenLoadingIndicator />inside the same return statement (alongsidethe header)
Test 2: Verify valid patterns are NOT flagged
FullscreenLoadingIndicatorwithActivityIndicator(keeping the headervisible)
Test 3: Verify
shouldUseGoBackButtonpatternFullscreenLoadingIndicatorwithshouldUseGoBackButtonpropOffline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari