-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: keep the schema version inside the package #62
base: main
Are you sure you want to change the base?
Conversation
Currently, the schema version espoused by this package is the package version itself (i.e., the version of its own `package.json`). Move this version to a resource file that maintained inside the package and is bumped explicitly. There are a couple goals here of decoupling the package version and the schema version: * For a practical reason: in a projen (mono)repo, all packages have version 0.0.0. At development time, the Cloud Assembly Schema has to know its own version, for various versioning checks. It can’t get it from the package version (which is 0.0.0, so it needs to get it elsewhere, which will be schema.version.json). * Semi-practical reason: updates flow smoother. A minor version bump of the Cloud Assembly schema more accurately reflects changes: new features that are added, without breaking changes. As such, Dependabot will automatically update to newer versions. As opposed to major version bumps, for which we will need to have a custom npm-check-updates script that upgrades major versions. * For a user focused future feature: better error messaging. If we give the Cloud Assembly Schema package version the same version as the CLI and we write that version to the manifest, it will be very easy to produce an error message like `You must install at least CDK CLI >= X.Y.Z to use this CDK application`.
But this is true now as well even without the monorepo change. How does it work now? And why do we need to know the version during development? |
Not sure I follow. What do you mean by "new features"? Every change to schema itself is considered a breaking change from a CDK deployment perspective. If you mean features that don't change the schema (like adding an API on top of it) - then we can still release a minor version for that change (in fact it will happen automatically).
Dependabot can be configured to bump major versions. Its just that we'll need an exclude/include setup in such a case. |
This is what sold me. I was never comfortable with the generic "update to the latest version" message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I want this to happen, but I don't know that it should happen before the repo split. Here's why:
Because this package is not in the same repo as the CLI, nothing guarantees that a CLI version that consumes the latest schema has already been released. This means that consumers who pickup a new schema version may be left hanging, with no CLI version compatible to it. The current versioning scheme drastically decreases the chances of this happening, because it requires a major version bump. If we do this now, consumers are gonna start getting automatic updates and might be baffled as to how to solve it (even if for a little while...).
Also, @TheRealAmazonKendra can you have a look at this too? |
@iliapolo @rix0rrr This is selling me as well. But... in the past we already had both packages in the same monorepo. Why was that not possible then? Is this actually a benefit that is coming out of this change? Or is it just something we need to do one way or another? |
I'd argue this is the other way around. A newer CLI can always use older schemas, but newer schemas require an up-to-date CLI. The breaking change is that you need to update your CLI. Is this not correct? |
This is clearly solved right now. Storing the version in a file seems completely unrelated to the version number. |
Neither Dependabot nor |
I'm not really against this change. My main concern is the messed up versioning we will get (from 2.x. to [31-37.x], back to 2.x and deprecating some versions). Seems risky and unnecessary to me. Finally I don't think the arguments you brought up for this are convincing. The main point seems to be "if schema and CLI have the same version, we have less work to do". That's a reasonable point. Let's just make it then. |
There are no tests in this package that depend on the version of the schema, but there are tests in the CLI that depend on the version of the Cloud Assembly schema. As in, the behavior of the test depends on a line in the CLI that says: if (schema.version < 10) {
doThis();
} else {
doThat();
} This test now fails because
I don't think I agree with this. An addition to the schema represents a new capability of the CLI. It is not a breaking change for the CLI to add a new capability. I guess it could be argued that it is disruptive for the (*) One might imagine a scenario in which we emit the version of the schema file as
Perhaps you're right. I'd argue there is a value to working with defaults... but this is a weaker argument.
Well here's a catch-22: we can't do the repo split before this has happened, because the CLI tests won't pass before this change has been made (they fail due to the reason I said above). I suppose we could do another workaround: disable the tests that fail. But we need to do something to unblock the CLI migration right now, and I figured moving this package into its desired state would be the simplest and cheapest overall solution. |
Honestly I think the test is wrong and it needs to run with the schema being set as both |
I can't really proceed with the migration without this change though. The projen scripts runs Since my target repository doesn't have tags yet, and I don't want to put an artificial |
b6059ce
to
4cceba4
Compare
Currently, the schema version espoused by this package is the package version itself (i.e., the version of its own
package.json
). Move this version to a resource file that maintained inside the package and is bumped explicitly.There are a couple goals here of decoupling the package version and the schema version:
You must install at least CDK CLI >= X.Y.Z to use this CDK application
.