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

User API: Add missing project display name and description #3451

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

puerco
Copy link
Contributor

@puerco puerco commented May 29, 2024

Summary

This PR populates the missing descriptions and display names of projects included in the user API.

Fixes #3178

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.

@puerco puerco requested a review from a team as a code owner May 29, 2024 01:42
@puerco puerco added the bug Something isn't working label May 29, 2024
@coveralls
Copy link

coveralls commented May 29, 2024

Coverage Status

coverage: 52.632% (-0.03%) from 52.662%
when pulling be2fc9b on puerco:display_name
into e9e43e9 on stacklok:main.

@puerco puerco force-pushed the display_name branch 2 times, most recently from 3c74bce to 81a2b94 Compare May 29, 2024 19:16
Comment on lines +215 to +217
DisplayName: pDisplay,
Description: pDescr,
Copy link
Member

Choose a reason for hiding this comment

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

@kantord - hey, in case the parsing above fails for some reason is it okay with you to have the default variable values here, i.e. empty strings?

Copy link

Choose a reason for hiding this comment

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

you mean specifically for description? I think for description, empty string is a reasonable fallback value, but for displayName I think that using the name as a fallback value would make more sense

Copy link

Choose a reason for hiding this comment

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

also, I'm not very informed about how the BE codebase works, but as I understand the fallback logic happens at insertion time, meaning this code itself does not address existing data in the database. I guess those could be fixed using a database migration or a manual query?

Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this code is happening on the way out of the database when answering the query, not on insertion. (That's both what I would expect, and matches the pattern in the code where we're constructing a protocol buffer for output.) If we change 203 to:

pDisplay := pinfo.Name
pDescr := ""

before calling ParseMetadata, that should be sufficient to fill in the defaults when the metadata doesn't exist in the database, without needing a backfill.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion @evankanderson , I've changed the initial values as suggested :)

This commit popukates the missing description and display name to the user API.

Signed-off-by: Adolfo García Veytia (puerco) <puerco@stacklok.com>
@puerco puerco merged commit b2aecdf into mindersec:main Jun 5, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users endpoint does not return displayName for projects
6 participants