Repository navigation
fix(app-shell): a locked metadata item's designer canvas is read-only - #27035
Conversation
ResourceEditPage handed the registered preview an onPatch even when the page cannot write the item, so the object canvas offered add field and section move/remove on a locked item, with no Save to keep the edit. Pass no onPatch when the page is read-only, as Studio does for a read-only package. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbajUhBue1th6Leba9E
席位核对ACCEPT · 席位意见:一个 prop 的修复,落在页面层,所以 Setup 里所有设计器类型在锁定条目上都只读,不只 Object;可写条目和新建模式不受影响。
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 40654479966 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Warren · project thread
Fixes #26888
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
MetadataResourceEditPagepasses the registered designer previewonPatch={readOnly ? undefined : …}instead of an unconditionalonPatch.readOnlyis the page's existing!canWrite && !createMode, so it covers a locked item (layered.editable === false), a caller withoutmanage_metadata, and a walled catalog. Per the preview contract (MetadataPreviewProps.onPatch), a canvas with noonPatchis read-only;ObjectFormCanvasderivesreadOnly = !onPatch, which hides Add field, Add section, Add field to this section, Move section up/down and Remove section. This mirrors Studio's read-only package handling (objectui#11136,onPatch={readOnly ? undefined : onPatch}inStudioDesignSurface). The fix is at the page, so every Setup designer type goes read-only on a locked item, not only Object;ObjectPreview.tsxneeded no change.The Description box (
ObjectDefaultInspector) was alreadydisabled={readOnly}through the page'sformReadOnly: measured, already done.Tests
New
ResourceEditPage.lockedCanvas-26888.test.tsxmounts the real page with the built-in designers registered:editable: false,lock: 'full') shows the lock banner, none of those controls, and no "Unsaved".Ablation (restore the unconditional
onPatchviascripts/ablation-replace.mjs, anchor hit 1 → 0, blob 6cd1fb36 → 256b0123): the locked case goes red (the found Move/Remove BUTTON list did not deeply equal[]), control stays green; restore verified blob == HEAD andgit diff HEADempty.Acceptance notes
Verification
All local readings on head
a512197f(base7eb613c3).pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' buildunder the lock: exit 0 (6m16s).ResourceEditPage*+ObjectFormCanvas: 44 files, 224 tests passed.pnpm --filter @object-ui/app-shell run type-check: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 34 derived families, all exit 0;--ranreconciliation: 34 run, 0 NOT-MEASURED, 0 UNRUN. Includesnode scripts/check-sdui-manifest.mjsandpnpm --dir ui exec vitest run scripts/(176 files passed, 2 skipped).pnpm check:changeset-fixed(roster under.changeset) exit 0;pnpm --dir ui run check:new-line-citationsexit 0.Generated by Claude Code