-
Notifications
You must be signed in to change notification settings - Fork 0
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
Resource Fuzzing #374
Closed
Closed
Resource Fuzzing #374
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is looking great, @Polarpi. I'm wondering if we can refactor these two below methods a bit to get it in bit of a more functional programming style, which can make this complex logic a bit easier to debug if things aren't working as we expect. Right now we're doing the spidering computations to the array in-place, which results in there being side effects produced in the computation—for example, the
resourceList
passed in as an argument tospiderResources
will now be modified after calling the function rather than returning a new, modified list, since JS is passing the reference to the array in forresourceList
and we're modifying that reference.It would be great if we can refactor a bit of the logic here to have us
map
over theresourceList
, and for each resource, callingcomputeSpideredCoordinates
which takes inresource
, the (unmodified)resourceList
, and returns a copy ofresource
with thespiderCoordinates
added. Here's an example of how that's handled in the backend with distances. We don't need RamdaJS necessarily here, but if we can make thecomputeSpideredCoordinates
be solely responsible for managing adding the coordinates to one resource object and returning a copy with those values added, then it becomes a matter of usmap
ping throughresourceList
to do this for each resource object.I definitely see the challenge in having
computeSpideredCoordinates
do it this way rather than filtering and modifying them all simultaneously. Definitely open to alternate solutions here, this is just a suggestion—I think the main priority is to make sure that we're not causing unintended side effects by callingspiderResources
to the passed in array or underlying objects, which is why immutability is key here.