Repository navigation
Commit da012af
Say why an apply failed in its telemetry and --json events (#2247)
* Say why an apply failed in its telemetry and --json events
A failed in-place apply reported the same `apply_failed` code for every
cause, so the patch-lifecycle events could not tell a hash mismatch from
a missing blob, a write error or an uninstalled package.
- core: `ApplyResult.cause` (`ApplyFailureCause`), set at each failure of
the in-place engine: hash_mismatch, file_not_found, unsafe_path,
shared_store, conda_build, blob_missing, blob_corrupt, write_failed,
sidecar_failed; Maven refusals keep their own codes. A failure that
sets none falls back to the file that stopped it, else `unclassified`,
so the unexplained share stays measurable. A failed store copy hands
its cause to the package.
- --json: a failed apply event keeps `errorCode: apply_failed` and adds
`cause` (additive; nested get/scan envelopes carry it too).
- telemetry: each failed patch's `code` is its cause; failures with no
package result (no release variant matched, a Maven base refused as a
whole, a manifest patch whose package is not installed) are named too;
`failure_codes` counts failed patches per code over the whole run; a
run stopped before patching reports `sources_download_failed` /
`offline_missing_sources` as its `error_code`.
Exit codes and what counts as a failure are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Say in telemetry whether a run is in CI
`context.ci` is `true` when `CI` is set to anything but empty, `0` or
`false`, or `GITHUB_ACTIONS` is set: the same rule the update notifier
already used, now shared from core. It tells CI runs from a developer's
machine without naming the provider, repository or job.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Name an apply failure's cause only where the path that failed it knows
Review fixes:
- Drop the fallback that guessed a cause from the verified files: a step
after a successful engine run (a failed native rebuild, a `--force`
skip) could leave the last file describing something else. A failure
with no cause set is `unclassified`.
- Set the cause where results are failed outside the engine: gem
refusals and `native_extension_build_failed`, Gradle's stale transform
copies, a failed `go.mod` edit (`write_failed`). `Refused` becomes
`Coded` and the enum is `#[non_exhaustive]`.
- A copy no release variant matches is reported as `no_matching_variant`,
not `package_not_installed`; once per record, never a record another
copy applied; Maven entries come from the manifest-filtered variants.
- A failed store copy's cause is read before its files move.
- The contract says which causes reach `--json` and which only telemetry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep a whole-base refusal in telemetry beside its applied copies
`gradle_ro_cache_shadows` fails the run while the writable copies are
patched; only a record no copy matched is left out when another copy
applied it. Drop the configuration and contract doc edits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 8c2b260 commit da012af
16 files changed
Lines changed: 774 additions & 91 deletions
File tree
- crates
- socket-patch-cli
- src
- commands
- tests/cli
- socket-patch-core/src
- patch
- redirect
- utils
- vendor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2072 | 2072 | | |
2073 | 2073 | | |
2074 | 2074 | | |
2075 | | - | |
2076 | | - | |
2077 | | - | |
2078 | | - | |
2079 | | - | |
| 2075 | + | |
2080 | 2076 | | |
2081 | 2077 | | |
2082 | 2078 | | |
| |||
2175 | 2171 | | |
2176 | 2172 | | |
2177 | 2173 | | |
2178 | | - | |
2179 | | - | |
| 2174 | + | |
2180 | 2175 | | |
2181 | 2176 | | |
2182 | 2177 | | |
| |||
0 commit comments