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

Refactor metadata route to properly add generation status within the route #2094

Merged
merged 5 commits into from
Jan 29, 2025

Conversation

HerveRI
Copy link
Collaborator

@HerveRI HerveRI commented Jan 9, 2025

Fixes #2081. Refactor metadata route to properly add generation status within the route.

@anth-volk
Copy link
Collaborator

anth-volk commented Jan 17, 2025

Hey Hervé! Could you do the following:

  1. Name this PR something describing what you're doing
  2. Add "Fixes #ISSUE_NUMBER" (fill in the number, no quotes) as the first line in the PR description

I'll review the technical content either later today or Monday

@HerveRI HerveRI changed the title Fixes issue_2081 Refactor metadata route to properly add generation status within the route Jan 18, 2025
Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

Hi @HerveRI, thanks for your contributions! I've left a few comments here, but looking forward to hopefully having this reviewed and merged by the end of this week.

removed:
- "status and message values from build_metadata function"
changed:
- "metadata_route to add status and message values to the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- "metadata_route to add status and message values to the
- metadata_route to add status and message values to the response object

nitpick, nonblocking: Remove quotes and ensure items are on one line

While YAML does allow for items to be spread across lines, we don't typically do so, and tend to add lines without quotes

@@ -41,8 +41,6 @@ def __init__(self, country_package_name: str, country_id: str):

def build_metadata(self):
self.metadata = dict(
status="ok",
message=None,
result=dict(
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue, blocking: Remove the result key and refactor

Your work here removing status and message and placing them within the route handler is exactly what we're looking for. However, the code here and below (I'll leave a separate comment illustrating it) creates a doubly-nested result key, breaking the metadata code. To fix this, I'd recommend removing the result key here and just returning the dictionary that is its value.

policyengine_api/routes/metadata_routes.py Show resolved Hide resolved
Copy link
Collaborator

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

Thanks for these changes @HerveRI! These all look good. Approving.

@anth-volk anth-volk merged commit 1a78fe3 into master Jan 29, 2025
4 checks passed
@anth-volk anth-volk deleted the HerveRI/issue2081 branch January 29, 2025 20:20
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 metadata route and library to properly add generation status within the route, not the library code
2 participants