Skip to content

feat: replace shadow-rs with self-maintained version info#7782

Merged
waynexia merged 5 commits intoGreptimeTeam:mainfrom
waynexia:patch-shadow-rs
Mar 10, 2026
Merged

feat: replace shadow-rs with self-maintained version info#7782
waynexia merged 5 commits intoGreptimeTeam:mainfrom
waynexia:patch-shadow-rs

Conversation

@waynexia
Copy link
Copy Markdown
Member

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

Shadow-rs watches itself and always triggers rebuild (no reproducible build). This patch removes shadow-rs and uses a self-maintained version info instead. This also removes the source-time field from version info, which seems unnecessary to me as we always include a commit hash

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@waynexia waynexia requested a review from a team as a code owner March 10, 2026 03:45
@github-actions github-actions bot added size/M docs-not-required This change does not impact docs. labels Mar 10, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the project's version information handling. The primary goal was to enhance build reproducibility and efficiency by replacing the shadow-rs dependency with a custom, in-house solution. This change also streamlines the collected version data by removing the source_time field, focusing on more critical build identifiers like commit hashes and branch names.

Highlights

  • Dependency Removal: The shadow-rs crate has been removed from the project's dependencies, along with its transitive dependencies like is_debug, tz-rs, tzdb, and tzdb_data.
  • Custom Version Info: A self-maintained version information collection system has been implemented in src/common/version/build.rs to replace the functionality previously provided by shadow-rs.
  • Build Reproducibility and Efficiency: The new custom system aims to improve build reproducibility by avoiding unnecessary rebuilds that shadow-rs sometimes triggered, especially in non-release builds.
  • Simplified Version Data: The source_time field has been removed from the version information, as it was deemed redundant given the presence of commit hashes, simplifying the BuildInfo structure and related API responses.
Changelog
  • Cargo.lock
    • Removed shadow-rs dependency
    • Removed is_debug dependency
    • Removed tz-rs dependency
    • Removed tzdb dependency
    • Removed tzdb_data dependency
  • src/common/version/Cargo.toml
    • Removed shadow-rs from [dependencies]
    • Removed shadow-rs from [build-dependencies]
  • src/common/version/build.rs
    • Rewrote the build script to implement custom Git and Rust compiler information collection
    • Introduced VersionState struct to encapsulate collected version details
    • Added functions for normalize_git_branch, load_product_version, emit_workspace_watch_list, tracked_watch_roots, git_ls_files, emit_git_watch_list, render_shadow_rs, write_if_changed, and git
    • Removed build_data::set_BUILD_TIMESTAMP() and get_source_time() calls
  • src/common/version/src/lib.rs
    • Replaced shadow_rs::shadow!(build); with a custom mod build { include!(concat!(env!("OUT_DIR"), "/shadow.rs")); }
    • Removed source_time and build_time fields from BuildInfo struct
    • Removed source_time and build_time fields from OwnedBuildInfo struct
    • Updated build_info() function to reflect the removal of source_time and build_time
  • src/servers/src/http/handler.rs
    • Removed source_time field from the StatusResponse struct
    • Adjusted the status() function to no longer include source_time in the response
  • src/servers/tests/http/http_handler_test.rs
    • Removed the source_time field from the expected_json in test_status
  • tests-integration/tests/http.rs
    • Removed the assertion for source_time in the test_status_api integration test
Activity
  • No specific activity (comments, reviews, etc.) was provided in the context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the shadow-rs crate with a self-maintained build script to generate version information. This is a good move to achieve reproducible builds and reduce dependencies. The implementation in build.rs is well-structured, particularly the logic for re-running the build script. I have a couple of suggestions to improve robustness and clarity.

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@waynexia waynexia added this pull request to the merge queue Mar 10, 2026
Merged via the queue into GreptimeTeam:main with commit 9e95214 Mar 10, 2026
45 checks passed
@waynexia waynexia deleted the patch-shadow-rs branch March 10, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants