Skip to content

Commit ecba20e

Browse files
Report which patches each run acted on, and count downloads, vendoring and rollbacks correctly (#2178)
* Report which patches each run acted on, and count downloads, vendoring and rollbacks correctly Telemetry could say that a rollback happened, never of which patch, so a patch that is being rolled back far more than the others was invisible. Several counts were also wrong or missing. Events about specific patches (apply, hosted pins, vendor, download, remove, rollback) now name each one: the patch UUID with its ecosystem, mode and outcome, at most 50 per event with failures first, plus exact per-outcome counts for the whole run. They are derived from the run's own `--json` events, so the two cannot disagree. No package name, path or file list is added; the docs say plainly that a patch UUID tells Socket which package version a patch is for. Counting fixes: - Agent-mode downloads were reported only by `get <uuid>`. `scan` and `get <package|advisory>` now report the patch records they download. - `vendor --revert` reported nothing. It now reports each entry it takes out as a removal. - Vendor events carry `mode: "vendored"`, and vendor and agent applies report the command the user ran (`scan`, `get`) instead of always `vendor` / `apply`. - A rollback reports `dry_run` and whether its targets were named, so a preview is no longer counted as a rollback. - `remove` sent a failure and a removal of zero for one run when every match was kept, and nothing at all on several failure exits (an unreadable vendor ledger, a refused hosted restore, an ambiguous target). It now sends one event per run. - Two `scan` failure exits reported nothing. - A failed apply or vendor run reports what it did apply. Every failure event carries `error_code`, the code the `--json` envelope reports, so a mistyped target is distinguishable from a patch that would not come off; hosted failures report the same code with and without `--json`. Error messages are cut to 1,000 characters so an event stays small enough for the server to read. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Address review: name the right patch and command, and bound the event size for any message - An interactive agent-mode `scan` reported its download and apply under the command `get`: that path ran the download engine over a `get` envelope. It now fills a scan envelope, and the end-to-end test covers the run with and without `--json`. - A vendored `scan` / `get` whose download failed sent a failure event that named no patch: the vendor step only sees the records that did download. The download phase's failures are now added to the event. - `vendor` could credit an event to the wrong patch. The manifest's record now wins over a stale ledger entry, base purls are no longer recorded beside keys (an ambiguous one named an arbitrary release), and a swept orphan directory is no longer credited to the patch the ledger records for the same package. - A `remove` whose hosted leg stopped on one pin reported every matched pin as failed, including the ones it had restored. Restored pins are reported as removed. - The 10,000 character bound on an event did not hold for a message that grows when JSON escapes it. The serialized event is now fitted to 9,000 bytes: the tail of the error message goes first, then entries off the end of the patch list. - `remove` now reports on the failure exits that still sent nothing (an unreadable manifest path, a bare project, contested hosted wiring, a `--skip-rollback` refusal, a ledger write failure), and the ledger-only path sends its event before printing its envelope. - `patch_fetch_failed`, `patch_repair_failed` and `vex_failed` carry `error_code` like the other failure events. - Events spell an ecosystem by its CLI name, as `scan` does, so the two join. The docs say which runs still report nothing in any command: a usage error, and a run that could not take the apply lock. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Keep an in-process remove test from setting SOCKET_OFFLINE for its neighbours `run_removes_matching_patch_and_exits_zero` ran `remove` in-process with `offline: true`. `run()` mirrors that flag into the process environment, where the parse tests of the same binary read it: one that parsed after it saw `offline: true` and failed its defaults check. The coverage build lost that race in CI. The test only needs no telemetry call, which `no_telemetry: true` already gives it (and that variable is one the parse tests expect), so the offline flag is dropped. Nothing in the run reaches the network. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Report the install channel with each telemetry event The telemetry context said which version, platform and command an event came from, but not how the binary got onto the machine. Each event now carries `context.channel`: `standalone` (the install script or a downloaded binary), `npm`, `cargo`, `homebrew`, `pypi` or `launcher_cache`. It is the detection `--update` already uses, from the binary's canonical path, worked out once per process. It names the channel and never the path, reads no project file and makes no request. When the binary's own path cannot be read, the field is left out. With it, usage can be broken down by distribution channel: which of the ways to install socket-patch the people applying patches came through. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Address review: keep the channel through a self-update, and see cargo installs behind a symlinked home Review of the install-channel commit found five things. A successful `--update` on Linux sent `cli_updated` without its channel. The event is built after the swap, and by then the path of the binary that ran reads as deleted, so it could not be resolved. `--update` now works the channel out before it replaces anything. A `cargo install` was reported as `standalone` on Windows, and on Unix when the home directory is reached through a symlink. The executable's path is canonical and the roots it was compared with (`CARGO_HOME`, the home directory, the cache directories) were taken raw from the environment, so they were never a prefix of it. The roots are canonical now. This is the detection `--update` uses too: there it let a cargo-managed binary be replaced in place, which it now refuses as documented. Building an event could ask the user database for a home directory when `HOME` and `CARGO_HOME` were both unset. The telemetry context now reads environment variables alone. The docs said every event has the field and that `standalone` means the install script. The field is left out when the binary cannot read its own location, and `standalone` is any location no package manager owns. Two tests assumed the build directory is not under a path a package manager owns. They check the id against the binary's own channel instead, and new tests cover the channel after a self-update and a binary inside `node_modules`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * Name `vendor`'s patches under the lock, and report before printing Two review comments on the standalone `vendor` command. It read the patch UUIDs its event names after releasing the apply lock. Another run on the same project could rewrite the ledger and the manifest in between, and this run's event would be credited to that run's patches. They are read while the lock is still held, as the vendor step of `scan` and `get` already does from its own records. It printed the `--json` envelope and only then started its event, including the removal event of `vendor --revert`. `remove` and the hosted flow start the event first, so that a consumer that closes stdout on the envelope cannot drop it. `vendor` does the same now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 412796f commit ecba20e

22 files changed

Lines changed: 3543 additions & 340 deletions

‎README.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ to Socket as a small JSON event. An event holds the event name (for example
108108
`patch_applied` or `patch_scan_failed`), the subcommand, the CLI version, the
109109
operating system and CPU architecture, a timestamp, a random ID generated for
110110
that one run, and a few counters and flags for the command (such as patches
111-
applied, packages scanned, ecosystems found, the patch mode, `dry_run`). `get`
112-
adds the patch UUID. A failure adds the error message, with URL credentials
113-
redacted and your home directory replaced by `~`. Apart from what an error
114-
message quotes, events hold no package names, file paths, file contents, or
115-
dependency lists.
111+
applied, packages scanned, ecosystems found, the patch mode, `dry_run`). An
112+
event about specific patches (downloading, applying, vendoring, removing, or
113+
rolling them back) names each by its patch UUID, with its ecosystem, mode, and
114+
outcome; a patch UUID tells Socket which package version the patch is for. A
115+
failure adds an error code and the error message, with URL credentials redacted
116+
and your home directory replaced by `~`. Apart from those patch UUIDs and what
117+
an error message quotes, events hold no package names, file paths, file
118+
contents, or dependency lists.
116119

117120
Events go to `api.socket.dev` with your API token when a token and organization
118121
are configured, otherwise anonymously to `patches-api.socket.dev`. They are sent

‎crates/socket-patch-cli/CLI_CONTRACT.md‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,9 +2087,13 @@ State lives at `$XDG_CACHE_HOME`|`~/.cache` (Unix/macOS) or `%LOCALAPPDATA%` (Wi
20872087

20882088
## Telemetry
20892089

2090-
Telemetry is **on by default**. Each command reports its outcome as one JSON event per row of the table below (a `scan` or `get` that also applies sends two).
2090+
Telemetry is **on by default**. Each command reports its outcome as one JSON event per row of the table below (a `scan` or `get` that also downloads and applies sends up to three; a `scan` over several project directories reports each).
20912091

2092-
**What is sent.** `{event_sender_created_at, event_type, context: {version, platform, arch, command}, session_id, metadata?, error?: {type, message}}`; no `event_kind`, so the backend stores it as a required event. `context` is the client version, `std::env::consts::OS` / `ARCH` and the subcommand. `session_id` is a random UUID generated per process and never stored, so it links the events of one run and nothing else. `metadata` holds only the per-event fields in the table. `error.message` (failure events) has every URL redacted (userinfo, grant tokens, signed query values) and the home directory replaced by `~`; it can otherwise quote a package name or a path. The request carries `User-Agent: SocketPatchCLI/<version>` and, on the org route, `Authorization: Bearer <token>`. Nothing else is sent: no package list, no file contents, no machine identifier.
2092+
**What is sent.** `{event_sender_created_at, event_type, context: {version, platform, arch, command, channel?}, session_id, metadata?, error?: {type, message}}`; no `event_kind`, so the backend stores it as a required event. `context` is the client version, `std::env::consts::OS` / `ARCH`, the subcommand, and `channel`: the install channel of the running binary (`npm`, `cargo`, `homebrew`, `pypi`, `launcher_cache`, or `standalone` for any location none of those owns; the same detection `--update` uses, from the binary's canonical path, read from environment variables alone and resolved before `--update` swaps the binary), omitted when that path cannot be read. `session_id` is a random UUID generated per process and never stored, so it links the events of one run and nothing else. `metadata` holds only the per-event fields in the table. `error.message` (failure events) has every URL redacted (userinfo, grant tokens, signed query values), the home directory replaced by `~`, and is cut to 1,000 characters; it can otherwise quote a package name or a path. The request carries `User-Agent: SocketPatchCLI/<version>` and, on the org route, `Authorization: Bearer <token>`. Nothing else is sent: no package name, no file contents, no machine identifier. The patches an event names are named by patch UUID (see below), which identifies a patched package version to Socket.
2093+
2094+
**Patches.** An event about specific patches (the rows marked *patches*) adds to `metadata`: `patches`, at most 50 `{uuid, ecosystem, mode, outcome, code?}` entries, one per patch and mode, failed ones first (`mode`: `agent` / `hosted` / `vendored`; `outcome`: `applied`, `downloaded`, `rolled_back`, `removed`, `rebuilt`, `verified` (a dry run), `skipped`, `failed`; `code` is the event's `errorCode`, on `skipped` and `failed` only); `patches_truncated: true` when the cap dropped entries; `outcomes`, the count of patches per outcome over the whole run; and `ecosystems` / `modes`, their distinct values. They are derived from the run's `--json` events, so the two cannot disagree: several events for one patch (one per installed copy) fold into the one that says most (a failure over a change, a change over a preview, a preview over a skip). A run that named no patch adds none of these. The event body stays under 9,000 bytes (the server's dashboards cannot read one past 10,000 characters): an event that would not fit gives up the tail of its error message, down to 200 characters, and then entries off the end of its patch list.
2095+
2096+
**Failures.** Every failure event carries `error_code`: the code the run's `--json` envelope reports as its `error.code` (`patch_not_found`, `rollback_failed`, `vendor_revert_kept`, …), so a mistyped target is distinguishable from a patch that failed. It is the same with and without `--json`. A run whose envelope has failed events and no top-level error reports `apply_failed`, `vendor_failed`, `hosted_failed` or `repair_failed`. Two kinds of run report nothing, in every command: one that exits 2 on a usage error, and one that could not take the apply lock.
20932097

20942098
**Where.** `POST <api>/v0/orgs/<org>/telemetry` with the bearer when the run has a token and an org, else anonymously `POST <proxy>/patch/telemetry` (`--api-url` / `--proxy-url` and their env vars move both). The route is the run's API client's when the run built one, so telemetry follows the same host and org as its API calls. A run that built no client (see [API client construction](#api-client-construction)) takes the route from the configured credentials alone (flag → env → socket-cli config, no network): a token with no configured org then reports anonymously, because the org is never looked up only to address an event.
20952099

@@ -2110,14 +2114,16 @@ Every `event_type` must be in the Socket API's patch event map, or it is stored
21102114

21112115
| Command | Success | Failure | Metadata |
21122116
|---|---|---|---|
2113-
| `scan` | `patch_scanned` | `patch_scan_failed` | `packages_scanned`, `free_patches`, `paid_patches`, `can_access_paid`, `ecosystems` (found by the crawl), `fallback_to_proxy`, `mode` (requested: `hosted` / `vendored` / `agent`, or `report` with none), `project_modes` (already wired: `hosted` lockfile pins, `vendored` ledger, `agent` manifest) |
2114-
| `scan`/`get --mode hosted` (non-empty selection) | `patch_applied` | `patch_apply_failed` | `mode: "hosted"`, `patches_count` (pins confirmed), `files_count` (files rewritten), `dry_run` |
2115-
| `apply` (and the nested apply of `scan`/`get --mode agent`) | `patch_applied` | `patch_apply_failed` | `mode: "agent"`, `patches_count`, `dry_run` |
2116-
| `vendor` / `scan`/`get --mode vendored` | `patch_vendored` | `patch_vendor_failed` | `patches_count`, `dry_run` |
2117-
| `get` | `patch_fetched` | `patch_fetch_failed` | `uuid`, `tier`, `ecosystem`, `download_mode`, `fallback_to_proxy` |
2118-
| `remove` / `rollback` | `patch_removed` / `patch_rolled_back` | `patch_remove_failed` / `patch_rollback_failed` | `removed_count` / `rolled_back_count` |
2119-
| `list` / `repair` | `patch_listed` / `patch_repaired` | — / `patch_repair_failed` | `patches_count` / `blobs_added`, `blobs_removed`, `bytes_freed` |
2120-
| `vex` | `vex_generated` | `vex_failed` | `advisories_count`, `format`, `output_kind` |
2117+
| `scan` (one per project directory) | `patch_scanned` | `patch_scan_failed` | `packages_scanned`, `free_patches`, `paid_patches`, `can_access_paid`, `ecosystems` (found by the crawl), `packages_by_ecosystem` / `patches_by_ecosystem` (ecosystem → count), `fallback_to_proxy`, `mode` (requested: `hosted` / `vendored` / `agent`, or `report` with none), `project_modes` (already wired: `hosted` lockfile pins, `vendored` ledger, `agent` manifest), `dry_run`. Failure: `error_code`, `fallback_to_proxy`, `mode` |
2118+
| `scan`/`get --mode hosted` (non-empty selection) | `patch_applied` | `patch_apply_failed` | `mode: "hosted"`, `patches_count` (pins confirmed), `files_count` (files rewritten), `dry_run`, *patches* |
2119+
| `apply` (and the nested apply of `scan`/`get --mode agent`, reported under `scan` / `get`) | `patch_applied` | `patch_apply_failed` | `mode: "agent"`, `patches_count` (packages patched; on a failure, what the run did apply), `dry_run`, *patches* |
2120+
| `scan --mode agent`, `get <purl\|advisory>` in agent mode (a run that reached a patch) | `patch_fetched` | — | `mode: "agent"`, `patches_count` (records downloaded), `download_mode`, *patches* (`downloaded`, `skipped` / `already_in_manifest`, `failed`) |
2121+
| `vendor` / `scan`/`get --mode vendored` (reported under the command run) | `patch_vendored` | `patch_vendor_failed` | `mode: "vendored"`, `patches_count`, `dry_run`, *patches* |
2122+
| `get <uuid>` | `patch_fetched` | `patch_fetch_failed` | `uuid`, `tier`, `ecosystem`, `mode`, `patches_count: 1`, `download_mode`, `fallback_to_proxy`, *patches*. Failure: `uuid` (when one was asked for), `error_code` (`not_found`, `paid_required`, `patch_fetch_failed`), `fallback_to_proxy` |
2123+
| `remove`, `vendor --revert` (never on `--dry-run`; one event per run) | `patch_removed` | `patch_remove_failed` | `removed_count` (patches taken out), *patches* |
2124+
| `rollback` | `patch_rolled_back` | `patch_rollback_failed` | `rolled_back_count` (packages restored, as `summary.rolledBack`), `dry_run`, `targeted` (targets were named), *patches* |
2125+
| `list` / `repair` | `patch_listed` / `patch_repaired` | — / `patch_repair_failed` | `patches_count` / `blobs_added`, `blobs_removed`, `bytes_freed`. Failure: `error_code` |
2126+
| `vex` | `vex_generated` | `vex_failed` | `advisories_count`, `format`, `output_kind`. Failure: `error_code` |
21212127
| `--update` (an install, not a no-op or `--dry-run`) | `cli_updated` | `cli_update_failed` | `from_version`, `to_version`, `channel`, `pinned`, `forced` / `error_code` (the envelope's) |
21222128

21232129
## Environment variables

‎crates/socket-patch-cli/src/commands/agent_download.rs‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,18 @@ pub(crate) struct DetachedDownload {
16141614
}
16151615

16161616
impl DetachedDownload {
1617+
/// The patches the phase could not download, as the run's telemetry
1618+
/// names them: the vendor step never sees these (it works from the
1619+
/// records that did download), so its event adds them.
1620+
pub(crate) fn failed_outcomes(&self) -> Vec<socket_patch_core::telemetry::PatchOutcome> {
1621+
crate::telemetry_outcomes::patch_outcomes_of(
1622+
self.events
1623+
.iter()
1624+
.filter(|event| event.action == EventAction::Failed),
1625+
socket_patch_core::telemetry::MODE_VENDORED,
1626+
)
1627+
}
1628+
16171629
/// Fold the phase's events and warnings into `env` (records via
16181630
/// [`Envelope::record`], so `summary` and `status` follow) and hand back
16191631
/// the exit code and the records.
@@ -1918,6 +1930,33 @@ pub(crate) fn nested_apply_args_from_params(
19181930
nested_apply_args(&common, manifest_path, params.quiet())
19191931
}
19201932

1933+
/// The patches an agent-mode download pass reached, as its telemetry
1934+
/// names them: a patch fetched in place of an older one is `downloaded`
1935+
/// like any other.
1936+
fn fetched_outcomes(events: &[PatchEvent]) -> Vec<socket_patch_core::telemetry::PatchOutcome> {
1937+
let events: Vec<PatchEvent> = events
1938+
.iter()
1939+
.map(|event| PatchEvent {
1940+
action: match event.action {
1941+
EventAction::Updated => EventAction::Downloaded,
1942+
action => action,
1943+
},
1944+
..event.clone()
1945+
})
1946+
.collect();
1947+
crate::telemetry_outcomes::patch_outcomes_of(&events, socket_patch_core::telemetry::MODE_AGENT)
1948+
}
1949+
1950+
/// The command an engine run's telemetry reports: the one whose envelope
1951+
/// it fills. `scan` and `get` are the engine's two callers; both pass
1952+
/// their own envelope, printed or not.
1953+
pub(crate) fn telemetry_command(env: &Envelope) -> &'static str {
1954+
match env.command {
1955+
EnvelopeCommand::Scan => "scan",
1956+
_ => "get",
1957+
}
1958+
}
1959+
19211960
/// Run the nested `apply` step with `common` (see [`nested_apply_args`])
19221961
/// on the caller's `client`, under the apply `lock` the caller took for
19231962
/// its manifest write — one lock window for download → manifest write →
@@ -1931,6 +1970,7 @@ pub(crate) fn nested_apply_args_from_params(
19311970
/// opt-in on the top-level command only, never on this internal
19321971
/// invocation.
19331972
pub(crate) async fn run_nested_apply(
1973+
command: &'static str,
19341974
common: GlobalArgs,
19351975
json: bool,
19361976
report_user_patch_skips: bool,
@@ -1948,6 +1988,7 @@ pub(crate) async fn run_nested_apply(
19481988
nested: Some(super::apply::NestedApply {
19491989
caller_json: json,
19501990
report_user_patch_skips,
1991+
command,
19511992
}),
19521993
};
19531994
// The nested apply runs on the host's client: seeded, never rebuilt.
@@ -2362,6 +2403,14 @@ pub async fn download_and_apply_patches_into(
23622403
// single-uuid flow's summary in `save_and_apply_patch`; their sum gates
23632404
// the apply step.
23642405
let downloaded = batch.fetched.len();
2406+
// Telemetry: the patch records this run fetched. `get <uuid>` reports
2407+
// its own fetch; every other agent-mode download comes through here.
2408+
socket_patch_core::telemetry::track_patches_fetched(
2409+
telemetry_command(env),
2410+
&fetched_outcomes(&batch.events),
2411+
&socket_patch_core::telemetry::TelemetryAuth::for_client(run.api_client),
2412+
)
2413+
.await;
23652414
let mut updated = 0usize;
23662415
let mut new_blobs: Vec<String> = Vec::new();
23672416
// `(purl, uuid)` of every selected patch now recorded: the fetched ones
@@ -2471,6 +2520,7 @@ pub async fn download_and_apply_patches_into(
24712520
crate::hot_patch::mark_apply_started();
24722521
apply_report = Some(
24732522
run_nested_apply(
2523+
telemetry_command(env),
24742524
nested_apply_args_from_params(params, run, &manifest_path),
24752525
params.json,
24762526
!params.user_patch_skips_reported,

‎crates/socket-patch-cli/src/commands/apply.rs‎

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ pub struct NestedApply {
186186
/// (`get`) checked only its own selection. `scan` already reported
187187
/// every protected installed package, so it passes `false`.
188188
pub report_user_patch_skips: bool,
189+
/// The command the user ran (`scan`, `get`): what the nested run's
190+
/// telemetry reports as its command.
191+
pub command: &'static str,
189192
}
190193

191194
impl ApplyArgs {
@@ -1812,6 +1815,12 @@ pub(crate) async fn run_locked(
18121815

18131816
// Packages the project patched itself sit this run out (warned); every
18141817
// other record still applies. The read-only `--check` verifies them all.
1818+
// Each record's patch, for telemetry: results name the package only.
1819+
let patch_uuids: HashMap<String, String> = manifest
1820+
.patches
1821+
.iter()
1822+
.map(|(purl, record)| (purl.clone(), record.uuid.clone()))
1823+
.collect();
18151824
let mut manifest = manifest;
18161825
let (user_patch_warnings, user_patch_skips) = if args.check {
18171826
Default::default()
@@ -2357,12 +2366,23 @@ pub(crate) async fn run_locked(
23572366
}
23582367

23592368
// Track telemetry
2369+
let reported = reported_patches(&results, &caveats, args.common.dry_run, &patch_uuids);
23602370
if success {
2361-
track_patch_applied(patched_count, args.common.dry_run, &telemetry()).await;
2371+
track_patch_applied(
2372+
telemetry_command(&args),
2373+
patched_count,
2374+
args.common.dry_run,
2375+
&reported,
2376+
&telemetry(),
2377+
)
2378+
.await;
23622379
} else {
23632380
track_patch_apply_failed(
2381+
telemetry_command(&args),
2382+
"apply_failed",
23642383
"One or more patches failed to apply",
23652384
args.common.dry_run,
2385+
&reported,
23662386
&telemetry(),
23672387
)
23682388
.await;
@@ -2442,6 +2462,34 @@ pub(crate) async fn run_locked(
24422462
}
24432463
}
24442464

2465+
/// The command an apply run's telemetry reports: `apply`, or the `scan` /
2466+
/// `get` whose agent mode ran it.
2467+
fn telemetry_command(args: &ApplyArgs) -> &'static str {
2468+
args.nested.map_or("apply", |nested| nested.command)
2469+
}
2470+
2471+
/// The patches an apply run acted on, as its telemetry names them: the
2472+
/// run's per-package events ([`GemCaveats::event_of`], what `--json`
2473+
/// prints), each under the patch its manifest record names.
2474+
///
2475+
/// A plain fn, so the events it builds stay off the async frame of `run`.
2476+
fn reported_patches(
2477+
results: &[ApplyResult],
2478+
caveats: &GemCaveats,
2479+
dry_run: bool,
2480+
patch_uuids: &HashMap<String, String>,
2481+
) -> Vec<socket_patch_core::telemetry::PatchOutcome> {
2482+
let events: Vec<PatchEvent> = results
2483+
.iter()
2484+
.map(|result| caveats.event_of(result, dry_run))
2485+
.collect();
2486+
crate::telemetry_outcomes::patch_outcomes(
2487+
&events,
2488+
socket_patch_core::telemetry::MODE_AGENT,
2489+
crate::telemetry_outcomes::uuid_lookup(patch_uuids),
2490+
)
2491+
}
2492+
24452493
/// The one apply-failure exit: `apply_failed` telemetry, then the error
24462494
/// envelope (`--json`) or an `Error:` line that prints even under
24472495
/// `--silent` ("errors only", never "nothing" — exit 1 with no message
@@ -2456,7 +2504,15 @@ async fn report_apply_failure(
24562504
skipped: &[PatchEvent],
24572505
telemetry: &TelemetryAuth,
24582506
) -> i32 {
2459-
track_patch_apply_failed(error, args.common.dry_run, telemetry).await;
2507+
track_patch_apply_failed(
2508+
telemetry_command(args),
2509+
&err.code,
2510+
error,
2511+
args.common.dry_run,
2512+
&[],
2513+
telemetry,
2514+
)
2515+
.await;
24602516
if args.common.json {
24612517
let mut env = Envelope::new(Command::Apply);
24622518
env.dry_run = args.common.dry_run;

0 commit comments

Comments
 (0)