fix(plugin-detail): field:permission-facet-link 注册套上 withFieldCarrier(#3307) - #3338
Merged
Merged
Conversation
…FieldCarrier (#3307) The repo's only raw `field:` registration bypassed the single-metadata- carrier seam (objectui#3233). Under the SDUI path SchemaRenderer passes the authored node as `schema` and never `field`, so the widget read `field === undefined` and silently rendered an anonymous facet summary (`field?.name` empty, no facet branch selected). The form and inline-edit hosts pass `field` directly, which the carrier forwards unchanged, so they are unaffected. Regression test renders through the real registration, the real SchemaRenderer, and the real widget, asserting on facet data (capability chip names) rather than translation copy; break-verified red with the carrier removed, green with it restored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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.
Fixes #3307
问题
packages/plugin-detail/src/index.tsx把PermissionFacetLink裸注册进field:命名空间——全仓唯一一处绕过withFieldCarrier(objectui#3233 / PR #3296)的 field 注册。SDUI 路径下SchemaRenderer只传schema不传field,widget 读props.field拿到undefined,于是field?.name为空、facet 分支全部落空,静默渲染出一个匿名摘要——不报错、不警告,正是单载体收敛要防的那类静默失效。表单宿主与内联编辑宿主本来就传field,不受影响(carrier 对显式field原样放行)。修法(按 PM 裁决的最小修法)
withFieldCarrier,与packages/fields/src/index.tsx注册循环的用法一致;注册点注释写明这是field:注册的强制封口。PermissionFacetLink.sduiCarrier.test.tsx:走真实注册项 + 真实 SchemaRenderer + 真实 widget,SDUI 形状(只传schema)下断言 capability chips(manage_users/view_reports,facet 自身的数据而非翻译文案)渲染出来——该分支当且仅当field?.name === 'system_permissions'才会命中,即field?.name非空端到端成立;并断言不落到匿名默认分支(裸计数2)。另钉住注册项本身就是 carrier 适配器(displayName前缀)。@object-ui/plugin-detailpatch(fixed 组,无 major)。验证
pnpm exec vitest run packages/plugin-detail/src/__tests__/PermissionFacetLink.sduiCarrier.test.tsxwithFieldCarrier后重跑同一文件getByText('manage_users')找不到——widget 落入匿名分支;registry 项displayName为undefined);套回后 ✅ 2 passedpnpm exec turbo run type-check --filter=@object-ui/plugin-detailpnpm exec vitest run packages/plugin-detail packages/fields/src/__tests__/field-carrier-sdui.test.tsx packages/components/src/renderers/form/__tests__/form-field-carrier.test.tsx --maxWorkers=2后续指引(本单不做)
#3307 里提出的结构性加固——收口
field:注册表面(例如只暴露内置 carrier 的registerField(),让绕过在结构上不可能)——按 PM 裁决另立单裁决,本 PR 不做。🤖 Generated with Claude Code
https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
Generated by Claude Code