Skip to content

Conversation

@Farukest
Copy link
Contributor

Summary

Move VersionInfo struct and register_version_metrics from op-rbuilder crate to the builder binary. This decouples version metrics registration from the crate, allowing binaries to control their own version reporting.

Changes

  • Add bin/builder/src/version.rs with VersionInfo and metrics registration
  • Update launcher to accept on_node_started callback
  • Move SHORT_VERSION/LONG_VERSION constants to args/mod.rs
  • Simplify op-rbuilder build.rs to only generate CLI version env vars
  • Remove VersionInfo from metrics.rs

Closes #396

Move VersionInfo struct and register_version_metrics from op-rbuilder
crate to the builder binary. This decouples version metrics registration
from the crate, allowing binaries to control their own version reporting.

- Add bin/builder/src/version.rs with VersionInfo and metrics registration
- Update launcher to accept on_node_started callback
- Move SHORT_VERSION/LONG_VERSION constants to args/mod.rs
- Simplify op-rbuilder build.rs to only generate CLI version env vars
- Remove VersionInfo from metrics.rs

Closes base#396
@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Jan 14, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 -1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@haardikk21 haardikk21 requested review from haardikk21 and refcell and removed request for refcell January 15, 2026 14:01
Comment on lines +7 to +22
pub const SHORT_VERSION: &str = env!("OP_RBUILDER_SHORT_VERSION");

/// Long version string with additional build info.
pub const LONG_VERSION: &str = concat!(
env!("OP_RBUILDER_LONG_VERSION_0"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_1"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_2"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_3"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_4"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_5"),
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these duplicated?

Comment on lines +15 to +17
if let Err(err) = op_rbuilder::launcher::launch(|| {
version::VERSION.register_version_metrics();
}) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need a callback function here instead of simply calling the function after calling launch?

Comment on lines +36 to +52
pub const SHORT_VERSION: &str = env!("OP_RBUILDER_SHORT_VERSION");

/// Long version string with additional build info.
pub const LONG_VERSION: &str = concat!(
env!("OP_RBUILDER_LONG_VERSION_0"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_1"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_2"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_3"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_4"),
"\n",
env!("OP_RBUILDER_LONG_VERSION_5"),
);

Copy link
Collaborator

Choose a reason for hiding this comment

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

all these OP_RBUILDER env vars will not be available in this context due to missing code migrations from the build.rs file of the crate they previously belong to

Comment on lines -77 to -83
println!("cargo:rustc-env=OP_RBUILDER_BUILD_PROFILE={profile}");

// Set formatted version strings
// Set formatted version strings used by the CLI
let pkg_version = env!("CARGO_PKG_VERSION");

// The short version information for op-rbuilder.
// - The latest version from Cargo.toml
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file's diff is bit of a mess

  • It gets rid of env var setting for OP_RBUILDER_BUILD_PROFILE but keeps several other OP_RBUILDER_* env vars in here
  • A decent chunk of this logic needs to move to the new place where these env vars are loaded to set the version info. Without this, those env vars will be unset

@refcell
Copy link
Contributor

refcell commented Jan 15, 2026

Looking at @haardikk21's comments and the current layout of the builder crate, it may be worth sidelining this work for now. There's still a bunch of cleanup that needs to happen to the builder crate - especially wrt the tester binary (can we delete?).

I'd recommend closing this PR for now and returning to this work later.

@Farukest
Copy link
Contributor Author

Looking at @haardikk21's comments and the current layout of the builder crate, it may be worth sidelining this work for now. There's still a bunch of cleanup that needs to happen to the builder crate - especially wrt the tester binary (can we delete?).

I'd recommend closing this PR for now and returning to this work later.

should I apply the changes @haardikk21 ?

@haardikk21
Copy link
Collaborator

Looking at @haardikk21's comments and the current layout of the builder crate, it may be worth sidelining this work for now. There's still a bunch of cleanup that needs to happen to the builder crate - especially wrt the tester binary (can we delete?).
I'd recommend closing this PR for now and returning to this work later.

should I apply the changes @haardikk21 ?

Hold off on it for now I guess. Let's wait for the dust to settle a bit and can do it in a couple days or so

@Farukest
Copy link
Contributor Author

Looking at @haardikk21's comments and the current layout of the builder crate, it may be worth sidelining this work for now. There's still a bunch of cleanup that needs to happen to the builder crate - especially wrt the tester binary (can we delete?).
I'd recommend closing this PR for now and returning to this work later.

should I apply the changes @haardikk21 ?

Hold off on it for now I guess. Let's wait for the dust to settle a bit and can do it in a couple days or so

okay then. lets wait

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(builder): Migrate VersionInfo to Builder Binary

4 participants