Skip to content

log build version on startup - #1163

Open
rkuhn wants to merge 1 commit into
mainfrom
rk/log-version
Open

log build version on startup#1163
rkuhn wants to merge 1 commit into
mainfrom
rk/log-version

Conversation

@rkuhn

@rkuhn rkuhn commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

fixes #1161

Summary by CodeRabbit

  • New Features

    • Added build metadata logging after tracing starts, including version, Git commit, repository state, operating system, and architecture.
    • Added structured observability details for identifying the running binary.
  • Documentation

    • Documented the new build-version trace event and its schema.
  • Tests

    • Added coverage verifying emitted build, platform, and Git metadata.

Signed-off-by: Roland Kuhn <rk@rkuhn.info>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The startup path now logs package, Git, dirty-state, OS, and architecture metadata after tracing setup. The new event is defined in observability schemas and trace documentation. Tests verify the structured INFO output.

Changes

Build-version observability

Layer / File(s) Summary
Build-version trace contracts
crates/amaru-observability/src/schemas.rs, docs/traces-schema.json, docs/TRACES.md
The amaru.setup.build.VERSION event defines required build identity fields and optional abbreviated commit data.
Build metadata logging and tests
crates/amaru/src/version.rs
log_build_version() emits structured INFO metadata. Tests capture the event and verify its target and fields.
Startup integration and release note
crates/amaru/src/bin/amaru/main.rs, CHANGELOG.md
Startup calls build-version logging after tracing setup. The changelog records the new behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: ktorz

Poem

At startup, the version takes the stage,
Git and platforms fill the page.
Tracing hums, the fields align,
Build identity enters the logline.
Cue the credits—ship it fine.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states that the PR logs the build version during application startup.
Linked Issues check ✅ Passed The PR logs build identity at startup and documents the event, which satisfies issue #1161 objectives.
Out of Scope Changes check ✅ Passed The code, schema, documentation, tests, and changelog changes directly support startup build-version logging for issue #1161.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rk/log-version

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rkuhn rkuhn self-assigned this Aug 6, 2026

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
crates/amaru/src/version.rs (1)

152-153: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the emitted dirty-state field.

The test does not verify git_dirty. A wrong dirty-state value can pass while build identity becomes inaccurate.

Proposed test update
         assert!(output.contains(target_os()), "expected os {} in output:\n{output}", target_os());
         assert!(output.contains(target_arch()), "expected arch {} in output:\n{output}", target_arch());
+        let expected_dirty = git_dirty().unwrap_or(false);
+        assert!(
+            output.contains(&format!("git_dirty={expected_dirty}")),
+            "expected git dirty state {expected_dirty} in output:\n{output}"
+        );
 
         let expected_commit = git_commit_hash().unwrap_or("unknown");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/amaru/src/version.rs` around lines 152 - 153, Update the
version-output test assertions near target_os() and target_arch() to also parse
or inspect the emitted git_dirty field and assert it matches the expected
dirty-state value, ensuring incorrect build identity cannot pass the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/amaru/src/version.rs`:
- Around line 152-153: Update the version-output test assertions near
target_os() and target_arch() to also parse or inspect the emitted git_dirty
field and assert it matches the expected dirty-state value, ensuring incorrect
build identity cannot pass the test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 003bc5c7-640d-449a-ac49-6320437afb37

📥 Commits

Reviewing files that changed from the base of the PR and between ed41541 and ec9ae12.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • crates/amaru-observability/src/schemas.rs
  • crates/amaru/src/bin/amaru/main.rs
  • crates/amaru/src/version.rs
  • docs/TRACES.md
  • docs/traces-schema.json

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.

running code version should be logged at startup

1 participant