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(platform/gitlab): fix api reponse type in createPr fn #32428

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

RahulGautamSingh
Copy link
Collaborator

@RahulGautamSingh RahulGautamSingh commented Nov 9, 2024

Changes

Use correct return type in the createPr function. And fix the tests + snaps accordingly.

Context

Instead of using Pr & { iid: number} which works but is wrong cause many of the corresponding field in the actual repsonse from api has different names. Eg. source_branch in response but sourceBranch in type Pr.

This also means that we have been saving the pr info in wrong/incorrect form in the runtime config list as well as the snaps are based on this wrong structure which is not good.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

please split test and code refactoring to separate PR so the risk for regression is much lower

@RahulGautamSingh RahulGautamSingh changed the title refactor(gitlab): consolidate duplicate code refactor(platform/gitlab): fix api reponse type in createPr fn Nov 15, 2024
@RahulGautamSingh

This comment was marked as outdated.

@RahulGautamSingh RahulGautamSingh marked this pull request as draft November 15, 2024 19:50
auto-merge was automatically disabled November 15, 2024 19:50

Pull request was converted to draft

@RahulGautamSingh
Copy link
Collaborator Author

please split test and code refactoring to separate PR so the risk for regression is much lower

For createPr function the types used are wrong as they do not match the response we get from the api, hence the test and snaps are wrong too. Cannot correct one without disturbing the other.

I have split the getPr and fetchPrList refactoring in another PR which do not affect any tests. But createPr will have to get both code and test refactor together.

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

blocked

@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review November 21, 2024 19:27
@RahulGautamSingh RahulGautamSingh changed the title refactor(platform/gitlab): fix api reponse type in createPr fn refactor(platform/gitlab): fix api reponse type in createPr fn [WIP] Nov 21, 2024
@RahulGautamSingh RahulGautamSingh changed the title refactor(platform/gitlab): fix api reponse type in createPr fn [WIP] refactor(platform/gitlab): fix api reponse type in createPr fn Nov 21, 2024
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