Files
Martin Vogel a0c71225f7 fix(mcp): resolve projects by their non-ASCII folder name (#1827)
A repo under a non-ASCII path (e.g. .../中文测试仓库) is stored under a
project name whose non-ASCII bytes are hex-transliterated (#571), e.g.
"...-e4b8ade69687e6b58be8af95e4bb93e5ba93". That name is the cache DB
file name, so it is a persisted identity and must stay stable.

Root cause of the "project not found": a bare selector (no path
separator) skipped all normalization, and the #1025 folder-name tail
match bails out early when cbm_validate_project_name() rejects the raw
selector -- which it always does for non-ASCII bytes. So the real
Chinese folder name never reached the lookup that already makes ASCII
folder names work.

Fix: split the name-mapping half of cbm_project_name_from_path() into
cbm_project_name_sanitize() (pure refactor, identical output), and in
normalize_project_arg() encode a bare selector that contains non-ASCII
bytes the same way before the exact/tail lookup. The stored identity is
unchanged (no DB rename, no orphaned indexes); ASCII selectors keep
their existing validation; a selector that collapses to the "root"
fallback is left untouched. Full paths already resolve through
normalize_project_arg -> cbm_project_name_from_path.

Test: mcp::tool_project_arg_resolves_non_ascii_folder_issue1827 indexes
a repo under a CJK folder and selects it by folder name (RED before),
by full path, and asserts an unknown CJK name stays not-found.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-09-25 18:37:16 +02:00
..