Skip to content
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

Collect package data from specific tags #260

Merged
merged 7 commits into from
Jun 28, 2024

Conversation

confused-Techie
Copy link
Member

@confused-Techie confused-Techie commented Jun 21, 2024

Requirements

  • Filling out the template is required.

  • All new code requires tests to ensure against regressions.

    • However, if your PR contains zero code changes, feel free to select the checkmark below to indicate so.
  • Have you ran tests against this code?

  • This PR contains zero code changes.

Description of the Change

This PR enables the collection of package details via a specific ref. This means that the backend now supports mono-repos or in the case of #205 supports non-standard repositories such as those mirroring other forges.

The functionality differs slightly between:

Initial Publication

After verifying the repository exists, the backend first requests the available tags on GitHub. After collecting them then the data needed for the package (README.md, package.json) are collected according to each available tag we found earlier. This also has the benefit of resolving a long standing issue where when retroactively publishing other versions on initial publication the data shown for these previous versions was technically incorrect as it'd only show whatever was the latest data.

Publishing a Version

When we publish a new version we take the ref provided within the request. (Which has always been present, but actually the backend has been ignoring and not even collecting this value so far in operation)
This ref is then what's used to collect further details.


During these changes I ended up scraping many of the VCS 'unit' tests, as they were so closely coupled to actual logic and mocks it became unwieldy to rewrite as needed, and instead was easier to rewrite them as full integration tests with nock. With that I was able to discover some new issues, such as the documented return of the version publication endpoint being inaccurate, I discovered that during version publication we didn't ever verify the repository existed first, and finally found that if the version publication failed, the resulting webhook attempt to Discord could cause bigger failures than we'd hope. So of course this PR has also fixed all those above issues.

Fixes #205
Fixes #255

…ible to maintain unit tests on VCS

During this change-over in testing strategy, I was able to find bugs in webhook handling for versions and squash them, as well as found we skipped validating a repo existed during version publication. And finally found the documentation of the type of return was incorrect on post version endpoint
@confused-Techie confused-Techie marked this pull request as ready for review June 24, 2024 04:42
After some complexity added to featureDetection, seems that now `nock` is being cleaned up right after the API returns, not giving a chance for featureDetection logic to use those endpoints to function as it runs afterwards. Attempting a simple method of waiting, otherwise may need more featureDetection specific logic
@confused-Techie confused-Techie merged commit ce3ca97 into main Jun 28, 2024
5 of 6 checks passed
@confused-Techie confused-Techie deleted the use-refs-to-collect-package-data branch June 28, 2024 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant