Skip to content

Commit 84e1370

Browse files
test(app-shell): give the new package-door matrix doubles the draft-overlaid read (#27103)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8VtLrLYVCgWS9LRTX72qamP)_ Fixes #27095 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:给两个新测试(#27010、#26837)的假客户端补上 `withPreviewDrafts`,只改测试,不改产品代码。 - 为什么改:#26840 让包内访问矩阵经草稿叠加读取对象,这两个测试与它交错合并,假客户端缺该方法,main 的 Test UI 因此变红。 - 风险与回滚:两行测试替身改动,零产品风险;回滚即 revert 本 PR。 - 先看:`PermissionMatrixEditor.objectGrantInherited-27010.test.tsx` 与 `PermissionMatrixEditor.packageDoorDraftBase-26837.test.tsx` 的 `makeClient`。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.objectGrantInherited-27010 packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.packageDoorDraftBase-26837`,预期全绿。 - 需要你做的:无,席位落地。 ## What changes `withPreviewDrafts() { return this; }` added to the fake client of the two package-door matrix tests that merged beside #26840 (PR #27064): #27010's `objectGrantInherited-27010` and #26837's `packageDoorDraftBase-26837`. Same addition as the other matrix doubles. No product code changes. ## Why Main went red on Test UI (shards 11 and 12) after queue merges crossed: #27064 made the package door read objects through `MetadataClient.withPreviewDrafts(true)`, and these two new tests' fakes did not have that method. ## Tests - Red leg (the two files as on `main`): Test Files 2 failed, Tests 4 failed. - Green leg: those two files plus `draftObjects-26840`: Test Files 3 passed, Tests 28 passed. - Sweep: every app-shell test that mounts the matrix (74 files). They pass at `76e90df6` with the #27010 fix (714 tests). The other 36 files without `withPreviewDrafts` never mount the matrix under a `packageId`, so they never call it. ## Verification Derived gates are in the os-dev report on #27095. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbYLTHkXTxBf89Sud8r --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbYLTHkXTxBf89Sud8r)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0fb0dda commit 84e1370

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.objectGrantInherited-27010.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ function makeClient(server: FakeServer) {
4343
return {
4444
layered: async () => ({ effective: server.set, code: null, overlay: null, overlayScope: null }),
4545
getDraft: async () => null,
46+
// objectstack#26840 — the package door reads its objects through the draft-overlaid door.
47+
withPreviewDrafts() { return this; },
4648
list: async (type: string) =>
4749
type === 'object' ? server.catalog : type === 'permission' ? [{ name: 'project_editor' }] : [],
4850
get: async (type: string) => (type === 'object' ? { fields: [{ name: 'notes' }] } : null),

‎ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.packageDoorDraftBase-26837.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ function makeClient(server: Server, opts: { draft: Record<string, unknown> | nul
9999
if (opts.rejectSaveTimeDraft && server.getDraftCalls > 1) throw new Error('draft read failed');
100100
return opts.draft ? { type: 'permission', name: 'sales_perms', item: opts.draft, version: 'v1' } : null;
101101
},
102+
// objectstack#26840 — the package door reads its objects through the draft-overlaid door.
103+
withPreviewDrafts() { return this; },
102104
// The package declares `a_account` only.
103105
list: async (type: string) => (type === 'object' ? [{ item: { name: 'a_account' } }] : []),
104106
get: async () => null,

0 commit comments

Comments
 (0)