-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[HelpDot] detect infinite redirect cycles in redirects.csv #40434
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
Conversation
|
@MonilBhavsar Please 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] |
MonilBhavsar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint and deployHelp job is failing
@MonilBhavsar All resolved.
|
| const backEdges: Map<string, boolean> = new Map<string, boolean>(); | ||
|
|
||
| for (const [node] of Object.entries(adjacencyList)) { | ||
| if (!visited.has(node)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (!visited.has(node)) { | |
| if (visited.has(node)) { | |
| continue; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linter does not like continue, so i had to remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that lint rule tbh, but this is fine for now
| const visited: Map<string, boolean> = new Map<string, boolean>(); | ||
| const backEdges: Map<string, boolean> = new Map<string, boolean>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not make them global variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no particular reason. done!
|
@MonilBhavsar ready for review, thank you! |
roryabraham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM. The only other idea I had was to create a generic graph implementation in src/libs, but I don't think that's a requirement since we only have one usage for now
|
|
||
| // Do a depth first search for all the neighbours. If a node is found in backedge, a cycle is detected. | ||
| const neighbours = adjacencyList[currentNode]; | ||
| if (neighbours) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you could safely remove this if statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there will be nodes that have no neighbours because this is a directed graph.
eg:
urlA, urlB
Graph will look like this
urlA -> urlB
urlB has no neighbours that we can go to. So we'll try to iterate over undefined in next line
| const backEdges: Map<string, boolean> = new Map<string, boolean>(); | ||
|
|
||
| for (const [node] of Object.entries(adjacencyList)) { | ||
| if (!visited.has(node)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that lint rule tbh, but this is fine for now
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
@roryabraham looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
yes this is the only usage, so i felt it's not necessary. |
|
not an emergency, HelpDot preview was expected to fail: #40434 (comment) |
|
✋ 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 production by https://github.com/mountiny in version: 1.4.64-6 🚀
|


Details
When there is a cycle in http redirect, there will be an infinite redirect loop causing the browser tab to crash.
Fixed Issues
$ https://expensify.slack.com/archives/C02QSAC6BJ8/p1713388335103579?thread_ts=1713227886.614229&cid=C02QSAC6BJ8
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.