Skip to content

Conversation

@jsdt
Copy link
Contributor

@jsdt jsdt commented Apr 27, 2025

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 the REMOTE_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

  1. This adds filters to the codegen snapshots, which could start to get more complicated.

Testing

This has testing in the snapshot, and I've also looked at the generated code.

jsdt added 2 commits April 27, 2025 11:36
…module.

Add insta filters for the version info in generated code.
@jsdt jsdt requested a review from gefjon as a code owner April 27, 2025 20:18
Copy link
Contributor

@gefjon gefjon left a 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.

@bfops bfops added the release-any To be landed in any release window label Apr 28, 2025
Copy link
Collaborator

@bfops bfops left a 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.

@jsdt jsdt added this pull request to the merge queue May 1, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 1, 2025
@jsdt jsdt added this pull request to the merge queue May 1, 2025
Merged via the queue into master with commit 14ba750 May 1, 2025
19 of 20 checks passed
@bfops bfops mentioned this pull request Jul 17, 2025
1 task
joslynesser added a commit to joslynesser/nixpkgs that referenced this pull request Aug 19, 2025
git directory needed by build.rs to set GIT_HASH at compile time
for use in code generation and CLI version output

see clockworklabs/SpacetimeDB#2673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants