Skip to content

Separate CLI usage failures from error issues with concrete causes - #142

Merged
tnkuehne merged 15 commits into
mainfrom
fix/cli-error-reporting
Nov 20, 2026
Merged

tnkuehne merged 15 commits into
mainfrom
fix/cli-error-reporting

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

CLI error tracking currently groups unrelated failures under “Widefleet CLI error” and marks returned errors as unhandled. Give failures safe, command-specific titles and structured causes, and keep known usage/configuration outcomes measurable without creating exception issues.

  • Attach concrete causes at the failure site: missing login/configuration, invalid scopes and inputs, denied/expired login, credential-store failures, corrupt sessions, incomplete OAuth credentials, and deployment/protocol failures. Preserve the original terminal message and source location; outer operation context cannot overwrite a more specific cause.

  • Known usage/configuration failures emit only cli_command_completed, with outcome: failed, error_category: usage and a specific error_code. This retains signals for documentation and UX improvements without filling error tracking with warning issues.

  • Explicitly interrupted deployment waits (Ctrl+C) emit outcome: cancelled and their cancellation code, with no exception. Successful commands remain outcome: succeeded. Command metrics can therefore distinguish usage failures, technical failures and cancellations; error rates can use failed / (succeeded + failed), grouped by command and CLI version, with cancellations reported separately.

  • Technical failures, panics and unclassified Invalid, Credentials, I/O and HTTP 4xx failures remain error-level exceptions. A broad error kind or status alone does not establish an expected outcome. Both API parsing and reqwest error_for_status() retain HTTP status information.

  • Classify API rejections by the server's error code instead of the status alone. The API now answers unknown routes with ROUTE_NOT_FOUND and contract validation failures with INVALID_REQUEST, so these no longer share NOT_FOUND and BAD_REQUEST with domain decisions on user input. 4xx responses with another server code are usage outcomes and report the code as api_error_code; unknown routes, contract mismatches and 4xx responses without a server code, such as proxy pages, remain exceptions.

  • Without a session file and a reachable credential store, report session_unreachable as a usage outcome: the CLI cannot tell a missing login from an unreachable store there, and neither is a CLI defect.

  • Group exceptions by source file rather than line and column, so a failure keeps its issue across releases.

  • Distinguish handled returned errors from unhandled panics, group by command/cause/status/source, and remove fabricated <unknown> function and resolved-frame fields. Send only fixed summaries and safe metadata, never raw error messages, response bodies, private paths or credentials. Preserve the shared agent report format.

  • Honor independent usage/crash opt-outs: usage-only failures are not sent when usage reporting is disabled, even if crash reporting remains enabled. Technical and unknown exceptions follow the crash preference independently.

  • Use the shared service-documentation crate from the CLI blocking task, keeping file reads and type analysis off the async executor while preserving panic propagation and the deterministic executor-progress regression. This lets HTTP connection cleanup proceed during analysis.

Validation on the updated branch:

  • cargo test --locked --workspace: 90 tests passed.
  • Workspace Clippy with warnings denied and Rust formatting passed.
  • 249 CLI/integration tests passed (one platform-specific test skipped), including reporting, authentication, services and deployment fixtures.
  • A deterministic regression verifies executor progress during blocked source-map reads. The Git index timestamp fix and its source snapshot/commit regression are already on main and remain intact after the merge.
  • The CLI fixture explicitly closes the completed source lookup connection and verifies successful deployment over a new connection, independently of compiler speed.
  • Type checks, formatting and type-aware lint passed.

Reporting changes take effect after installing an updated CLI. Existing issue history is not rewritten.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues remain.

Summary

The PR separates known usage failures and cancellations from technical errors while keeping terminal messages and safe reporting details.

  • CLI failures now get command-specific causes and safer reports.
  • API errors distinguish contract mistakes from unknown routes.
  • Deployment source analysis stays off the executor and keeps panics intact.

Reviews (18) · Last reviewed commit: "Keep API error messages when a gateway s..." · Reviewed by Greptile

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs f4bc16a Nov 20 2026, 02:13 PM

@tnkuehne tnkuehne changed the title Classify CLI failures and fix hosted settings payloads Report concrete CLI failure causes without hiding actionable errors Nov 15, 2026
@tnkuehne tnkuehne changed the title Report concrete CLI failure causes without hiding actionable errors Separate CLI usage failures from error issues with concrete causes Nov 17, 2026
Comment thread crates/platform-cli/src/reporting.rs Resolved
Comment thread crates/platform-cli/src/auth.rs Resolved
Without a session file and credential store, the CLI cannot tell whether
a login never happened or sits in a store that is now unreachable. Keep
both out of error tracking, since neither is a CLI defect, but give them
their own usage code so they are not counted as missing logins.
The API now answers unknown routes with ROUTE_NOT_FOUND and requests that
fail contract validation with INVALID_REQUEST, so they no longer share
NOT_FOUND and BAD_REQUEST with domain decisions on user input.

The CLI reads the code from error responses. 4xx rejections with a server
code are usage outcomes and report the code in telemetry; contract
mismatches, unknown routes and 4xx responses without a server code, such
as proxy pages, remain error issues.
Comment thread crates/platform-core/src/http.rs Resolved
Read code, message, error_description and error independently, so a
numeric or object-valued field no longer discards the whole error body.
@tnkuehne
tnkuehne merged commit d15ab77 into main Nov 20, 2026
16 checks passed
@tnkuehne
tnkuehne deleted the fix/cli-error-reporting branch November 20, 2026 14:27
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.

1 participant