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

Add invenio GitHub #1337

Merged
merged 3 commits into from
Jul 17, 2023
Merged

Conversation

alejandromumo
Copy link
Member

@alejandromumo alejandromumo marked this pull request as ready for review June 27, 2023 13:56
@alejandromumo
Copy link
Member Author

Tests are failing because invenio-github version is still the old one and has some old dependencies.

We need to:

Copy link
Member

@ppanero ppanero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice job! massive including the invenio-github PR. Could I ask you to transform the TODO into issues? we know TODO die burried in the code.

Needs tests 😇

invenio_rdm_records/github/release.py Outdated Show resolved Hide resolved
invenio_rdm_records/github/release.py Outdated Show resolved Hide resolved
invenio_rdm_records/github/release.py Outdated Show resolved Hide resolved
def process_release(self):
"""Processes a github release.

The release might be first validated, in terms of sender, and then published.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean validated before the process_release is called?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Basically, I and @slint were discussing whether the public interface of GithubRelease should be just a publish method or also a process_release. But then we agreed that maybe the release "manager" (in this case in RDM) might want to do something before publishing the record - even though for now the release processing only publishes a record.

Conceptually, processing the release and publishing the record are distinct actions thus we separated them.

invenio_rdm_records/github/release.py Outdated Show resolved Hide resolved
from invenio_records_resources.services.uow import UnitOfWork


class RDMGithubRelease(GitHubRelease):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class seems to:

  • Extract information from a release and create a dictionary of data via underscored methods (see comment below)
  • Do record resolution manually, e.g. calls to PersistentIdentifiers and implement a pseudo resolver. Can we use existing resolvers/api classes?
  • Process the release (missing validation?)
  • Publish the release via rdm-records services

It seems to be a bit cluttered between an api class and a "service" (does not have to be a full fledge one, but split what's an object with information and data layer and what's management of it with service calls).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point-by-point replies:

1 - totally agree :)
2 - I ended up using PersistentIdentifier.get_by_object_uuid because we associate the record id (UUID) to the release as a weak reference to the record. Therefore, when we have a release with an associated record UUID, we can't use the PID resolver as it expects a pid_value and not object_uuid. I did not find any resolver for such a case but maybe I missed it
3 - see the reply below. This method is part of the public interface of invenio_github.api.GithubRelease and, in this case, simply calls the record publishing part. Which validation do you refer to?

invenio_rdm_records/github/release.py Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
@alejandromumo alejandromumo force-pushed the add_invenio_github branch 3 times, most recently from 90c5266 to c5ce68c Compare June 30, 2023 12:59
@zzacharo zzacharo merged commit 0cff2ab into inveniosoftware:master Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor invenio-github backend
3 participants