-
-
Notifications
You must be signed in to change notification settings - Fork 50
Description
We don’t do a very good job supporting packages that have had their repository moved to another organisation or renamed within the same organisation.
Part of this comes from how we discover redirects. Our nightly PackageList process detects redirects using HTTP status codes. When we find a redirect from GitHub, we remove the old package from the package list and add the new one. The result of this is that the SPI app sees a brand new package and a removal of an old package, we have no concept of a rename inside the SPI database itself.
There are two main reasons we would want to support this:
- Redirection of old package pages. If
foo/bar
was renamed tobaz/qux
we should also redirect people who arrive on the oldfoo/bar
tobar/qux
. - Redirection of documentation. Links to documentation can live a long time on third party sites and it’d be great to not break those links if a package gets renamed
While I was thinking this through, I also had some ideas on how we might implement this. There are many ways, but we could potentially:
- Allow a collection of owner/repo string pairs that are all the previous repository locations for the repo.
- During analysis, gather those names and reconcile them with a “package redirects” table. During analysis, we’d need to be careful to remove all old redirect records for the package being analysed so we cope with situations where a package author removes a redirect.
- When a request is being processed, if it’s not for a valid package in the package list (so we cope with packages being recreated in their original position) then we check the redirects table and if we find one, we redirect the full path to the new repo, coping with long documentation URLs.
The entries in spi.yml
could maybe look something like this:
metadata:
previous_repositories:
- owner: foo
repository: bar
- owner: baz
repository: qux