-
Notifications
You must be signed in to change notification settings - Fork 557
Add information about the CLI version to generated code. #2673
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
Conversation
…module. Add insta filters for the version info in generated code.
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.
Note that we use the same build.rs
-derived env!("GIT_HASH")
mechanism for the CLI's spacetime version
output. As such, I don't think we're hung up about build.rs
potentially not rerunning.
Insta filtering seems to not be working, but once you fix that, this seems like an obvious win.
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.
My codeowned diff in crates/cli/src/version.rs
LGTM.
Description of Changes
This updates the comments at the top of all the generated files to include the cargo version and git commit of the CLI used to generate the code. For typescript, it also adds the
cliVersion
to theREMOTE_MODULE
, so the typescript SDK will be able to reference it (which should be helpful for adding context to logs and eventually checking for version drift between the SDK and codegen versions).To avoid needing to update code snapshots constantly with
insta review
, I added some filters to ignore the parts of generated code where we are inserting the version info.This isn't perfect, since
build.rs
doesn't always run when the current git commit changes, but releases should get the correct value (the existing--version
flag of the CLI has the same issue).There is a corresponding private PR to update CI checks.
API and ABI breaking changes
This doesn't change any APIs.
Expected complexity level and risk
Testing
This has testing in the snapshot, and I've also looked at the generated code.