Skip to content

feat(install): suggest --all flag in incompatibility error - #112

Merged
tonythethompson merged 5 commits into
masterfrom
improve-install-error-hint
Aug 10, 2026
Merged

feat(install): suggest --all flag in incompatibility error#112
tonythethompson merged 5 commits into
masterfrom
improve-install-error-hint

Conversation

@tonythethompson

@tonythethompson tonythethompson commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

When a package exists but has no compatible version, the error now additionally suggests:
To see why this package is incompatible: numan search <name> --all

Helps newcomers understand WHY a package won't install. 14 resolve tests pass.

Review in cubic

When a package exists but has no compatible version, the error now
additionally suggests:
  'To see why this package is incompatible: numan search <name> --all'

This helps newcomers understand WHY a package won't install.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @tonythethompson, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Nu mismatch remediation now distinguishes package-wide resolution failures from exact-version failures. Each path emits different numan guidance, and tests verify both positive and negative message cases.

Changes

Nu mismatch guidance

Layer / File(s) Summary
Context-aware remediation
src/core/resolve.rs
resolve and resolve_exact pass different remediation contexts. Shared formatting emits either numan search <package> --all or numan info <package>.
Diagnostic message validation
src/core/resolve.rs
Tests verify package-wide search guidance and exact-version info guidance, including cases without a derived Nu pin.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the install incompatibility error change and the suggested --all flag.
Description check ✅ Passed The description accurately explains the new incompatibility guidance and its tested behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Pipeline Stage Enum Ordering ✅ Passed No tracked file defines or references SessionWorkflowStage or its members; the PR changes only src/core/resolve.rs remediation logic, so enum-order checks do not apply.
Gpu/Cpu Runtime Boundary ✅ Passed The PR changes only src/cmd/init.rs and src/core/resolve.rs; no inference/, requirements, main.py, or C# paths are modified, so the runtime-boundary check is not applicable.
Managed Host Restart Safety ✅ Passed The PR changes only src/core/resolve.rs; neither that file nor the merge diff modifies any managed-host, containerized probe/client/provider, lease, or restart code path.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-install-error-hint
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch improve-install-error-hint

Warning

Review ran into problems

🔥 Problems

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. Analyzed tonythethompson/QuickShell, tonythethompson/numan, tonythethompson/dependency-chain-substrate, skipped Trackdubllc/Trackdub.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Suggest numan search --all when no compatible package version exists

✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add an extra remediation hint for “package exists but incompatible” install errors
• Direct users to numan search  --all to understand incompatibility reasons
• Keep install behavior unchanged; improves guidance for newcomers
Diagram

graph TD
  A["Install/Resolve flow"] --> B["src/core/resolve.rs"] --> C(["append_nu_mismatch_remediation"]) --> D["Error message text"] --> E["CLI prints guidance"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Structured remediation steps (list + join)
  • ➕ Improves readability/maintainability vs. escaped multi-line string literals
  • ➕ Makes it easier to conditionally add/remove hints without editing string formatting
  • ➖ Slightly more code for a very small UX tweak
  • ➖ Potentially touches more call sites if reused elsewhere
2. Centralize error-hint formatting in a dedicated error type/formatter
  • ➕ Keeps resolver logic focused on decisions, not presentation
  • ➕ Enables consistent hint formatting across multiple error kinds
  • ➖ Overkill for a one-line addition
  • ➖ More refactor risk and broader change surface

Recommendation: The current approach (appending a new remediation line) is appropriate given the narrow scope and low risk. If remediation text continues to grow, consider switching to a structured list-of-hints pattern to avoid brittle string-escape formatting and to make future additions easier.

Files changed (1) +2 / -1

Enhancement (1) +2 / -1
resolve.rsAdd '--all' search hint to Nu mismatch remediation message +2/-1

Add '--all' search hint to Nu mismatch remediation message

• Extends the incompatibility remediation guidance to suggest running 'numan search <name> --all' when a package exists but no version is compatible with the current Nu. This is a UX-only change to error output; resolution logic remains the same.

src/core/resolve.rs

@qodo-code-review

qodo-code-review Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Placeholder command is not executable ✓ Resolved 🐞 Bug ≡ Correctness
Description
The new remediation prints the literal <name> instead of the resolved package identifier, so
copying the suggested command causes shells to treat <name> as input redirection and does not
search this package. The hint therefore fails its stated purpose for every incompatibility error.
Code

src/core/resolve.rs[355]

+         \n         - To see why this package is incompatible: `numan search <name> --all`",
Relevance

●●● Strong

Copy/pasteable CLI hints should interpolate real values; team has accepted fixes for misleading
placeholders before.

PR-#23

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed helper has the affected package available and already interpolates package.id in its
other remediation command, while the search CLI defines query as a required positional argument. A
literal angle-bracket placeholder is therefore neither the package query nor a safe copy/paste shell
argument.

src/core/resolve.rs[322-357]
src/cmd/search.rs[10-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The incompatibility remediation emits `numan search <name> --all` literally. In common shells, `<name>` is parsed as input redirection, and it is not the package query, so the suggested command is not copy/paste usable.

## Issue Context
`append_nu_mismatch_remediation` already receives `package` and uses `package.id` in nearby guidance. The search command requires a positional `query` argument.

## Fix Focus Areas
- src/core/resolve.rs[353-356]

Render the affected package identifier in the command, with appropriate shell-safe quoting/escaping if needed, and add or update a test asserting the rendered command.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 31 rules
✅ REVIEW.md
Review mode: 🚀 Fast: This is a small, localized user-facing error-message change in one code path with no security, API, data, or concurrency risk.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/core/resolve.rs Outdated
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

No findings are within the configured fix scope. To change which findings are fixed, adjust the setting on your Qodo configuration page.

@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR differentiates remediation guidance for package-wide resolution failures and exact-version incompatibilities.

  • Package-wide failures now suggest numan search <package> --all.
  • Exact-version failures suggest numan info <package>.
  • Resolve tests assert that each failure path displays the intended command.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/core/resolve.rs Adds failure-specific Nu compatibility remediation hints and updates tests to verify the appropriate command for each resolution path.

Reviews (4): Last reviewed commit: "Merge branch 'master' into improve-insta..." | Re-trigger Greptile

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b24faeb66

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/resolve.rs Outdated
tonythethompson and others added 2 commits August 9, 2026 20:05
Use `numan search <id> --all` for resolve failures and `numan info <id>`
for exact-version mismatches so suggested commands are copy-pasteable.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tonythethompson
tonythethompson enabled auto-merge (squash) August 10, 2026 04:48
@tonythethompson
tonythethompson merged commit 2c6bb5e into master Aug 10, 2026
20 of 21 checks passed
@tonythethompson
tonythethompson deleted the improve-install-error-hint branch August 10, 2026 04:50
@linear-code

linear-code Bot commented Aug 10, 2026

Copy link
Copy Markdown

TS-181

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/resolve.rs`:
- Around line 810-813: Strengthen the assertion in the relevant resolve test
around the existing err check so it also verifies that the exact-version hint
`numan info test/plugin` is absent. Keep the package-wide `numan search
test/plugin --all` assertion, ensuring Resolve and ExactVersion guidance remain
mutually exclusive.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ced15b95-1441-4f04-a346-64960c31baee

📥 Commits

Reviewing files that changed from the base of the PR and between ee857f1 and 78a8243.

📒 Files selected for processing (1)
  • src/core/resolve.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • tonythethompson/QuickShell (manual)
  • tonythethompson/numan (manual)
  • tonythethompson/dependency-chain-substrate (manual)
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Greptile Review
  • GitHub Check: Real-Nu acceptance (windows-latest)
  • GitHub Check: Test (windows-latest)
  • GitHub Check: Analyze (rust)
🧰 Additional context used
📓 Path-based instructions (9)
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

**/*: Use Serena's semantic, symbol-aware tools as the primary tools for reading and editing code; use built-in Read, Glob, Grep, and Edit only under the stated exceptions.
Before editing a code file, inspect its symbol overview, read the specific symbols being changed, and edit them with Serena's symbol-aware tools.
Understand the existing code before changing it and make the smallest change that satisfies the request; avoid unrelated cleanup, premature abstractions, unnecessary error handling, feature flags, and compatibility shims.
Prefer editing existing files over creating new ones, and never create Markdown or README files unless explicitly requested.
For exploratory questions, provide a 2–3 sentence recommendation with the main tradeoff and do not implement until the user agrees.
For UI or frontend changes that cannot be tested in a browser, explicitly state that browser testing was not performed rather than claiming success.
Address security issues when discovered, including injection, XSS, SQL injection, path traversal, and secret leaks.
Pause and obtain confirmation before destructive, hard-to-reverse, externally visible, or third-party-upload actions, including deleting files or branches, dropping tables, force-pushing, modifying CI/CD, posting externally, or uploading content.
When blocked, investigate the root cause instead of bypassing it with --no-verify, --force, or deletion; investigate unfamiliar files, branches, and configuration before deleting them.
Only commit when explicitly asked; do not proactively update git configuration or push changes.
Do not skip Git hooks unless explicitly asked; if a pre-commit hook fails, fix the issue, re-stage, and create a new commit rather than amending.
Stage files by name rather than using git add -A or git add ., to avoid accidentally including secrets or large binaries.
Use a HEREDOC for commit messages, and add co-author attribution only when the user explicitly requests the exact trailer.
Do not force-pus...

Files:

  • src/core/resolve.rs
**/*.{js,jsx,ts,tsx,py,java,go,rs,rb,php,c,cpp,h,hpp,cs,swift,kt,kts}

📄 CodeRabbit inference engine (CLAUDE.md)

Add comments only when the WHY is non-obvious; do not narrate what the code does, reference the current task, or reference the PR in comments.

Files:

  • src/core/resolve.rs
!**/.env,!**/credentials.json,!**/*.pem

📄 CodeRabbit inference engine (CLAUDE.md)

Do not commit files that appear to contain secrets, including .env, credentials.json, and PEM files; warn before doing so even if explicitly requested.

Files:

  • src/core/resolve.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust 2021 edition.
Use anyhow::Result with .context(...) in application code; use thiserror for library error types that callers match on.
Use clap derive macros for CLI definitions.
Use serde with serde_json or toml for serialization.
Function parameters must use &Path, not &PathBuf.
Library code must not panic; error paths should return anyhow::Result with context where appropriate.
Add or update tests for behavior changes, including relevant failure paths.
New mutating code paths must acquire the mutation lock via acquire_mutation_lock(root) and snapshot the lockfile before writes.
Lockfile, journal, and state-file JSON writes must use write_json_atomic.
numan install must write only to $NUMAN_ROOT; it must not invoke Nu or register plugins/autoloads.
Only activate and deactivate may modify Nu integration state.
Treat the lockfile as the authoritative source of truth; derived projections such as autoload state must not be authoritative.
Install payloads under versioned, content-addressed paths and never overwrite them in place.
Never overwrite foreign autoload files; respect OWNERSHIP_MARKER.
Pass plugin paths through environment variables only; do not use runtime interpolation in Nu program strings.

**/*.rs: All CI gates must pass: cargo test, cargo clippy -- -D warnings, and cargo fmt --check.
Every mutating command—including install, remove, update, gc, and future nupm import—must call acquire_mutation_lock(root).
Lockfiles, journals, and state files must use write_json_atomic; partial writes are not allowed.
Pending activation, autoload, and lifecycle journals must be stored under $NUMAN_ROOT/state/.
Module autoload identity must match all four fields: Nu executable hash, Nu version, vendor autoload directory, and managed file path; the lockfile module_activation value is authoritative.
Never overwrite foreign autoload files; respect OWNERSHIP_MARKER.
Pass paths to Nu only throu...

Files:

  • src/core/resolve.rs
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Run and keep cargo fmt/rustfmt clean, and ensure cargo clippy -- -D warnings passes.

Files:

  • src/core/resolve.rs
**/*.{rs,nu}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{rs,nu}: Real-Nu acceptance tests must be marked #[ignore] and should be run when changes affect activation or nupm import; unit tests must not spawn real nu and should use injectable seams such as FakeCandidateRunner or registrars.
The nupm integration must be read-only toward NUPM_HOME, must not execute build.nu, and must not perform bidirectional synchronization.

Unit tests must use FakeCandidateRunner or injectable registrars and must not spawn a real nu process.

Files:

  • src/core/resolve.rs
**/*.{rs,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Match existing naming, module layout, and documentation level in the file being edited; update AGENTS.md, docs/, or command help when structure, conventions, or user-visible behavior changes.

Tests must cover failure modes, not only successful execution.

Files:

  • src/core/resolve.rs
**/*.{rs,md,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use the repository's established serialization and module conventions rather than introducing unrelated refactors.

Files:

  • src/core/resolve.rs
src/core/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Derive the platform triple from compile-time #[cfg(target_env)] values, not std::env::consts; LIBC must be a compile-time constant.

Files:

  • src/core/resolve.rs
🔍 Remote MCP DeepWiki, GitHub Copilot

Relevant review context

  • PR #112 changes only src/core/resolve.rs (+55/−2). It adds a remediation mode distinguishing package-wide resolve failures from explicit-version resolve_exact failures. Package-wide failures suggest numan search <package-id> --all; exact-version failures suggest numan info <package-id> and explicitly reject the search hint.
  • The install transaction calls resolve_exact only for owner/name@version; otherwise it calls resolve, so the distinction is correctly placed at the resolver boundary.
  • Existing repository syntax uses positional managed-Nu versions (numan setup nu <version>), and the PR does not modify that syntax.
  • Tests cover both positive and negative guidance for package-wide and exact-version mismatches, including concrete package IDs.
  • CI currently reports successful format, clippy, MSRV, Linux/macOS tests, and real-Nu acceptance; Windows tests/acceptance, Rust analysis, and Greptile review were still in progress.
🔇 Additional comments (2)
src/core/resolve.rs (2)

295-295: LGTM!

Also applies to: 314-327, 337-342, 376-389


839-846: LGTM!

Also applies to: 886-893

Comment thread src/core/resolve.rs
Comment on lines +810 to +813
assert!(
err.contains("numan search test/plugin --all"),
"expected incompatible-package search hint: {err}"
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Keep package-wide and exact-version guidance mutually exclusive.

The package-wide test verifies numan search test/plugin --all, but it does not reject numan info test/plugin. A regression could emit both hints and still pass this test. Add a negative assertion for the exact-version hint.

Proposed assertion
         assert!(
             err.contains("numan search test/plugin --all"),
             "expected incompatible-package search hint: {err}"
         );
+        assert!(
+            !err.contains("numan info test/plugin"),
+            "package-wide failures should not suggest exact-version info: {err}"
+        );

Based on the change contract, the Resolve and ExactVersion hints must remain distinct.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assert!(
err.contains("numan search test/plugin --all"),
"expected incompatible-package search hint: {err}"
);
assert!(
err.contains("numan search test/plugin --all"),
"expected incompatible-package search hint: {err}"
);
assert!(
!err.contains("numan info test/plugin"),
"package-wide failures should not suggest exact-version info: {err}"
);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/resolve.rs` around lines 810 - 813, Strengthen the assertion in the
relevant resolve test around the existing err check so it also verifies that the
exact-version hint `numan info test/plugin` is absent. Keep the package-wide
`numan search test/plugin --all` assertion, ensuring Resolve and ExactVersion
guidance remain mutually exclusive.

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