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 state upgrade #3467

Merged
merged 16 commits into from
Aug 29, 2024
Merged

Added state upgrade #3467

merged 16 commits into from
Aug 29, 2024

Conversation

Naatan
Copy link
Member

@Naatan Naatan commented Aug 28, 2024

StoryDX-2623 As a user I can run a command and see what updates are available for my project

Couple of notable supplemental changes to facilitate state upgrade:

  • Refactored buildplan changesets (ie. buildplan.Diff()) to facilitate iteration of all changes regardless of type.
  • Expansion of --ts values moved to runbit.
  • buildplan.*.Dependencies() now take an extra argument that allows you to skip recursion for certain artifacts.
  • Added sliceutils.EqualValues which lets you compare two slices regardless of their ordering.
  • Added output.Structured() which allows you to print structured data without needing to create your own marshaller.
  • Centralized the definition of tree symbols.

@github-actions github-actions bot changed the base branch from master to version/0-47-0-RC1 August 28, 2024 18:26
@@ -54,14 +54,13 @@ func TestArtifact_Dependencies(t *testing.T) {
want: []string{
"00000000-0000-0000-0000-000000000002",
"00000000-0000-0000-0000-000000000003",
"00000000-0000-0000-0000-000000000001",
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 old assertion failed due to my fix here:

https://github.com/ActiveState/cli/pull/3467/files#diff-9a4a1ec82a2498e8c04daf3594acd7e9f1de41731d7ef7539864881784a5c5c9R270

Before that you would get artifacts that had technically already been "seen". ie. asking for deps on artifact ID 1 would return 1. Which is not expected (and ironically; also a cycle).

@Naatan Naatan requested a review from MDrakos August 28, 2024 22:10
Copy link
Member

@MDrakos MDrakos left a comment

Choose a reason for hiding this comment

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

This looks great to me, just some minor comments and one question.

I would also recommend running the cve integration tests as well as any that depend on change summaries just to ensure that the changes there didn't affect anything.

Comment on lines +1565 to +1566
other: "[CYAN]{{.V0}}[/RESET] > [BOLD][ACTIONABLE]{{.V1}}[/RESET]"
name:
Copy link
Member

Choose a reason for hiding this comment

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

Does this not need a second [/RESET]?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the resets act on everything. It's basically telling the shell "go back to normal rendering".

bumpedBS.SetAtTime(ts)

if bumpedBS.AtTime().String() == localCommit.BuildScript().AtTime().String() {
panic(fmt.Sprintf("bumped buildscript is same as local commit, old: %s, new: %s", bumpedBS.AtTime(), localCommit.BuildScript().AtTime()))
Copy link
Member

Choose a reason for hiding this comment

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

Is this leftover from initial development? If not I'm wondering why we would add a panic for a known error case that we can handle in a more graceful manner.

Copy link
Member Author

Choose a reason for hiding this comment

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

Woops, it is indeed leftover. Thanks for spotting!

@@ -112,3 +114,23 @@ func ToLookupMapByKey[T any, K string | int | strfmt.UUID](data []T, keyCb func(
}
return result
}

// EqualValues checks if two slices have equal values, regardless of ordering. This does not recurse into nested slices or structs.
func EqualValues[S ~[]E, E cmp.Ordered](a, b S) bool {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Unit test for this function would be nice.

@Naatan Naatan requested a review from MDrakos August 29, 2024 20:26
@Naatan Naatan merged commit 85b4b5c into version/0-47-0-RC1 Aug 29, 2024
7 of 8 checks passed
@Naatan Naatan deleted the DX-2623 branch August 29, 2024 20:46
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