minder icon indicating copy to clipboard operation
minder copied to clipboard

Remove database use from handleRelevantRepositoryEvent

Open jhrozek opened this issue 1 year ago • 1 comments

Summary

  • Add Property.Equal - Comparing properties will be useful to check if a matching property is a subset of the retrieved properties.
  • Add WithMatchProps to the HandleEntityAndDoMessage - We'll match the received entity on these properties
  • Don't forward entity if it doesn't match message.MatchProps - After receiving an entity, check if the message.MatchProps map is set. If yes, make sure that it is a subset of the properties of the entity just received. If it is not, drop the message. This will allow us to restrict forwarding the message by properties set by the caller.
  • Use the handler forwarding to evaluate repository/meta messages - Instead of fetching the repo directly in the handler and forwarding to a handler, create a NewEntityRefreshAndDoMessage message and offload the entity processing to minder-core. This removes the last piece of the github webhook that was directly touching the database with the exception of looking up the github app installation.

Fixes: #4703

Change Type

  • [ ] Bug fix (resolves an issue without affecting existing features)
  • [ ] Feature (adds new functionality without breaking changes)
  • [ ] Breaking change (may impact existing functionalities or require documentation updates)
  • [ ] Documentation (updates or additions to documentation)
  • [x] Refactoring or test improvements (no bug fixes or new functionality)

Testing

mostly unit tests + adding and removing repos

Review Checklist:

  • [x] Reviewed my own code for quality and clarity.
  • [ ] Added comments to complex or tricky code sections.
  • [ ] Updated any affected documentation.
  • [x] Included tests that validate the fix or feature.
  • [ ] Checked that related changes are merged.

jhrozek avatar Oct 09 '24 21:10 jhrozek

@JAORMX I think that rebasing #4704 onto this PR will make your tests work.

jhrozek avatar Oct 09 '24 21:10 jhrozek

Coverage Status

coverage: 53.191% (+0.06%) from 53.133% when pulling c67653b0c35824b70ce800e979e8795c4daabd0c on jhrozek:relevant_repo_new_handler into 01be8a3c70f00f810fe6e13ac5f961174a2ee3f7 on stacklok:main.

coveralls avatar Oct 11 '24 07:10 coveralls