-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Swapped out to_string_lossy with display for user facing text #5666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swapped out to_string_lossy with display for user facing text #5666
Conversation
| for component in components.iter().skip(len - 2) { | ||
| path_str.push('/'); | ||
| path_str.push_str(component.as_os_str().to_string_lossy().as_ref()); | ||
| path_str.push_str(component.as_os_str().display().as_ref()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
displayed in commandline later in line 76
| name, | ||
| source: RecipeSource::Local, | ||
| path: path.to_string_lossy().to_string(), | ||
| path: path.display().to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
displayed later in commands/recipe.rs
| goose::recipe::template_recipe::parse_recipe_content( | ||
| &rf.content, | ||
| Some(rf.parent_dir.to_string_lossy().to_string()), | ||
| Some(rf.parent_dir.display().to_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used for tracing (printing?) in line 1120
| let search_dirs_str = search_dirs | ||
| .iter() | ||
| .map(|p| p.to_string_lossy()) | ||
| .map(|p| p.display().to_string()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
part of error on line 67. Not 100% certain whether errors are consumed by user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR attempts to replace to_string_lossy() with display() for user-facing path text across multiple files to improve handling of non-UTF-8 paths. However, the implementation introduces compilation errors by calling .display() on OsStr/OsString types which don't have this method.
- Replaces
to_string_lossy()withdisplay()in 6 files - Affects error messages, directory listings, and path formatting
- Changes span across CLI, MCP, and core recipe loading code
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/goose/src/recipe/local_recipes.rs | Updates error message path formatting in recipe file loading |
| crates/goose-mcp/src/developer/text_editor.rs | Changes directory entry name handling |
| crates/goose-cli/src/recipes/search_recipe.rs | Updates path display in recipe listing |
| crates/goose-cli/src/commands/session.rs | Modifies path filtering in session list command |
| crates/goose-cli/src/commands/project.rs | Changes path component formatting in two locations |
| crates/goose-cli/src/cli.rs | Updates recipe parent directory path handling |
Signed-off-by: Vincent Huang <[email protected]>
0080343 to
07c2156
Compare
Signed-off-by: Vincent Huang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| let search_dirs_str = search_dirs | ||
| .iter() | ||
| .map(|p| p.to_string_lossy()) | ||
| .map(|p| p.display().to_string()) | ||
| .collect::<Vec<_>>() | ||
| .join(":"); |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded ":" separator on line 68 is incorrect for Windows. The code uses platform-specific separators (';' for Windows, ':' for Unix) when parsing GOOSE_RECIPE_PATH on line 26. Use the same logic here: let path_separator = if cfg!(windows) { ';' } else { ':' }; and then .join(path_separator).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to change the scope of this pr (I'm assuming this change will require adding unit tests and normalizing the if cfg!(windows)... logic for reuse), will ignore for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copilot is wrong; this is used interally
* origin/main: (29 commits) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) feat: add Supabase MCP server to registry (#5629) Unlist VS Code extension tutorials from MCP and experimental sections (#5677) fix: make image processing work in github copilot provider (#5687) fix: do not take into account gitignore in developer mcp (#5688) docs: session storage migration (#5682) New maintainers (#5685) chore: Update governance (#5660) chore(release): release version 1.14.0 (minor) (#5676) fix : action icons overlap session title in chat history (#5684) Document recent goose PRs (#5683) docs: add GOOSE_PATH_ROOT environment variable documentation (#5678) feat: SessionManager integration for acp sessions (#5657) teach copilot our CI (#5672) bump openapi version directly (#5674) governance: update MAINTAINERS.md to reflect new maintainers (#5675) chore: upgrade rmcp to 0.8.5 (#5673) Update release instructions (#5662) Swapped out to_string_lossy with display for user facing text (#5666) ...
…5666) Signed-off-by: Vincent Huang <[email protected]>
…5666) Signed-off-by: Vincent Huang <[email protected]>
…5666) Signed-off-by: Vincent Huang <[email protected]> Signed-off-by: Blair Allan <[email protected]>
Summary
Replaced user facing
to_string_lossywithdisplaycalls as recommended per issue hereType of Change
AI Assistance
Testing
N/A
Related Issues
Relates to #5435