Skip to content

feat(kvp): add ProvisioningReport abstraction over KvpPoolStore#310

Open
peytonr18 wants to merge 1 commit into
Azure:mainfrom
peytonr18:probertson-kvp-provisioning-report
Open

feat(kvp): add ProvisioningReport abstraction over KvpPoolStore#310
peytonr18 wants to merge 1 commit into
Azure:mainfrom
peytonr18:probertson-kvp-provisioning-report

Conversation

@peytonr18

@peytonr18 peytonr18 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduces a ProvisioningReport type in the libazureinit-kvp crate that models a provisioning health report as structured data and persists it to a KVP pool as ordered key/value entries — replacing ad-hoc string building at the call site.

What's included

  • ProvisioningReport — report with success(agent, vm_id) and error(agent, vm_id, reason) constructors plus with_pps_type, with_documentation_url, and with_extra builders. Fields are private; the success⇔no-reason / error⇔reason invariant is enforced through the constructors.
  • ToKvp trait — converts a report into ordered Vec<(String, String)> entries. Acts as the shared seam so a future diagnostics report can reuse write_report without changes here.
  • write_report — persists entries via KvpPoolStore::insert (upsert / last-write-wins).

Testing

  • New unit tests cover all of the new functionality.
  • cargo llvm-cov: 100% region and line coverage for report.rs.

Add a ProvisioningReport that converts to ordered KVP
entries via a new ToKvp trait and persists with write_report. ToKvp is
the seam for a future diagnostics report to reuse write_report unchanged.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.88%. Comparing base (1d4df06) to head (d379a57).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
+ Coverage   94.78%   94.88%   +0.10%     
==========================================
  Files          19       20       +1     
  Lines        6348     6477     +129     
==========================================
+ Hits         6017     6146     +129     
  Misses        331      331              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/// Report timestamp (`timestamp` field), set to the current time
/// (RFC 3339) when the report is constructed.
timestamp: String,
/// Pre-provisioning type (`pps_type` field). Defaults to `None`.

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.

let's skip the default and just require it. caller can default to "None". but also, let's maintain the types here, e.g. ReportPpsType

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.

3 participants