fix(scanner): publish bounded observational usage (#5742)

* fix(scanner): publish bounded observational usage

* test(ci): serialize embedded integration ports

* test(cache): isolate generation-change timeout

* fix(scanner): address observational usage review

Co-Authored-By: heihutu <heihutu@gmail.com>

---------

Co-authored-by: Anthony Martin <949506+anthonymartin@users.noreply.github.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
anthonymartin
2026-08-06 17:52:34 -07:00
committed by GitHub
parent 83cdea1f18
commit 706a8b6061
21 changed files with 1396 additions and 130 deletions
+19
View File
@@ -401,6 +401,11 @@ pub struct AccountInfo {
pub server: BackendInfo,
pub policy: serde_json::Value, // Use iam/policy::parse to parse the result, to be done by the caller.
pub buckets: Vec<BucketAccessInfo>,
/// Whether the usage values came from a fully converged scanner cycle.
/// `false` means the values are a newer structurally complete observation
/// while another convergence pass remains pending.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub usage_snapshot_converged: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
@@ -798,6 +803,20 @@ mod tests {
assert_eq!(value["object_versions_histogram"], serde_json::json!({}));
}
#[test]
fn account_info_exposes_observational_usage_state_additively() {
let info = AccountInfo {
usage_snapshot_converged: Some(false),
..Default::default()
};
let value = serde_json::to_value(&info).unwrap();
assert_eq!(value["usage_snapshot_converged"], false);
let legacy_shape = serde_json::to_value(AccountInfo::default()).unwrap();
assert!(!legacy_shape.as_object().unwrap().contains_key("usage_snapshot_converged"));
}
#[test]
fn test_account_status_try_from_invalid() {
let result = AccountStatus::try_from("invalid");