fix: address PR 68 review findings (doctor UX)

Merged
TO
3mo ago
+689-343

Summary

Doctor UX follow-up on top of refactor/ux-improvements: repair by default, --scan report-only, no doctor --fix/--yes, soft-fail PreMutation Doctor snapshots, off-PATH via setup nu use without --yes.

Review finding triage (ceb00f1)

Fixed:

  • doctor.rs: check_active_version_marker Err hint uses hints::CMD_DOCTOR_FIX
  • init.rs: mutation lock before NuPaths/Lockfile reload; validate from post-lock state
  • init.rs tests: PreMutation reason assert, concurrent lock contention, snapshot failure does not write paths
  • bootstrap.rs: shared snapshot_before_nu_setup helper for both PreMutation call sites
  • docs/numan-doctor.md: default mode applies confirm-tier without TTY/not_confirmed gate (nested setup nu use consent unchanged; --scan unchanged)

Skipped (already fixed):

  • Merged Markdown table rows in docs/numan-doctor.md (active_version / activate+registry sync)

Skipped (out of minimal scope):

  • Capturing/restoring full paths.json as a snapshot sidecar on Init/rollback: would expand snapshot schema + rollback commits beyond documented snapshot scope (docs/snapshots-and-rollback.md); Nu identity hash/version is already recorded when available

Test plan

  • cargo fmt / cargo clippy -- -D warnings
  • cargo test --lib 'cmd::init::'
  • cargo test --lib 'cmd::doctor::tests::doctor'
  • cargo test --test doctor_test --test init_test
  • cargo test --lib 'nu::bootstrap'
Open in Web Open in Cursor