Update conflict detection to respect gateway_id in Prompt/Resource services#2585
Merged
crivetimihai merged 2 commits intomainfrom Jan 31, 2026
Merged
Update conflict detection to respect gateway_id in Prompt/Resource services#2585crivetimihai merged 2 commits intomainfrom
crivetimihai merged 2 commits intomainfrom
Conversation
54f2ad7 to
18ac3c8
Compare
…ueness Signed-off-by: Keval Mahajan mahajankeval23@gmail.com
18ac3c8 to
c59782c
Compare
Member
Additional Fixes AppliedAfter reviewing and testing the original PR changes, I identified and fixed several issues: Bug Fixes1. ORM Event Handler Gateway Lookup (HIGH - Root Cause)
2.
3. Unused Variable (MEDIUM)
Service Layer EnhancementsSingle Registration (
Bulk Registration (
Test Results
|
c59782c to
a404996
Compare
Member
|
Final linting and security fixes:
All checks pass:
|
crivetimihai
approved these changes
Jan 31, 2026
a404996 to
296a984
Compare
Member
|
Improved test coverage for gateway-scoped conflict queries: The namespacing tests now properly validate that
All 136 service tests pass. |
296a984 to
3d8fee5
Compare
hughhennelly
pushed a commit
to hughhennelly/mcp-context-forge
that referenced
this pull request
Feb 8, 2026
…rvices (IBM#2585) * namespace prompt names and resource URIs by gateway ID, ensuring uniqueness Signed-off-by: Keval Mahajan mahajankeval23@gmail.com * linting Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Keval Mahajan mahajankeval23@gmail.com Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Signed-off-by: hughhennnelly <hughhennelly06@gmail.com>
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
…rvices (IBM#2585) * namespace prompt names and resource URIs by gateway ID, ensuring uniqueness Signed-off-by: Keval Mahajan mahajankeval23@gmail.com * linting Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Keval Mahajan mahajankeval23@gmail.com Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
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.
🐛 Bug-fix PR
📌 Summary
Closes #2520
Implemented proper Gateway Namespacing for Resources and Prompts. Historically, the application logic enforced global uniqueness for Resource URIs and Prompt Names per team/owner, ignoring which Gateway they belonged to. This change updates the ResourceService and PromptService (and their Create schemas) to respect gateway_id during registration and conflict detection. Ideally, the same URI or Name should be allowed if it is associated with a different Gateway.
🔁 Reproduction Steps
🐞 Root Cause
The register_resource and register_prompt methods in the service layer checked for conflicts by querying the database for any existing record with the same uri/name and team_id/visibility. The query filters completely omitted the gateway_id field. As a result, the application was mistakenly treating different gateways as sharing a single global namespace. Additionally, the Create schemas were missing the gateway_id field entirely, preventing the API from accepting this context.
💡 Fix Description
Schema Updates:
ResourceCreateandPromptCreatePydantic models inschemas.pyto accept an optionalgateway_id.Service Logic:
ResourceService.register_resourceto:gateway_id(WHERE uri = ... AND gateway_id = ...)
PromptService.register_promptto:gateway_idgateway_idto the databasewhen creating new records.
Tests:
TestResourceGatewayNamespacingunit tests to verify that:TestPromptGatewayNamespacingunit tests with the same guarantees🧪 Verification
make lintmake testmake coverage📐 MCP Compliance (if relevant)
✅ Checklist
make black isort pre-commit)