Closed Ethan-Arrowood closed 6 years ago
Quick follow up. If everyone understands what is going on vote using emojis for how to proceed; i'm happy to work on updating the sdk and cli. Option 1 = π Option 2 = π Option 3 = π
what is the issue here? you're expecting cli to issue n requests for n resources given and it only issues one? you're expecting it to issue only 1 and it issues n?
I believe there is an inconsistency
please elaborate
Currently:
parsers.resourcesToObjects(req)
and expecting the req object to contain a list of resources. The extensions use Promise.all
on each of these resources. However the extensions are never receiving more than one resource as per the code in the CLI.
SDK:Extension:
cli code has two paths (not sure why, historical i guess) - second code path is the supported one, per the originally spec.
ie:
__always_: cli --resources aa/bb/cc dd/ee/ff
or cli --resources "aa/bb/cc" "dd/ee/ff"
never__: cli --resources "aa/bb/cc,dd/ee/ff"
we should probably remove that first code path or touch it up, i agree. Do you want to revisit this original spec behavior as well? open to changing if it makes sense to do so.
Lets stick with what you are referring to as the always condition and work from there.
Regardless of 1 resource or multiple, should the CLI dispatch a single request with all the resources in a list, or multiple requests (one per resource passed to the --resources
option?
imho/original design: always single
Okay so finally, extensions implementing the SDK should always expect to handle a list of resources?
The
platform-chaos
sdk defines a parserresourcesToObjects
that takes in thereq
object and then maps overreq.body.resources
processing each resource.This assumes
req.body.resources
looks something like so:[ "abc/123/def", "ghi/456/jkl"]
And the output of
resourcesToObjects
:When the user uses
platform-chaos-cli
and passes multiple resources like so:The cli
request-processor
takes this string and splits it over the,
(comma) and iterates over each resource dispatching independentthis._issueAsync
requests for each value.When the CLI is used with an extension implementing the SDK (for example the wiki tutorial and Thomas' extension) I believe there is an inconsistency with how resources are being handled.
Solutions
Next step
What are your thoughts? Questions? I'm happy to clarify anything confusing about this post.
@allydurks has a good take on this situation. We should probably go with option 1 or 2 for now and save option 3 for a later release as it is more complicated and will require more effort to implement correctly.
If this is not enough information to understand the situation I can write out an example referencing exact snippets of code (just LMK).