Repository navigation
Align Context Center principal handling - #36663
Conversation
Users, teams and domains have independent name namespaces. Match shared principals by their stored IDs and require a user reference for caller ownership checks, so namesakes cannot read memories or files. Reuse search's principal IDs and deny sharing when the caller lookup fails.
|
Additional local verification Unit selections completed with 513 distinct cases passing. The table uses the latest result for each class from the context selection and memory/file follow-up.
A focused MySQL/Elasticsearch HTTP run also completed with 286 passed and 27 skipped: JaCoCo line coverage: |
Code Review ✅ Approved🔴 High risk · Changes memory and file sharing authorization to match principal IDs, so resolver or reference mismatches could expose private Context Center content or deny access. Aligns Context Center sharing with the existing principal ID resolver used by search, and makes owner reference checks for memories and files use the reference type stored with each owner. Adds REST and MCP coverage for these paths. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Local Java test run: FAILED — details
Selected but produced no report: Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. integration · mysql-elasticsearch · parallel: 56 classes
Why these tests
Commandsmvn -B package -pl openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=CompanyContextToolTest,ContextFileVisibilityTest,ContextMemorySearchVisibilityTest,ContextMemoryVisibilityTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<56 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=ContextMemoryDerivationIT,ContextMemoryExtractionIT,ConversationSchemaMigrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=AgentSparqlResourceIT,RdfMcpKnowledgeGraphIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
|
🚦 Removed from the merge queue —
|
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
* fix(context): match shares by principal ID Users, teams and domains have independent name namespaces. Match shared principals by stored IDs and require user references for caller ownership. Adapt the REST and MCP regression tests to the 2.0 memory APIs; file sharing and approved-memory status are not available on this branch. (cherry picked from commit 9b32eb8) * test(context): adapt backport list and read checks * test(context): cover unresolved sharing enforcement * test(context): scope backport to guarded read routes * test(context): use 2.0 JWT test helper



Describe your changes
Align Context Center principal handling with the existing search behavior, and keep owner reference checks consistent for memories and files. Add coverage for the related REST and MCP operations.
Type of change
High-level design
Reuse the existing principal ID resolver for Context Center sharing. Owner checks use the reference type already stored with each owner. This uses the existing data model and requires no migration for valid stored references.
Tests
Use cases covered
Direct sharing, team/domain membership, principal renames, owner references, REST memory and file operations, and MCP memory reads.
Unit tests
Updated
ContextMemoryVisibilityTest,ContextFileVisibilityTest, andCompanyContextToolTest.Additional unit selections passed 513 distinct cases; full class results are recorded in a comment. Changed-class line coverage:
ContextMemoryVisibility93.1%,ContextFileVisibility100%.Backend integration tests
Added
McpContextMemoryPrincipalIdentityIT. Focused HTTP/MCP selection: 286 passed, 27 skipped.The affected Java run completed with no failing executed cases. The local runner reports an incomplete entry for the
McpServiceResourceITsource placeholder; the planner adjustment is tracked in #36553.Local Java verification
Local Java test run: FAILED
767c1b0a8dfb(baseorigin/main)Selected but produced no report:
McpServiceResourceIT (mysql-elasticsearch · parallel)Java class results · Additional checks
Other checks
Spotless, Java impact ownership, and decision-record validation passed. Ingestion tests and a UI recording are not applicable to this backend change. Playwright planning selected 34 specs; they were not run because this checkout has no UI test server. No separate manual UI session was run; the HTTP integration suites exercise the backend behavior.
Self-review
Reviewed
767c1b0a8dfagainstREVIEW.md; no outstanding findings. The change follows the existing identity contract and requires no new decision record.Checklist