Open savetheclocktower opened 11 months ago
Oh, I forgot one: there's no test coverage for this method because it makes requests to an external URL. We should either
api.pulsar-edit.dev
), orapi.pulsar-edit.dev
endpoint, even if all it does is proxy calls to the equivalent GitHub endpoint (thereby allowing us to mock server responses with the same technique we already use for package-backend calls).Option 1 is probably easier, but maybe option 2 makes sense for other reasons that I'm unaware of.
(Sorry I haven't reviewed the PR content) But to comment only on your ideas about better testing.
I'd be much more inclined to go with option 1. Namely, because PPM already knows the GitHub repo to check, whereas if the call was made to the backend, it'd be via the package name, which then invokes a lookup to the database to find the repo, which can then be redirected to. At a glance this seems like a lot of system usage to help a testing only case, but if there's other benefits I'm unaware of I'd love to hear more.
Otherwise allowing customization of this could prove beneficial if we ever do move further on the conversation of more forge support (Although I have a feeling that'd involve way more due to API differences between services) but who knows could still maybe be a step in the right direction.
@savetheclocktower Some ideas, I've recently been looking at this library for us in pulsar-edit/package-backend
.
It hooks into the NodeJS built-in HTTP handlers to mock responses to any URL. If I recall correctly, superagent
does in fact use the built in handlers at the base, so it should be compatible for both the backend repo and here.
So this may be something we could look at to implement mocking of GitHub endpoints right now, with zero other changes.
If you'd like I can first go about testing this over in the backend repo to hopefully encounter any of the pitfalls that we may find.
Sure, let me know what you find. Seems promising.
Unclear to me how many of these issues/pieces of feedback might be different now with the large refactor of how ppm publish
is written in #132.
Just noting it in case it is relevant, leaving the breadcrumb trail, so to speak...
Have you checked for existing feature requests?
Summary
I found a few issues with the
publish
task, mainly around the part where we check GitHub to see whether it knows about the new tag:waitForTagToBeAvailable
method assumes that the tag will eventually show up. It doesn't try to handle situations where the API returns errors — for example, because of an exceeded rate limit.waitForTagToBeAvailable
used the same token that PPM uses in calls to the PPM API, that limit could be raised at least tenfold. It's worth doing.waitForTagToBeAvailable
doesn't have any error processing of its own. It doesn't envision thatwaitForTagToBeAvailable
can fail in any way. If we can't be sure the tag is present, we shouldn't proceed with publishing.What benefits does this feature provide?
Better error handling for
ppm publish
.Any alternatives?
Probably.
Other examples:
No response