CmdPal: Fix bookmark launch fallback handling - #48712
Closed
michaeljolley wants to merge 17 commits into
Closed
Conversation
added 3 commits
June 17, 2026 23:34
… spaces, percent-encoding; add TestLaunchOverride hook and launcher fallback for tests (#48672)
…ly tests (#48672) - Extract NormalizePathForWindows from BookmarkResolver into a dedicated internal helper class (Services/PathNormalization.cs). - Add safe trailing-whitespace trimming (incl. NBSP) so trailing copy/paste artifacts don't defeat File.Exists probes; trailing dots are deliberately preserved to avoid lossy transformations. - BookmarkResolver delegates through a thin private wrapper so existing call sites and behavior are unchanged. - Add PathNormalizationTests covering NFC, non-ASCII preservation, trailing-whitespace handling, and Windows-only long-path / NT-object prefix stripping. Windows-only assertions use Assert.Inconclusive on non-Windows agents so CI on Linux/macOS skips them cleanly.
michaeljolley
commented
Jun 19, 2026
michaeljolley
left a comment
Contributor
Author
There was a problem hiding this comment.
LGTM — approved by Duke
michaeljolley
commented
Jun 19, 2026
michaeljolley
left a comment
Contributor
Author
There was a problem hiding this comment.
LGTM — approved by Cover Girl (QA) — tests added/updated and passing locally. See commit SHAs in your report.
michaeljolley
marked this pull request as ready for review
June 19, 2026 00:50
michaeljolley
enabled auto-merge (squash)
June 19, 2026 00:51
- Remove reflection-based tests; use IProcessLauncher mock to capture launched classifications (proper use of the DI that the PR introduced) - Simplify GreedyFind: replace List/HashSet/Sort allocations with a single for-loop that skips non-boundary positions - Add missing 'using ManagedCommon' to PathHelpers.cs (compile fix) - Replace bare catch blocks with Logger.LogError calls in TryResolvePathCandidateCore and TryPercentDecodePathCandidate Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Classification is a sealed record (reference type), not a struct. Nullable reference types don't have .Value — access properties directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…em call A new call site was added on main that the PR didn't account for. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- BookmarksCommandProviderTests.cs: add #nullable enable for Classification? usage - BookmarkResolverGreedyFindTests.cs: add using Microsoft.CmdPal.Ext.Bookmarks.Helpers for CommandKind Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The resolver should classify paths by their extension/existence without falling back to parent directories. Parent-fallback belongs only in LaunchBookmarkCommand at launch time. This fixes test failures where non-existing files with extensions were incorrectly classified as Directory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…arators Probing at path-separator boundaries caused GreedyFind to walk up to ancestor directories (e.g. C:\Users) for non-existing paths, incorrectly classifying quoted paths like "C:\Users\John Doe\file.txt" as Directory instead of letting them fall through to the LooksPathy heuristic which correctly classifies by extension. Also simplifies ExpandToBestExistingPath return type (removes vestigial UsedParentDirectoryFallback bool that was always false). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Preserve the raw command token for the Unknown fallback target in BookmarkResolver so normalization no longer trims meaningful trailing whitespace (e.g. a quoted single space). Normalization is now applied to a separate copy used only for path detection/probing. - Make MockProcessLauncher mirror the real launcher by failing for a filesystem target that does not exist, which is what drives the nearest-existing-parent fallback the test asserts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jiripolasek
requested changes
Jun 27, 2026
jiripolasek
left a comment
Collaborator
There was a problem hiding this comment.
Blocking this until we figure out what's going on here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BookmarkResolverpath probing/classification heuristics for bookmark strings with spaces, punctuation, and non-ASCII characters%xxsequences are present)NormalizePathForWindows(NFC normalization + safe long-path prefix stripping) before probe/classification useDirectory/ExplorerOpenFixes #48672