Skip to content

fix: respect gitignore in marker walk, classify MCP errors by fault - #485

Merged
bug-ops merged 2 commits into
mainfrom
fix/476-479-walk-filter-error-mapping
Sep 21, 2026
Merged

bug-ops merged 2 commits into
mainfrom
fix/476-479-walk-filter-error-mapping

Conversation

@bug-ops

@bug-ops bug-ops commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • standard_filters(false) negates the preceding git_ignore(true) in the project-marker walk #476 — LspServerConfig::find_any_marker_recursive called WalkBuilder::standard_filters(false) after git_ignore(true), silently negating it (last write wins) and letting the project-marker search descend into gitignored directories. Reordered so standard_filters(false) runs first.
  • map_bridge_error reports every caller-fault error as -32603 internal_error #479 — map_bridge_error routed nearly every crate::error::Error variant through the generic -32603 INTERNAL_ERROR, including clear caller-fault variants, while the resource handlers independently reimplemented correct -32602 INVALID_PARAMS classification for a subset of cases. Added an exhaustive Error::mcp_error_kind() classification (no wildcard arm) and routed both map_bridge_error and the resource handlers through it, removing the duplicated .map_err(...) chains.

Classification notes (from review)

  • Caller-fault (invalid_params, -32602): InvalidToolParams, PathOutsideWorkspace, NotARegularFile, InvalidUri, DocumentNotFound, FileSizeLimitExceeded, and FileIo when caused by a nonexistent path (ErrorKind::NotFound).
  • Retryable (bespoke code + structured data): WorkspaceIndexing (existing, -32050), ServerInitializing and WorkspaceServersInitializing (new, -32051) — both represent "expected LSP server hasn't registered yet."
  • Internal (-32603): NoWorkspaceRoots (workspace roots are a startup-fixed snapshot — an empty set never fills, no retry helps) and DocumentLimitExceeded (aggregate tracker state, not a bad property of the specific request — the identical request can succeed later once other documents close).

Test plan

  • cargo +nightly fmt --all -- --check
  • cargo clippy --all-targets --all-features --workspace -- -D warnings
  • cargo nextest run --workspace --all-features --lib --bins (973 passed)
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • cargo test --doc (28 passed)
  • New regression test for standard_filters(false) negates the preceding git_ignore(true) in the project-marker walk #476 verified to fail under the pre-fix WalkBuilder ordering
  • New tests pin the JSON-RPC error code for each reclassified Error variant, including through the read_resource/subscribe handler chain

Closes #476
Closes #479

Reorder WalkBuilder calls so standard_filters(false) runs before the
individual overrides, instead of after — it was silently resetting
git_ignore(true) back to false, letting the project-marker search
descend into gitignored directories.

Add an exhaustive Error::mcp_error_kind() classification and route
map_bridge_error and the resource handlers through it. Caller-fault
variants now map to invalid_params instead of the generic internal_error
catch-all; ServerInitializing and WorkspaceServersInitializing get a
retryable code with structured data, matching the existing
WorkspaceIndexing pattern; NoWorkspaceRoots and DocumentLimitExceeded
stay internal since neither is fixable by changing the request.

Closes #476
Closes #479
@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes mcpls-core mcpls-core crate changes labels Sep 21, 2026
@bug-ops
bug-ops enabled auto-merge (squash) September 21, 2026 12:20
@bug-ops
bug-ops merged commit 286f530 into main Sep 21, 2026
51 of 53 checks passed
@bug-ops
bug-ops deleted the fix/476-479-walk-filter-error-mapping branch September 21, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation mcpls-core mcpls-core crate changes rust Rust code changes

Projects

None yet

1 participant