Expand description
Build and version tracking.
Why: A monotonic build counter pairs with semver for log correlation.
What: BuildInfo struct, VERSION/GIT_HASH/PKG_NAME constants,
version_string helper.
Test: build_info::tests::*.
Build and version tracking.
Why: We need a monotonic build counter that increments on every process
start, independent of the semver version. The combined vX.Y.Z build #N
string lets us correlate log lines and performance telemetry with the
exact binary invocation that produced them. Keeping the counter on disk
(rather than baked into the binary) lets a single cargo build produce
many distinct “builds” across repeated cargo run invocations during
development — which is exactly when we need the disambiguation.
What: Reads .open-mpm/state/build.json relative to the current working
directory, increments the build counter (defaulting to 0 if the file
is missing or malformed), and writes the result back atomically via
rename(2) from a sibling .tmp file.
Test: BuildInfo::load_and_increment in an empty temp dir returns
build == 1; calling it again returns build == 2; a corrupt
build.json is treated as “build = 0” and replaced on the next call.
Structs§
- Build
Info - Runtime build metadata surfaced to logs, the
--versionflag, and downstream instrumentation.
Constants§
- GIT_
HASH - Short git commit hash captured at build time by
build.rs. - PKG_
NAME - The package name, resolved at compile time.
- VERSION
- Compile-time semver from Cargo.toml.
Functions§
- version_
string - Human-readable banner used by the CTRL REPL and
--versionoutput.