Repository navigation
feat: port MetricRelationVisibility + MCP withVisibleEvidence (upstream PR #36764 follow-up) - #154
Merged
Merged
Conversation
…-10-31) The two files ported in this PR cite ADR:2026-10-31-metric-and-metric-group-responses-hide-relations-the-viewer-cannot-see in their Javadoc, but the record did not exist in this repo, so the decision-records check in verify-rebuild failed with 2 problems. Add the record (the decision behind #153's REST read-path port, implemented here for the MCP path); the citation now resolves.
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.
范围
移植官方 PR open-metadata#36764(ADR 2026-10-31)的 MCP 侧读路径可见性——#153(REST 侧)后的立即跟进项。裁决:
~/workspace/work/metric-mcp-followup/RULING.md(parent idea 复核 APPROVE,2026-11-07 00:20)。背景:REST 侧(#153)已让每个携带
Metric/MetricGroup的响应按调用者ViewBasic过滤关系字段;MCP 工具回答时走的实体与 REST 响应带同样的关系,须经同样的过滤。落点只有一个:CommonUtils.withVisibleEvidence的 else 分支。3 文件 +363/−3(base 主干
023a0e1f):MetricRelationVisibility.java:新增,官方全文逐字节(67 行)CommonUtils.java:只取 2 个 MCP hunk(withVisibleEvidencejavadoc + else 分支改为MetricRelationVisibility.visibleTo(...));排除 3 个 Announcement hunkMcpMetricRelationVisibilityIT.java:新增,官方全文逐字节(292 行)对齐程度(逐文件,与官方 pin
a3012259ca全文对照)MetricRelationVisibility.javacmpIDENTICALCommonUtils.javaAnnouncementVisibility(官方 :27)、enforceVisibility调用(官方 :55)、Entity.ANNOUNCEMENT条件(官方 :80–81)McpMetricRelationVisibilityIT.javacmpIDENTICALCommonUtils.java与主干的 diff 恰好 2 个 hunk(javadoc + else 分支),无其余改动。排除的 3 个 Announcement hunk 是 scope 决定,不是编译强制(主干已有AnnouncementVisibility,带进来也能编译)——另立一项。未动:
GetEntityTool/CreateEntityTool/PatchEntityTool(其与官方的差异——TestCase PII 掩码、S4authorizeCreate/authorizePatch调用、Team persona、BoundedJsonPatch——另立项);REST 已合入的代码(MetricResource/MetricGroupResource/MetricRepository/MetricGroupRepository/EntityUtil);bot PUT、sortConstraintPairs/addNavbarDomainFilter。架构说明(部署产品不受影响)
部署的 MCP 是 TypeScript
smartmetadata-mcp(stdio),经 REST 读实体——#153 部署后它返回的已经是过滤后的数据。本 PR 对齐的是 Javaopenmetadata-mcp模块(reactor 成员、集成测试的测试依赖;openmetadata-dist明确排除它,部署 server 不加载、不提供/mcp)。所以本 PR不改变已部署产品的任何运行时行为;它关闭的是 Java MCP 路径(集成测试环境)的窗口。门禁
java-checkstyle与verify-rebuild须绿(PR 自身 CI)。openmetadata-service-unit-tests与maven-sonarcloud-ci:路径过滤掉openmetadata-mcp/**与openmetadata-integration-tests/**,不编译 Java MCP 模块。maven-build-collate:在本仓库直接 skip。integration-tests:只在 merge_group / 主干 push 跑,不在 PR 上跑——新 ITMcpMetricRelationVisibilityIT的 5 个测试尚未执行;PR 阶段的正确性靠逐字节对照 + 依赖核查(McpTestBase/McpTestUtils与官方逐字节一致,JwtAuthProvider.tokenFor等依赖主干全有)。/tmp/mcp-compile,分支头059a5b71,阿里云镜像 settings):mvn -DskipTests install -pl :openmetadata-mcp -am—— PASS(MCP 模块编译通过)。mvn -DskipTests=false test -pl :openmetadata-mcp—— 838 run / 0 失败 / 1 错误;唯一错误CreateEntityToolTest.glossaryTermParentIsAuthorizedAsTheTermItNames(NPE),主干对照同样失败,为主干既存,与本 PR 无关(本 PR 的改动对 GlossaryTerm 是 no-op)。mvn -DskipITs test-compile -pl :openmetadata-integration-tests—— BUILD SUCCESS(新 IT 文件编译通过)。test -pl :openmetadata-mcp -am按字面跑不通(testphase 在package之前,shaded jar 未生成,service 编译找不到es.*),修正为等价的 A/B/C 三步,见实施记录 §3.0。实施记录
~/workspace/work/metric-mcp-followup/IMPLEMENTATION.md(逐文件核对、diff 结果、服务器侧编译证明、PR 自身 CI 状态)。