mcp: match multi-part starlark extensions in repository scanner - #4911
Open
a-palamarchuk wants to merge 1 commit into
Open
a-palamarchuk wants to merge 1 commit into
a-palamarchuk wants to merge 1 commit into
Conversation
The MCP repository scanner lists ".star.py" and "starlark" as Starlark
resource extensions, but it compared them against filepath.Ext, which only
returns the final extension (".py" for "tool.star.py") and always includes
the leading dot. Neither entry could ever match, so those files were
silently skipped and only ".star" files were loaded.
Match on suffix instead, and fix "starlark" to ".starlark".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
The MCP repository scanner (used by
mcp-server,mcp-server lintanddry-run)lists
.star.pyandstarlarkas Starlark resource extensions, but matches themagainst
filepath.Ext. That function returns only the final extension (.pyfortool.star.py) and always includes the leading dot, so neither entry could evermatch. Files using those extensions were silently skipped and only
.starfileswere loaded.
This switches the matcher to suffix comparison and corrects
starlarkto.starlark.Reproduce (before this change)
A repository with
resources/a.star,resources/b.star.pyandresources/c.starlark, each defining onemcp_tool(...):After:
["from_star", "from_star_py", "from_starlark"], and both new tools execute.Tests
TestScannerStarlarkExtensions(fails onmain, passes here). It also coversnegative cases so the suffix match can't over-reach: a plain
plain.py, a filenamed
notstarlark, andstarlark.txtare still ignored.TestScannerHappy/TestScannerRootstill pass, covering.yml/.yamlmatching for templates, resources and o11y config.
go test -race -shuffle=on ./internal/mcp/..., the in-process MCP integrationtests (
-run '^TestIntegrationMCP'), and./internal/cli/all pass.golangci-lint runandgolangci-lint fmt --diffare clean.Notes
.star.py/.starlarkfiles that were previously ignored inresources/will now be evaluated, so an invalid one would now fail startup thesame way an invalid
.starfile already does.dry-runreturns "resource type 'starlark' is not supported yet"for Starlark files. That was already true for
.star; this change only makes theother two extensions behave consistently with it.