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

[MINT-3222] Milestone Solution Link #1541

Conversation

OddTomBrooks
Copy link
Contributor

@OddTomBrooks OddTomBrooks commented Nov 27, 2024

MINT-3222

Description

  • Added support for automatic upsertion of solutions when creating a new common milestone
  • Added support for milestone-solution links

How to test this change

  1. Validate scripts/dev test:go runs successfully
  2. Through Postman create a new common solution including common solution keys and validate that milestone-solution links are created in the mto_mileston_solution_links table corresponding to your inputs

PR Author Checklist

  • I have provided a detailed description of the changes in this PR.
  • I have provided clear instructions on how to test the changes in this PR.
  • I have updated tests or written new tests as appropriate in this PR.
  • Updated the Postman Collection if necessary.

PR Reviewer Guidelines

  • It's best to pull the branch locally and test it, rather than just looking at the code online!
  • When approving a PR, provide a reason why you're approving it
    • e.g. "Approving because I tested it locally and all functionality works as expected"
    • e.g. "Approving because the change is simple and matches the Figma design"
  • Don't be afraid to leave comments or ask questions, especially if you don't understand why something was done! (This is often a great time to suggest code comments or documentation updates)
  • Check that all code is adequately covered by tests - if it isn't feel free to suggest the addition of tests.

@OddTomBrooks OddTomBrooks changed the base branch from main to feature/MINT-3175_mto November 27, 2024 18:19
@OddTomBrooks OddTomBrooks marked this pull request as ready for review December 3, 2024 16:58
@OddTomBrooks OddTomBrooks requested review from a team as code owners December 3, 2024 16:58
@OddTomBrooks OddTomBrooks requested review from StevenWadeOddball, garyjzhao and patrickseguraoddball and removed request for a team December 3, 2024 16:58
Copy link
Collaborator

@ClayBenson94 ClayBenson94 left a comment

Choose a reason for hiding this comment

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

Overall this looks good! I think the new UPSERT-style resolver reads cleanly!

There's a few pieces of code I think we can nix, but the main thing to look at is probably adding the JOIN to the create-solution (allowing conflicts) query

pkg/graph/resolvers/mto_milestone.go Outdated Show resolved Hide resolved
pkg/sqlqueries/SQL/mto/solution/create_allow_conflicts.sql Outdated Show resolved Hide resolved
pkg/sqlqueries/mto_milestone.go Outdated Show resolved Hide resolved
pkg/storage/loaders/mto_solution.go Outdated Show resolved Hide resolved
pkg/storage/dataloader_keys.go Outdated Show resolved Hide resolved
Copy link
Contributor

@StevenWadeOddball StevenWadeOddball left a comment

Choose a reason for hiding this comment

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

Thanks @OddTomBrooks , I think that this looks good overall! I left a few comments, mostly around todos for future enhancement and minor changes.

I think we can get this to be a bit more efficient, but I think a TODO could be appropriate for the sake of this PR.

pkg/sqlqueries/mto_milestone.go Outdated Show resolved Hide resolved

arg := map[string]interface{}{"milestone_id": milestoneID}

returned, procErr := sqlutils.SelectProcedure[models.MTOMilestoneSolutionLink](np, sqlqueries.MTOMilestone.GetMilestoneSolutionLinksByMilestoneID, arg)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that you need to fetch links explicitly here, I think you can validate by fetching linked solutions instead. We don't really need to fetch links, just the solutions / milestones themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I thought about this quite a bit yesterday. In an ideal world our store would be mocked and we could do flow assertions, but the only way to validate the linking table is functioning as expected was to create a simple fetch. I feel like for unit testing / validation purposes having a fetch method is worthwhile.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good, that works for me! We have a separate ticket for fetching linked solutions, we could use that later if we want, I'm also fine just keeping it.

pkg/storage/dataloader_keys.go Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to earlier conversation, I think this might not be needed, instead we can just fetch the actual milestone / solution that is linked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above comment for continued discussion, I will apply the resolution here as well

pkg/graph/resolvers/mto_milestone.go Show resolved Hide resolved
pkg/graph/resolvers/mto_milestone.go Show resolved Hide resolved
pkg/graph/resolvers/mto_milestone_test.go Show resolved Hide resolved
@@ -390,6 +390,24 @@ func (suite *ResolverSuite) createDefaultTestAnalyzedAudit(mp *models.ModelPlan,

}

func (suite *ResolverSuite) createMilestoneCommon(
Copy link
Contributor

Choose a reason for hiding this comment

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

@OddTomBrooks, this is fine here, wanted to see what you thought about moving to the mto_milestone test file instead though? I think it might feel a bit better organizationally, though we aren't doing this now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is worth a higher level discussion on how we want to organize the logic in our test suite, let's have a chat after standup today

pkg/storage/mto_solution.go Show resolved Hide resolved
…ns_when_adding_common_milestone

# Conflicts:
#	MINT.postman_collection.json
#	pkg/graph/generated/generated.go
#	pkg/graph/schema/types/mto_milestone.graphql
Copy link
Contributor

@StevenWadeOddball StevenWadeOddball 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 making these changes @OddTomBrooks, it looks good.

I think that git did something weird with some files (eg, it's showing you adding the new categories resolver in GQL). I don't think it matters functionally though

@OddTomBrooks
Copy link
Contributor Author

Thanks for making these changes @OddTomBrooks, it looks good.

I think that git did something weird with some files (eg, it's showing you adding the new categories resolver in GQL). I don't think it matters functionally though

This happened when I merged in from the base branch. I took the incoming logic, not sure why it would be an addition. Maybe the formatting is off or something.

@OddTomBrooks OddTomBrooks merged commit 9d8e048 into feature/MINT-3175_mto Dec 4, 2024
10 checks passed
@OddTomBrooks OddTomBrooks deleted the task/MINT-3222_link_solutions_when_adding_common_milestone branch December 4, 2024 16:35
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