Skip to content

rust: stop discarding errors in adopt and the dx crate root (part of #13147) - #13329

Merged
TrapsterDK merged 1 commit into
mainfrom
rust-adopt-unused-result-ok
Nov 18, 2026
Merged

TrapsterDK merged 1 commit into
mainfrom
rust-adopt-unused-result-ok

Conversation

@TrapsterDK

Copy link
Copy Markdown
Collaborator

Part of #13147.

  • dx_output::write_stderr writes diagnostics and logs (tracing::info!) a failed stderr write instead of dropping it silently.
  • cli/cli/src/adopt/* and cli/cli/src/main.rs: every stderr .ok() / drop(writeln!) goes through it; the watch clear-screen write is a checked stdout write; .ok() stays only where absence is the answer, each with a one-line reason.
  • dx upgrade --apply refuses (Infra, exit 3) when MODULE.bazel.lock exists but cannot be read, before writing the edit; a failed restore after a failed refresh says restoring <path> failed: <e> instead of claiming restored. Failed git probes are logged.
  • dx init fails with init_failed when .dx/pins exists but cannot be read.
  • #![deny(clippy::unused_result_ok, clippy::map_err_ignore)] on cli/cli/src/adopt.rs and the main.rs crate root.

Tests: write_stderr bytes and failing writer; lockfile-as-directory refusal; restore failure message; .dx/pins-as-directory.

Ran: tools/dx check --apply --affected (0), tools/dx test --affected (0), tools/dx check --affected (0), bazel test //cli/output:dx_output_test //cli/cli:dx_cli_test (pass; the full dx_cli_test ran ~63s on a loaded machine, past its 60s small timeout; it passed with --test_timeout=200). Nested-Bazel and consumer tests not run locally.

Remaining for #13147:

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K

…art of #13147)

Add dx_output::write_stderr, which logs a failed stderr write instead of
dropping it. Route adopt and main.rs stderr writes through it, propagate
stdout and file errors, and keep .ok() only with a reason. Deny
unused_result_ok and map_err_ignore in cli/cli/src/adopt.rs and main.rs.

dx upgrade now refuses when MODULE.bazel.lock cannot be read and reports a
failed restore; dx init fails when .dx/pins cannot be read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K
@TrapsterDK
TrapsterDK force-pushed the rust-adopt-unused-result-ok branch from 567954e to 8463980 Compare November 18, 2026 03:29
@TrapsterDK
TrapsterDK merged commit d7e4b1d into main Nov 18, 2026
@TrapsterDK
TrapsterDK deleted the rust-adopt-unused-result-ok branch November 18, 2026 03:30
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