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

Added change summary and CVE report to state import #3385

Merged
merged 4 commits into from
Jul 8, 2024

Conversation

mitchell-as
Copy link
Contributor

@mitchell-as mitchell-as commented Jul 3, 2024

StoryDX-2550 Change and CVE information for `state import`

Also:

  • Refactored to use a primer for passing to cve runbit.
  • Enabled async runtime
  • Fixed and re-enabled import integration tests that were disabled in the early buildplanner days

@mitchell-as mitchell-as changed the base branch from master to version/0-46-0-RC1 July 3, 2024 17:17
@mitchell-as mitchell-as closed this Jul 3, 2024
@mitchell-as mitchell-as reopened this Jul 3, 2024
@mitchell-as mitchell-as requested a review from Naatan July 3, 2024 18:56
@mitchell-as mitchell-as marked this pull request as ready for review July 3, 2024 18:56
Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

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

I'm sorry this is doing a lot for what the story is asking for. I'm ok with a bit of scope creep to avoid or address technical debt, but this is starting to refactor cve reporting. I'm not against refactoring, but we need to be more intentional with those kinds of jobs. I imagine a lot of churn going into this PR as is if we are to include refactoring, and we'd be going through that churn without having done any requirement setting for the refactor in the first place.

I see two options:

  1. Bring issue back to triage; we file a new refactor story as a blocker and we repurpose the code changes in this PR for the refactor.
  2. Undo the refactoring changes and just focus on the requirements for the story, then keep these changes for a follow refactor story.

My preference would be number 2, but I'll defer to you as there's obviously a reason you resorted to the refactor, and so this may be a hard blocker for addressing the story.

@mitchell-as mitchell-as changed the base branch from version/0-46-0-RC1 to mitchell/dx-2932 July 3, 2024 21:37
@mitchell-as mitchell-as closed this Jul 3, 2024
@mitchell-as mitchell-as reopened this Jul 3, 2024
@mitchell-as
Copy link
Contributor Author

Okay, this PR now utilizes the new cves runbit from #3386. From the PR description, this PR

  • Adds change summary and CVE report to state import
  • Refactors state import to use a primer for passing to cve runbit.
  • Enabled async runtime for state import
  • Fixed and re-enabled state import integration tests that were disabled in the early buildplanner days

@mitchell-as mitchell-as requested a review from Naatan July 3, 2024 21:52
Base automatically changed from mitchell/dx-2932 to version/0-46-0-RC1 July 3, 2024 22:23
Comment on lines +142 to +145
rt, rtCommit, err := runtime.Solve(auth, out, i.prime.Analytics(), proj, &commitID, target.TriggerImport, i.prime.SvcModel(), i.prime.Config(), runtime.OptNone)
if err != nil {
return errs.Wrap(err, "Could not solve runtime")
}
Copy link
Member

Choose a reason for hiding this comment

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

This made me realize we're redundantly solving. Not asking for this to be addressed here, but for future context: https://activestatef.atlassian.net/browse/DX-2934

Filed it separately as this could easily get more complicated than just updating the model code and using the result from stageCommit directly (ie. UI implications).

}
}

if err := localcommit.Set(proj.Dir(), commitID.String()); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

This should happen before the runtime update, otherwise runtime update failing will cause the import to have no effect. This makes sense for state install because you're only touching one thing, but for import I think you'd want to retain the broken state so you can fix it.

Copy link
Contributor Author

@mitchell-as mitchell-as Jul 3, 2024

Choose a reason for hiding this comment

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

Huh, that's the opposite of what I'd expect. If I do state import and my requirements.txt is causing a build failure, I'd want to edit my requirements.txt and try again, not do a bunch of state uninstall, state install operations to try and fix things.

That said, I'll defer to you, but I wanted to double-check this is what you want (to update the localcommit first, then update the runtime).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going a step further, it's like apt install <long list of deps> and committing even if there's a dependency failure, and then expecting you to apt uninstall and apt install your way back to a working system. Now I understand we have state reset which may sidestep this issue entirely, but it's still an extra step. With a big red 'x' saying my runtime failed to build, I think it's reasonable as a user to assume nothing was committed.

Copy link
Member

Choose a reason for hiding this comment

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

@mitchell-as that's a good point, I'm honestly not sure. I could see an argument for both sides, because maybe the nature of the issue is not one that can be addressed by editing the requirements.txt, and further tweaking is required. In this case you'd need the interim state.

That said, the story didn't ask for a change to this mechanic, so I don't think we should be introducing it here. Especially when the value prop isn't black and white.

@mitchell-as mitchell-as requested a review from Naatan July 3, 2024 22:43
Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

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

@mitchell-as mitchell-as requested a review from Naatan July 8, 2024 14:30
@mitchell-as mitchell-as merged commit f4282e8 into version/0-46-0-RC1 Jul 8, 2024
7 checks passed
@mitchell-as mitchell-as deleted the mitchell/dx-2550-2 branch July 8, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants