Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

fix(plugin-detail,plugin-list): add missing @object-ui/permissions dev edge so turbo ^build reaches it - #3242

Merged
xuyushun441-sys merged 1 commit into
mainfrom
claude/issue-3207-plugin-detail-permissions-dev-dep
Aug 3, 2026
Merged

xuyushun441-sys merged 1 commit into
mainfrom
claude/issue-3207-plugin-detail-permissions-dev-dep

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Fixes #3207

问题

@object-ui/permissions 只出现在 plugin-detail / plugin-list 的 peerDependencies,不在 dependencies / devDependencies。turbo 的 type-check 任务 dependsOn: ["^build"],而 ^ 只沿 dependencies/devDependencies 走,所以 permissions/dist 永远不会为这条命令构建出来。

值得强调的一点(原单没写,但它解释了为什么这是构建图问题而不是安装问题):pnpm 其实已经把这个 peer 软链进了 node_modules —— 改动前的 lockfile 里,@object-ui/permissions 被记在 importer 的 dependencies 下(specifier: workspace:^)。也就是说包的路径一直能解析,tsc 找得到那个目录,只是目录里没有 .d.ts,于是报 TS2307。turbo 读的是 package.json,不是 lockfile,两者不一致正是缺口所在。

缺口有两处

按「peerDependencies 里的工作区包未同时出现在 dependencies/devDependencies」逐个扫全工作区(46 个包,含 apps/* 与 examples/*),命中两个:

@object-ui/plugin-detail -> missing: @object-ui/permissions
@object-ui/plugin-list   -> missing: @object-ui/permissions

两处都改 package.json 且都会动 pnpm-lock.yaml,分两个 PR 必然互撞,所以一并修。

改动

  1. 两个包的 devDependencies 各补一行 "@object-ui/permissions": "workspace:*"(与同文件其余 peer 的写法一致),pnpm install 重新生成 lockfile。
  2. 新增 scripts/__tests__/workspace-peer-dependency-edges.test.ts —— 把这条不变量机械化,而不是手工修完就算。

关于那条 guard

原单的深层意思是:一个包改完后最该跑的那条 scoped typecheck,返回的却是一屏与改动无关的红。补一行依赖只恢复了今天的状态,挡不住下一个包再捅同样的窟窿 —— 所以补了 guard。

判据用的是「这个 peer 是不是工作区里的包」,而不是「名字是不是 @object-ui/ 开头」。后者只是巧合,前者才是 turbo 真正在乎的东西(外部 peer 如 react / @objectstack/spec 从 registry 装来就是构建好的,不需要这条边)。

几个刻意的设计:

  • 没有豁免名单,现在也不该有 —— 修完之后全工作区 46 个包无一违反,而一条豁免和这个 bug 本身在形态上无法区分。
  • workspace 根从 pnpm-workspace.yaml 读,不写死,新增工作区根当天就被覆盖到;解析器只认文件里实际用的两种写法,遇到看不懂的语法抛错而不是跳过(悄悄少看半个工作区的 guard 比没有 guard 更糟)。
  • 有一条 discovers the workspace 断言兜底,防止解析器坏掉后所有断言在空列表上「真空通过」。
  • 失败信息直接给出原因和修法,不用再去翻 issue。

它落在 scripts/**/*.test.ts,vitest.config.mts 的 unit project 已经覆盖这个 glob,所以随 pnpm test 自动跑,不需要另外改 workflow(少一处可能忘掉的接线)。全量耗时 272ms。

反向验证过:临时把 plugin-detail 那行 devDep 删掉,guard 如期变红并指名道姓;恢复后转绿。

关于 changeset(未加,理由如下)

按 AGENTS.md「纯 bug 修复不需要 changeset」,且这次改的只有 devDependencies —— 消费者安装依赖时不会装 devDependencies,peerDependencies / dependencies 一个字没动,发布物的行为零变化,属于仓库内构建图/DX 修复。加 changeset 会让 fixed 组 39 个包为一次消费者观察不到的改动集体 patch 发版。若维护者认为仍需留一条 changelog 记录,我可以补一个 patch。

验证

改动前(干净 worktree,packages/permissions/dist 不存在):

$ pnpm exec turbo run type-check --filter=@object-ui/plugin-detail
@object-ui/plugin-detail:type-check: src/DetailView.tsx(49,32): error TS2307: Cannot find module '@object-ui/permissions' or its corresponding type declarations.
@object-ui/plugin-detail:type-check: src/RelatedList.tsx(51,32): error TS2307: ...
@object-ui/plugin-detail:type-check: src/renderers/record-details.tsx(15,53): error TS2307: ...
@object-ui/plugin-detail:type-check: src/renderers/record-details.tsx(116,18): error TS7006: Parameter 'n' implicitly has an 'any' type.
@object-ui/plugin-detail:type-check: src/renderers/record-highlights.tsx(15,53): error TS2307: ...
@object-ui/plugin-detail:type-check: src/renderers/record-quick-actions.tsx(21,32): error TS2307: ...
@object-ui/plugin-detail:type-check: src/renderers/record-related-list.tsx(16,53): error TS2307: ...
@object-ui/plugin-detail:type-check: src/renderers/record-related-list.tsx(161,60): error TS7006: Parameter 'n' implicitly has an 'any' type.
Failed:    @object-ui/plugin-detail#type-check

$ pnpm exec turbo run type-check --filter=@object-ui/plugin-list
@object-ui/plugin-list:type-check: src/ListView.tsx(24,32): error TS2307: Cannot find module '@object-ui/permissions' or its corresponding type declarations.
Failed:    @object-ui/plugin-list#type-check

plugin-list 复现的是同一类失败(只有一处 import,所以只有一条),不是依赖边本来就完整。

改动后(先 rm -rf packages/permissions/dist,以证明是 turbo 自己把它构建出来的):

$ pnpm exec turbo run type-check --filter=@object-ui/plugin-detail
@object-ui/permissions:build: > @object-ui/permissions@17.2.0 build
@object-ui/permissions:build: > tsc
@object-ui/plugin-detail:type-check: > tsc --noEmit && tsc -p tsconfig.typetests.json
 Tasks:    12 successful, 12 total

$ pnpm exec turbo run type-check --filter=@object-ui/plugin-list
@object-ui/plugin-list:type-check: > tsc --noEmit && tsc -p tsconfig.typetests.json
 Tasks:    13 successful, 13 total

@object-ui/permissions:build 出现在依赖图里 —— 这正是原先缺失的那条边。

其余:

$ pnpm exec turbo run test --filter=@object-ui/plugin-detail --filter=@object-ui/plugin-list
@object-ui/plugin-detail:test:  Test Files  38 passed (38)
@object-ui/plugin-detail:test:       Tests  362 passed (362)
 Tasks:    14 successful, 14 total

$ pnpm exec vitest run --project unit scripts/
 Test Files  4 passed (4)
      Tests  34 passed (34)

$ pnpm exec eslint scripts/__tests__/workspace-peer-dependency-edges.test.ts
(exit 0)

Generated by Claude Code

…v edge

`@object-ui/permissions` was declared only in `peerDependencies` of both
packages. pnpm still symlinks such a peer into node_modules, so the module
path resolved — but turbo reads package.json, not the lockfile, and the
`type-check` task's `dependsOn: ["^build"]` walks dependencies/devDependencies
only. `permissions/dist` therefore never got built and a scoped
`turbo run type-check --filter=@object-ui/plugin-detail` failed with TS2307
plus the TS7006 cascade that follows a failed import.

The full-repo `pnpm type-check` stayed green (another package's build dragged
permissions up as a side effect), so CI could not see this — only the scoped,
per-package typecheck could, which is exactly the command to run after
touching one package.

Adds a workspace-wide guard so the invariant is enforced rather than restored
by hand: a peer that lives in this workspace must also carry a
dependencies/devDependencies edge.

Fixes #3207

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Aug 3, 2026 7:13am

Request Review

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Main entry (gzip) 28.1 KB 350 KB
Entry file index-B76hz360.js —
Status PASS —

📦 Bundle Size Report

Package Size Gzipped
app-shell (index.js) 8.47KB 3.09KB
app-shell (runtime-config.js) 7.42KB 2.32KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 7.57KB 2.97KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 1.17KB 0.53KB
auth (AuthProvider.js) 22.10KB 4.37KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.12KB 3.41KB
auth (LoginForm.js) 17.86KB 5.29KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.43KB 2.09KB
auth (SocialSignInButtons.js) 9.60KB 3.89KB
auth (UserMenu.js) 3.40KB 1.22KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 35.76KB 9.11KB
auth (createAuthenticatedFetch.js) 4.37KB 1.69KB
auth (index.js) 2.35KB 1.07KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 4.91KB 0.87KB
auth (useIsWorkspaceAdmin.js) 1.61KB 0.85KB
collaboration (CommentThread.js) 18.38KB 4.49KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 3.65KB 1.42KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.25KB 0.53KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 476.12KB 104.47KB
core (index.js) 2.25KB 0.80KB
create-plugin (index.js) 9.28KB 2.98KB
data-objectstack (index.js) 136.23KB 34.75KB
fields (index.js) 223.43KB 54.66KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (i18n.js) 4.32KB 1.77KB
i18n (index.js) 2.46KB 0.96KB
i18n (pickLocalized.js) 1.70KB 0.83KB
i18n (provider.js) 5.37KB 1.72KB
i18n (useObjectLabel.js) 26.14KB 6.07KB
i18n (useSafeTranslation.js) 3.26KB 1.44KB
layout (index.js) 37.91KB 10.53KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.74KB
mobile (index.js) 1.50KB 0.62KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.71KB 0.42KB
mobile (useResponsiveConfig.js) 1.36KB 0.63KB
mobile (useSpecGesture.js) 4.05KB 1.53KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 8.75KB 3.06KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 3.67KB 1.12KB
permissions (evaluator.js) 4.41KB 1.44KB
permissions (index.js) 0.91KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.52KB
permissions (usePermissions.js) 1.55KB 0.71KB
plugin-ai (index.js) 15.71KB 3.79KB
plugin-calendar (index.js) 44.90KB 12.35KB
plugin-charts (index.js) 60.53KB 17.12KB
plugin-chatbot (index.js) 180.09KB 42.72KB
plugin-dashboard (index.js) 111.87KB 28.82KB
plugin-designer (index.js) 210.51KB 42.50KB
plugin-detail (index.js) 230.54KB 56.77KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 111.39KB 26.94KB
plugin-gantt (index.js) 162.26KB 39.53KB
plugin-grid (index.js) 185.04KB 49.00KB
plugin-kanban (index.js) 47.82KB 13.18KB
plugin-list (index.js) 104.86KB 25.30KB
plugin-map (index.js) 16.80KB 5.24KB
plugin-markdown (index.js) 13.65KB 4.67KB
plugin-report (index.js) 40.48KB 10.57KB
plugin-timeline (index.js) 25.76KB 7.32KB
plugin-tree (index.js) 8.34KB 2.82KB
plugin-view (index.js) 83.54KB 20.39KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.71KB 3.53KB
providers (index.js) 0.44KB 0.22KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.67KB 2.37KB
react (LazyPluginLoader.js) 3.77KB 1.33KB
react (SchemaRenderer.js) 19.28KB 6.38KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 1.02KB 0.55KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 4.09KB 1.74KB
sdui-parser (index.js) 4.47KB 2.03KB
sdui-parser (parse.js) 10.04KB 2.82KB
sdui-parser (types.js) 0.29KB 0.24KB
sdui-parser (validate.js) 4.69KB 1.48KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.87KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-retry.js) 4.32KB 2.02KB
types (index.js) 2.46KB 1.21KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 0.20KB 0.18KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (spec-report.js) 5.05KB 1.93KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 0.20KB 0.18KB
types (ui-action.js) 3.40KB 1.71KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

turbo run type-check --filter=@object-ui/plugin-detail 必定失败:@object-ui/permissions 只在 peerDependencies,^build 因此不构建它

2 participants