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

lando-api: merge fixes from Flask LandoAPI (Bug 1944562) #224

Open
wants to merge 33 commits into
base: api-merge-without-fixes
Choose a base branch
from

Conversation

cgsheeh
Copy link
Member

@cgsheeh cgsheeh commented Feb 7, 2025

No description provided.

@cgsheeh cgsheeh requested a review from zzzeid February 10, 2025 15:54
@cgsheeh cgsheeh changed the base branch from main to api-merge-without-fixes February 19, 2025 15:08
@cgsheeh cgsheeh changed the title lando-api: merge content from Flask LandoAPI (Bug 1944562) lando-api: merge fixes from Flask LandoAPI (Bug 1944562) Feb 19, 2025
Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

Left comments that refer to what's in here in #227.

Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

Pausing the review about 1/3 of the way as per comment I left on src/lando/api/tests/test_landings.py.

Comment on lines 776 to 778
stack_state.landing_assessment.landing_repo = (
set_repo if not set_repo.is_legacy else set_repo.new_target
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: this feels like the wrong spot to have the target repo set -- might be out of scope for this PR, but I think having it at the "stack state" level might be more appropriate than the "landing assessment" level.

Copy link
Member Author

Choose a reason for hiding this comment

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

The "landing repo" is only relevant for a landing assessment. It is possible to have revisions with different repos in a stack, so the check doesn't make full sense at the "stack assessment" level. It is also possible to have a valid landing path within a stack that has multiple repos, when the path has the same repo for each revision. So we can't do the more simple check of saying any stack with multiple repos is invalid for landing.

I agree that putting this here is a little wonky. Perhaps as a follow-up we could find the landing repo when we build the landing assessment state, instead of here in this check, and then the check could instead just inspect the state and see if a valid landing repo was found (ie if not landing_assessment.landing_repo).

Copy link
Collaborator

Choose a reason for hiding this comment

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

The "landing repo" is only relevant for a landing assessment

Makes sense.

I think we should file a bug to track this. I think the main issue is that the blocker/check is altering the state of the target repo -- maybe this can happen somewhere higher up in the chain (this is more so an issue with the original implementation though, not so much the "porting" so it's out of scope here to some extent anyway). Ideally the check would get the target repo already in the correct form.

…562-merge-lando-api

revert some files to origin/main
@cgsheeh cgsheeh force-pushed the api-merge-without-fixes branch from 1d63218 to 869704b Compare February 25, 2025 15:45
Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

Looks good, two outstanding issues (and one previous unresolved comment) and we should be good to go.

@cgsheeh cgsheeh force-pushed the api-merge-without-fixes branch from 869704b to cd89b13 Compare February 26, 2025 18:40
@cgsheeh cgsheeh requested a review from zzzeid February 26, 2025 18:40
Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

There are merge conflicts in this branch, and it looks like the changes in api-merge-without-fixes have not been pulled back into this yet (as was done in the previous round of review). This is evident from the number of changes visible in this diff (should be similar to the previous round of review) since the histories have diverged.

image
git checkout api-merge
git merge origin/api-merge-without-fixes

Should fix this.

@cgsheeh
Copy link
Member Author

cgsheeh commented Feb 26, 2025

There are merge conflicts in this branch, and it looks like the changes in api-merge-without-fixes have not been pulled back into this yet (as was done in the previous round of review). This is evident from the number of changes visible in this diff (should be similar to the previous round of review) since the histories have diverged.
image

git checkout api-merge
git merge origin/api-merge-without-fixes

Should fix this.

Done.

@cgsheeh cgsheeh requested review from zzzeid and removed request for zzzeid February 26, 2025 21:58
Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

There is still a change that does not belong in this PR, but it looks like it is the last such one (src/lando/api/tests/test_transplants.py). This indicates that this section of the code was removed when resolving the merge conflict in #225, and needs to be re-added back to #225.

@cgsheeh cgsheeh force-pushed the api-merge-without-fixes branch from cd89b13 to 7536c51 Compare February 27, 2025 21:57
@cgsheeh cgsheeh requested a review from zzzeid February 27, 2025 21:58
Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

This PR can not be reviewed while it still has unresolved conflicts with the target branch. Once these conflicts are fixed I will review it (this is the same workflow as the last round of review.)

image

@cgsheeh cgsheeh requested a review from zzzeid February 28, 2025 19:26
Copy link
Collaborator

@zzzeid zzzeid left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think the issue with stack_state.landing_assessment.landing_repo should be tracked in a separate bug, as it could result in an inconsistency between checks when it comes to the target repo.

I assume that the legacy repo target functionality has been tested and works as expected based on these changes (i.e., a revision with a repo with a new_target set lands in that repo as expected).

Comment on lines +860 to +865
# If the landing repo on the current revision is set as a legacy repo
# of another repo, then change the landing repo to match the target.
set_repo = stack_state.landable_repos[repo_phid]
stack_state.landing_assessment.landing_repo = (
set_repo if not set_repo.is_legacy else set_repo.new_target
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this will have impact on functionality at this time, but it's a little odd that stack_state.landing_assessment.landing_repo will have different values in different checks. Maybe these should be set elsewhere to apply to all checks? Maybe there should be something like stack_state.landing_repo_mapping which could already have the correct mapping from a revision PHID to a target repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

I filed bug 1951169 to track this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wanna flag this file since it looks like it was deleted in the merge PR and re-added here. I just checked the diff (compared to what's in lando-api) and it looks like there are just 4 small formatting changes.

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