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

Do not construct provider when validating user ID #3221

Merged
merged 3 commits into from
May 7, 2024
Merged

Conversation

dmjb
Copy link
Contributor

@dmjb dmjb commented May 1, 2024

Relates to #2845

When creating a provider, the code previously inserted the provider into the database and then instantiated it in order to validate that the user ID is correct. Alter the code so that it just instantiates the client and some supporting structures to validate the user ID.

This client deliberately does not use the client cache in order to simplify the code. Since this is the first usage of the client for that provider, we will never find a suitable client in the cache anyway.

This change was relatively small until I went to update the tests. As a result of changing the tests for the oauth handler, I ended up having to make the following changes:

  1. GitHubClientFactory now instantiates the Github delegates as well as the raw github client struct. This required moving the delegates into the same package as the factory to avoid a circular dependency.
  2. [Some other changes which were since merged in as part of other PRs]

Validated locally.

Summary

Provide a brief overview of the changes and the issue being addressed.
Explain the rationale and any background necessary for understanding the changes.
List dependencies required by this change, if any.

Fixes #(related issue)

Change Type

Mark the type of change your PR introduces:

  • 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)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

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

@coveralls
Copy link

coveralls commented May 1, 2024

Coverage Status

coverage: 50.133% (+0.03%) from 50.106%
when pulling 9072d57 on gh-delegate-service
into 9d5cd7e on main.

@dmjb dmjb force-pushed the gh-delegate-service branch 4 times, most recently from 1919211 to 3bfb6c5 Compare May 1, 2024 12:14
@dmjb dmjb marked this pull request as ready for review May 1, 2024 12:20
@dmjb dmjb requested a review from a team as a code owner May 1, 2024 12:20
@evankanderson evankanderson marked this pull request as draft May 1, 2024 13:05
@dmjb dmjb force-pushed the gh-delegate-service branch 2 times, most recently from 4259e81 to 64aa299 Compare May 1, 2024 15:34
@dmjb dmjb marked this pull request as ready for review May 1, 2024 15:39
@dmjb dmjb marked this pull request as draft May 2, 2024 09:04
dmjb added a commit that referenced this pull request May 2, 2024
Relates to #2845

This is part of a change which allows me to avoid some ugly hackery in
my draft PR (#3221). Break Project creation/deletion out into a pair of
dedicated structs/interfaces. Change the `ProjectFactory` function used
in the GitHubProviderService from a method on the controlplane to a
function which returns a function. This is needed for some additional
cleanup introduced in a future PR.
@dmjb dmjb mentioned this pull request May 2, 2024
10 tasks
dmjb added a commit that referenced this pull request May 2, 2024
Relates to #2845

This is part of a change which allows me to avoid some ugly hackery in
my draft PR (#3221). Break Project creation/deletion out into a pair of
dedicated structs/interfaces. Change the `ProjectFactory` function used
in the GitHubProviderService from a method on the controlplane to a
function which returns a function. This is needed for some additional
cleanup introduced in a future PR.
@dmjb dmjb force-pushed the gh-delegate-service branch 2 times, most recently from d68297e to 4b7c75f Compare May 2, 2024 15:02
Relates to #2845

When creating a provider, the code previously inserted the provider into
the database and then instantiated it in order to validate that the user
ID is correct. Alter the code so that it just instantiates the client
and some supporting structures to validate the user ID.

This client deliberately does not use the client cache in order to
simplify the code. Since this is the first usage of the client for that
provider, we will never find a suitable client in the cache anyway.
@dmjb dmjb marked this pull request as ready for review May 2, 2024 20:44
@dmjb dmjb merged commit 82dd48b into main May 7, 2024
20 checks passed
@dmjb dmjb deleted the gh-delegate-service branch May 7, 2024 13:02
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.

3 participants