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

PNE-816: Make the project search endpoint to use the teams version one #974

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

pacdaemon
Copy link
Contributor

@pacdaemon pacdaemon commented Nov 12, 2024

Citrine Python PR

Description

Jira ticket: https://citrine.atlassian.net/browse/PNE-816

For searching for projects in the SDK we were using a team-agnostic endpoint, causing the search to be executed in a broader scope (all of the teams visible to the user). This work switches the endpoint so the search will have the right scope.

PR Type:

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Maintenance (non-breaking change to assist developers)

Adherence to team decisions

  • I have added tests for 100% coverage
  • I have written Numpy-style docstrings for every method and class.
  • I have communicated the downstream consequences of the PR to others.
  • I have bumped the version in __version__.py

@pacdaemon pacdaemon changed the title bugfix/PNE 816 PNE-816: Make the project search endpoint to use the teams version one Nov 12, 2024
@pacdaemon pacdaemon marked this pull request as ready for review November 12, 2024 17:12
@pacdaemon pacdaemon requested a review from a team as a code owner November 12, 2024 17:12
Copy link
Collaborator

@kroenlein kroenlein left a comment

Choose a reason for hiding this comment

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

I have a preferred solution approach, but I'm not fundamentally opposed to this solution.

Comment on lines 650 to 654
if self.team_id is None:
path = "/projects/search"
else:
path = format_escaped_url("/teams/{team_id}/projects/search", team_id=self.team_id)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to follow the existing patterns if possible, as opposed the the more local definition here. Are there any routes that still should always be using a team-agnostic project access? It seems like the better strategy here is to define _path_template as a @property that conditionally includes the team.

I can code that up if it doesn't make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It totally makes sense. For this, we might need to do some research to verify that every endpoint called has a counterpart. If you agree, I would ticket that up, as I imagine I will find a few interesting things while doing it.
I can handle that myself after some high-priority work I need to address on another topic. What do you think?

@kroenlein kroenlein mentioned this pull request Nov 12, 2024
8 tasks
Copy link
Collaborator

@kroenlein kroenlein left a comment

Choose a reason for hiding this comment

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

With the merged changes, this looks good to go. Verified functionality with current e2es, but those should be updated to use team routes.

@pacdaemon
Copy link
Contributor Author

I reproduced the flow locally, and I have a green light on the execution:

SDK code and response

Screenshot 2024-11-15 at 15 33 08

Account service logs

2024-11-15 15:31:27 POST /api/v3/projects/search?userId=6f664ee7-aae8-45f9-8afc-24747379f4c1 200 17.739 ms - 15

@pacdaemon pacdaemon merged commit e184f5d into main Nov 15, 2024
16 checks passed
@pacdaemon pacdaemon deleted the bugfix/PNE-816 branch November 15, 2024 14:33
@kroenlein kroenlein mentioned this pull request Nov 15, 2024
8 tasks
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.

2 participants