Skip to content

openvmm: add minimal tag-derived source identity - #3989

Draft
benhillis wants to merge 17 commits into
microsoft:mainfrom
benhillis:user/benhill/openvmm-git-build-info
Draft

openvmm: add minimal tag-derived source identity#3989
benhillis wants to merge 17 commits into
microsoft:mainfrom
benhillis:user/benhill/openvmm-git-build-info

Conversation

@benhillis

@benhillis benhillis commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

Add the minimal source identity needed for standalone OpenVMM releases and expose it through the existing openvmm_entry Clap parser for openvmm --version / -V.

  • derive MAJOR.MINOR.PATCH from one canonical exact openvmm-vMAJOR.MINOR.PATCH tag
  • reject noncanonical tags in the reserved openvmm-v* namespace
  • mark dirty tagged and development checkouts
  • include the Git revision in development identities
  • restore official release identity from .openvmm-release.json when .git is absent
  • reject identity inherited from a containing repository
  • fall back to 0.0.0-dev when neither Git nor release metadata is available

This intentionally does not collect branch names, shallow-checkout state, arbitrary tags, or generated development-source metadata.

Draft follow-up stack: benhillis#5, #6, and #7. Documentation: #3988.

Stack boundary: Windows executable resource wiring is implemented in benhillis#5. Official source-bundle publication is implemented in #7 and depends on #5, so release bundles cannot publish before matching Windows resource identity lands.

Copilot AI review requested due to automatic review settings July 21, 2026 02:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Extends the support/build_rs_git_info build-script helper from emitting just SHA/branch to collecting a more complete repository-scoped source identity (revision, branch, exact tags, dirty state, shallow state), with additional repository-root validation and focused tests.

Changes:

  • Introduces a GitInfo struct plus collect_git_info() / collect_git_info_at() APIs to return structured Git identity data.
  • Expands Cargo rebuild triggers beyond HEAD to include tag refs / packed refs and the current branch ref.
  • Adds unit tests covering exact tags + dirty state detection and rejection of nested directories inside a parent repository.

Comment thread support/build_rs_git_info/src/lib.rs Outdated
Comment thread support/build_rs_git_info/src/lib.rs Outdated
Comment thread support/build_rs_git_info/src/lib.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread support/build_rs_git_info/src/lib.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 03:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread support/build_rs_git_info/src/lib.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 04:34
@github-actions github-actions Bot added the unsafe Related to unsafe code label Jul 21, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Comment thread openvmm/openvmm_build_info/build.rs Outdated
Comment thread openvmm/openvmm_build_info/version.rs Outdated
Comment thread openvmm/openvmm_build_info/version.rs
Comment thread openvmm/openvmm_build_info/version.rs
@benhillis benhillis changed the title build_rs_git_info: collect complete source identity openvmm: add minimal tag-derived source identity Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 04:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Comment thread Cargo.toml
Comment thread openvmm/openvmm_build_info/src/lib.rs
Copilot AI review requested due to automatic review settings July 21, 2026 05:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Comment thread openvmm/openvmm/src/main.rs Outdated
Comment thread openvmm/openvmm/src/main.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 05:55
@github-actions github-actions Bot added the Guide label Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Comment thread openvmm/openvmm/src/main.rs Outdated
Comment thread Guide/src/reference/openvmm/management/cli.md Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 06:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

Comment thread openvmm/openvmm/src/main.rs
Copilot AI review requested due to automatic review settings July 21, 2026 17:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Comment thread openvmm/openvmm_build_info/build.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 21:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

Ben Hillis added 17 commits July 29, 2026 13:07
Extend the build-script helper to collect exact tags, dirty and shallow state, and repository-scoped Git information. Reject parent repositories so vendored source cannot inherit the containing checkout's identity.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Read status output as raw bytes so non-UTF8 paths cannot panic the build script, and watch the shallow marker so unshallowing invalidates cached build metadata. Clarify that the compatibility emit API intentionally exposes only its legacy variables.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Retry unique temporary repository names so parallel tests and coarse filesystem clocks cannot fail with AlreadyExists.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Fold OpenVMM identity into one product-specific crate and restore the generic Git helper to its upstream API. Keep only canonical exact tags, dirty state, Git revision fallback, official release metadata, and repository-root protection; remove branch, shallow-checkout, arbitrary-tag, and generated development-source metadata plumbing.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Watch individual OpenVMM tag refs, derive the tag glob from the canonical prefix, and document why product-specific Git collection remains local to the identity crate.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Link the minimal build-info crate into openvmm and use it for --version/-V so the first release-identity layer produces an observable artifact without pulling in Windows resources, Flowey, or test-snapshot wiring.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Compare raw arguments through OsStr and document the displayed version flags.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Recognize version flags anywhere in the command line and document dirty and metadata-free version forms.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Document that development version output uses the first nine revision characters.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Watch every tracked repository file so Cargo reruns the identity build script when workspace edits can change the dirty marker.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Stop global version-flag detection at -- and cover the behavior with a regression assertion.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Keep tracked-file invalidation for local builds while avoiding thousands of unnecessary rerun directives in GitHub Actions.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Exercise Git identity collection with the annotated tag form used for releases.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Lock in the intentional failure for noncanonical tags using the reserved openvmm-v prefix.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Ignore untracked files so dirty identity remains consistent with Cargo rebuild triggers and document the tracked-file semantics.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Configure the existing Clap options with the source identity and remove the binary-level argument pre-parser.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Rerun the build-info script when the Git index changes so newly tracked files cannot leave the cached dirty identity stale.

Copilot-Session: 13086ab2-fa94-4be1-b276-ee1b96e7caea
Copilot AI review requested due to automatic review settings July 29, 2026 20:15
@benhillis
benhillis force-pushed the user/benhill/openvmm-git-build-info branch from 79d3118 to 9aef473 Compare July 29, 2026 20:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

openvmm/openvmm_build_info/build.rs:96

  • The git for-each-ref pattern refs/tags/openvmm-v only matches a ref named exactly openvmm-v, so the build script won’t register rerun-if-changed inputs for real release tags like openvmm-v0.12.3. This can leave OPENVMM_VERSION stale when tags are created/updated locally (directory watch + packed-refs aren’t reliable across setups). Use a glob that matches all openvmm-v* tag refs.
    if let Some(tag_refs) = git_output(
        repo,
        &["for-each-ref", "--format=%(refname)", "refs/tags/openvmm-v"],
    ) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Guide unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants