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

Add a Diff Visitor for BlueprintZoneConfigs #7336

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewjstone
Copy link
Contributor

This visitor walks a diffus generated diff and provides callbacks for users to hook into the parts of the diff that they care about.

To keep things minimal, we don't provide callback trait methods for copies (when nothing changes), and we don't provide methods for most diffus_derive generated types (the ones that start with Edited).

We anticipate composing these visitors to build up a full diff of a Blueprint. They can also be used individually as demonstrated with the included property based test.

In order to easily generate BlueprintZoneConfigs for property tests we derived Arbitrary for BlueprintZoneConfigs and its fields using the test-strategy crate. Some of the types in the hierarchy don't actually implement Arbitrary and they come from foreign crates. In this case a corresponding generation strategy was added that allows those types to be generated based on more primitive types that do implement arbitrary.

This PR is just one of many coming to build up and use automated blueprint diffs. It builds on the following PRs which must be merged in first:

This visitor walks a diffus generated diff and provides callbacks
for users to hook into the parts of the diff that they care about.

To keep things minimal, we don't provide callback trait methods for
copies (when nothing changes), and we don't provide methods for most
diffus_derive generated types (the ones that start with `Edited`).

We anticipate composing these visitors to build up a full diff of a
Blueprint. They can also be used individually as demonstrated with the
included property based test.

In order to easily generate `BlueprintZoneConfigs` for property tests we
derived `Arbitrary` for `BlueprintZoneConfigs` and its fields using the
`test-strategy` crate. Some of the types in the hierarchy don't actually
implement `Arbitrary` and they come from foreign crates. In this case a
corresponding generation strategy was added that allows those types to
be generated based on more primitive types that do implement arbitrary.

This PR is just one of many coming to build up and use automated
blueprint diffs. It builds on the following PRs which must be merged
in first:

 * oxidecomputer/newtype-uuid#56
 * oxidecomputer/diffus#8
@@ -369,7 +369,8 @@ derive-where = "1.2.7"
# Having the i-implement-... feature here makes diesel go away from the workspace-hack
diesel = { version = "2.2.4", features = ["i-implement-a-third-party-backend-and-opt-into-breaking-changes", "postgres", "r2d2", "chrono", "serde_json", "network-address", "uuid"] }
diesel-dtrace = "0.4.2"
diffus = { git = "https://github.com/oxidecomputer/diffus", branch = "oxide/main", features = ["uuid-impl", "derive", "newtype-uuid-impl", "oxnet-impl"] }
#diffus = { git = "https://github.com/oxidecomputer/diffus", branch = "oxide/main", features = ["uuid-impl", "derive", "newtype-uuid-impl", "oxnet-impl"] }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and newtype-uuid below must be merged first and this must be updated.

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.

1 participant