Skip to content

Commit 1df3963

Browse files
mikolalysenkoclaude
andcommitted
Count hosted applied events in the hosted telemetry e2e
v5.0's single JSON envelope drops redirect.redirected; each confirmed hosted pin is now an applied event tagged details.mode: "hosted". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent fd5987c commit 1df3963

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎crates/socket-patch-cli/src/commands/scan/hosted.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn refuse(
171171
common: &crate::args::GlobalArgs,
172172
scan_result: Option<Envelope>,
173173
refusal: &socket_patch_core::hosted::engine::Refusal,
174-
json_error: &mut Option<serde_json::Value>,
174+
json_error: &mut Option<Envelope>,
175175
) -> i32 {
176176
eprintln!("Error ({}): {}", refusal.code, refusal.message);
177177
if common.json {

‎crates/socket-patch-cli/tests/cli/telemetry_e2e.rs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,9 +1233,17 @@ async fn hosted_scan_reports_patch_applied_with_hosted_mode() {
12331233
let applied = &bodies[1];
12341234
assert_eq!(applied["context"]["command"], "scan");
12351235
assert_eq!(applied["metadata"]["mode"], "hosted");
1236+
// v5.0 records each confirmed pin as an `applied` event tagged
1237+
// `details.mode: "hosted"` (v4's `redirect.redirected` count).
1238+
let hosted_applied = doc["events"]
1239+
.as_array()
1240+
.into_iter()
1241+
.flatten()
1242+
.filter(|e| e["details"]["mode"] == "hosted" && e["action"] == "applied")
1243+
.count();
12361244
assert_eq!(
1237-
applied["metadata"]["patches_count"],
1238-
doc["redirect"]["redirected"]
1245+
applied["metadata"]["patches_count"], hosted_applied,
1246+
"patches_count is the envelope's hosted applied events: {doc:#}"
12391247
);
12401248
assert_eq!(applied["metadata"]["patches_count"], 1);
12411249
assert_eq!(

0 commit comments

Comments
 (0)