Fix two follow-up issues: reject nonexistent roots, single-source extensions

- pipeline: fail index create/update with a clear error when the project root
  is not a directory instead of building a misleading zero-file index
- config: single LANGUAGE_BY_EXT table as source of truth; language_for and
  resolver code_extensions both derive from it (no more duplicated ext list)
- imports: resolver probes code_extensions() instead of a local RESOLVE_EXTS
- tests: regression for nonexistent-root rejection

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
endergebnisandCopilot committed 2026-09-04 20:45:17 +02:00
1 parent 4338e28ce0
commit a416a9fe52
4 files changed
+69 -22

No files matched your search

+18
View File
@@ -626,3 +626,21 @@ fn mcp_reports_invalid_params_and_parse_errors() {
.expect("parse error response");
assert_eq!(parse["error"]["message"], "parse error");
}
#[test]
fn index_create_rejects_nonexistent_root() {
let out = Command::new(bin())
.args(["index", "create", "/definitely/not/a/real/rustytokens/path"])
.env("XDG_CACHE_HOME", cache_dir())
.output()
.expect("run rustytokens");
assert!(
!out.status.success(),
"index create must fail on a nonexistent root"
);
assert!(
String::from_utf8_lossy(&out.stderr).contains("not a directory"),
"stderr explains the failure: {}",
String::from_utf8_lossy(&out.stderr)
);
}