Repository navigation
fix(search): resolve project roles once, check MCP project filters - #455
Merged
M0Rf30 merged 1 commit intoNov 9, 2026
Merged
Conversation
Follow-up to the review of openartifact#454: - ProjectScope.NarrowToProjects also returns whether the caller holds a project role. On a project-filtered search that is too broad, the HTTP handler and the MCP search tool reuse it for the project:<project> hint instead of resolving the caller's roles a second time. - search.CheckProjectFilters holds the project_role and 50-value rules. GET /api/v1/search answers them with 400 invalid_filter as before, and the MCP search tool now applies them too, as a tool error: an unknown project_role or more than 50 project: / project_role: values used to be accepted there (a typo silently matched nothing). - docs/integrations/mcp.md: the qualifiers search_artifacts takes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
The two non-blocking nits from the review of #454.
Resolve roles once.
ProjectScope.NarrowToProjectsnow also returns whether the caller holds a project role (whatUsesProjectsreports), since it resolves the roles anyway. On a project-filtered search that is too broad, the HTTP handler andsearch_artifactsreuse that value for theproject:<project>hint instead of callingUsesProjectsagain. Unfiltered too-broad searches still callUsesProjectsonce.Same filter rules on MCP.
search.CheckProjectFiltersholds theproject_roleand 50-value rules.GET /api/v1/searchuses it (still400 invalid_filter), andsearch_artifactsnow applies it before any lookup, as a tool error the model can read. Besides the cap, this also covers an unknown role on MCP, which was accepted before:project_role:Viewersilently matched nothing.docs/integrations/mcp.mdnow lists the qualifierssearch_artifactstakes.One small message change on HTTP: too many
format/repovalues is "too many format or repo filters" again (as before #454), and too manyproject/project_rolevalues is "too many project or project_role filters". The code staysinvalid_filter.Tests
internal/search/project_filter_test.go:CheckProjectFilters(every role, unknown and wrong-case roles, 50 vs 51 values of each).internal/mcp/search_projects_test.go: a project-filtered too-broad search narrows once and doesn't resolve roles again, with the hint following the narrowing's answer; an unknown role and 51 values of each are tool errors and never reach the scope. Both tests fail if the reuse or the check is removed.Checked locally:
make check, the unit suite with-race, the slim suite, andgo test -tags integration ./internal/search/.🤖 Generated with Claude Code