Skip to content

test(types): 删除 37 条随 spec 退役而失效的 DROPPED_SCHEMA_EXPORTS,并加棘轮断言 (#3601) - #3623

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3601-inert-dropped-entries
Aug 7, 2026
Merged

test(types): 删除 37 条随 spec 退役而失效的 DROPPED_SCHEMA_EXPORTS,并加棘轮断言 (#3601)#3623
yinlianghui merged 1 commit into
mainfrom
claude/issue-3601-inert-dropped-entries

Conversation

@yinlianghui

@yinlianghui yinlianghui commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes #3601

按 PM 裁决的方向 B:删 37 条恒真条目 + 加一条棘轮断言,让「随 spec 退役而失效」从此自曝。

背景

DROPPED_SCHEMA_EXPORTS#2561 决策 (a) 的拒绝名单:逐条断言 @objectstack/spec/ui 的 zod 校验器@object-ui/types 导出。这条断言只在 spec 仍然发布该名时才有意义 —— 上游一旦整个退役某个 def,没有任何东西能再导出它,该行退化为恒真,还会稀释真守卫的信噪比。

测量(在本分支重跑,非照抄 issue 正文)

worktree 装的是 lockfile 解析的 @objectstack/spec@17.0.0-rc.5,对 82 条逐条查 spec 是否仍发布该名(Spec 前缀条目按名单注释的既有语义回退到去前缀原名再查):

total: 82   INERT: 37   LIVE: 45

与 issue 正文的 37 条清单逐条一致,包括正文标为「待查」的 4 条 —— DensityModeSchema / PerformanceConfigSchema / PageTransitionSchema / WcagContrastLevelSchema 全部确认已退役。另做了近名探测(Density / Performance / Transition / Wcag / Contrast 在 204 个 spec/ui 导出里零命中),排除「改名而非退役」的可能。

45 条真守卫一条未动。

删除的 37 条,按退役来源分组

正文表格的分组有两处需要更正,已按上游退役测试的实际名单归位:

退役来源 条数 条目
objectstack#4988 / PR objectstack#5321 —— ui/ 五个交互配置模块(touch / dnd / keyboard / animation / offline)整体退役 32 TouchTargetConfigSchema SpecGestureTypeSchema SwipeDirectionSchema SwipeGestureConfigSchema PinchGestureConfigSchema LongPressGestureConfigSchema SpecGestureConfigSchema TouchInteractionSchema TransitionPresetSchema EasingFunctionSchema TransitionConfigSchema AnimationTriggerSchema ComponentAnimationSchema PageTransitionSchema MotionConfigSchema DragHandleSchema DropEffectSchema DragConstraintSchema DropZoneSchema DragItemSchema DndConfigSchema FocusTrapConfigSchema KeyboardShortcutSchema FocusManagementSchema KeyboardNavigationConfigSchema OfflineStrategySchema ConflictResolutionSchema SyncConfigSchema PersistStorageSchema EvictionPolicySchema OfflineCacheConfigSchema SpecOfflineConfigSchema
objectstack#4610 —— NotificationAction 的两个包装器,零消费者删除 2 NotificationSchema NotificationConfigSchema
objectstack#3494 / PR objectstack#3516 —— Theme 侧仍然死掉的 aspirational config 清理 2 DensityModeSchema WcagContrastLevelSchema
objectstack#3896 audit close-out —— performance 块每个承载者都是 authorable 且 inert 1 PerformanceConfigSchema
37

两处更正:

棘轮断言

手法同 PR #3568$icontains 排除项加的「排除项不得超期」断言:

it('every deny-list entry is still a live @objectstack/spec/ui export', () => {
  const retired = DROPPED_SCHEMA_EXPORTS.filter(
    (name) => resolveSpecName(name) === undefined,
  );
  expect(retired, `…no longer publishes…: ${retired.join(', ')}…`).toEqual([]);
});

两处设计取舍:

  • 收集后一次性断言,而非逐条 toBe(true):退役是整族落地的(上游一个 PR 就带走 32 条),逐条断言会停在第一条、藏住其余 31 条。
  • Spec 前缀回退是承重的,不是装饰:45 条里有 16 条只能靠回退解析(SpecPageSchemaPageSchema 等),29 条直接命中。去掉回退这条断言会立刻误报那 16 条。

逆向验证(先预测后运行,两个方向都如预测)

在名单末尾临时塞一个 spec 从未有过的名字 NeverExistedInSpecSchema:

预测 实测
修前(未改的测试) 绿 —— 唯一断言是 name in Types === false,对一个谁都不导出的名字恒真 ✅ 绿,Tests 3 passed (3)
修后(本 PR) 红,且点名该条;其余 3 条测试仍绿 ✅ 1 failed / 3 passed(共 4),失败信息含 no longer publishes these DROPPED_SCHEMA_EXPORTS entries: NeverExistedInSpecSchema

修后那一轮的完整失败输出:

FAIL packages/types/src/__tests__/spec-ui-schema-reexports.test.ts >
  spec/ui …Schema re-exports (#2561, decision (a)) >
  every deny-list entry is still a live @objectstack/spec/ui export
AssertionError: @objectstack/spec/ui no longer publishes these
DROPPED_SCHEMA_EXPORTS entries: NeverExistedInSpecSchema. …
  expected [ 'NeverExistedInSpecSchema' ] to deeply equal []

 Test Files  1 failed (1)
      Tests  1 failed | 3 passed (4)

修前那一轮绿就是恒真缺陷的现场演示:被删的 37 条这些年一直是这个状态。验证后假名已还原。

顺带更正的一处注释

文件头注举「dual type+value 名」的例子是 `Dashboard`, `DensityMode`, `ThemeMode` —— 而 DensityMode 本身已被 objectstack#3494 / PR objectstack#3516 从 spec 退役(Dashboard / ThemeMode 仍在)。同一份文件里同一类腐化,仅注释改动,已在注释里点明出处。

验证

$ npx vitest run packages/types --maxWorkers=2
 Test Files  28 passed (28)
      Tests  383 passed (383)

$ pnpm --workspace-concurrency=2 --filter @object-ui/types type-check
> tsc --noEmit && tsc -p tsconfig.examples.json && tsc -p tsconfig.test.json
(通过,无输出)

$ npx eslint packages/types/src/__tests__/spec-ui-schema-reexports.test.ts
(exit 0,无告警)

$ node scripts/check-control-bytes.mjs
✅  check-control-bytes: OK (scanned 3650 tracked text file(s); skipped 85 binary).

无 changeset:测试-only 改动,不触碰任何包的公开面、运行时行为或类型导出 —— 按仓例(changeset 用于 user-visible 变更)无需 changeset。

文件面:packages/types/src/__tests__/spec-ui-schema-reexports.test.ts 单文件,+50 −46。


🤖 Generated with Claude Code

https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt

…veness ratchet (#3601)

The deny-list guards #2561 decision (a): spec/ui zod validators are not part
of @object-ui/types' public surface. A row only asserts something while the
spec still publishes the name — once upstream retires it, nothing can
re-export it and the row passes as a tautology.

37 of 82 rows had rotted that way: objectstack#4988 / PR #5321 (32, the five
interaction-config modules), #4610 (2), #3494 / PR #3516 (2), #3896 (1).
They are deleted; the 45 rows that still guard a live spec export are
untouched.

The new ratchet asserts every remaining row resolves to a real
`@objectstack/spec/ui` export (with the Spec-prefix alias fallback the list's
own doc comment describes, load-bearing for 16 of the 45), so the next
upstream retirement fails here by name instead of waiting for an audit. Same
technique as PR #3568's `$icontains` exclusion ratchet.

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

vercel Bot commented Aug 7, 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 7, 2026 4:12pm

Request Review

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

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

📦 Bundle Size Report

Package Size Gzipped
app-shell (index.js) 8.66KB 3.13KB
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.21KB 3.45KB
auth (LoginForm.js) 18.13KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.64KB 2.21KB
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) 26.07KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.65KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
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) 480.72KB 105.64KB
core (index.js) 2.96KB 1.13KB
create-plugin (index.js) 9.28KB 2.98KB
data-objectstack (index.js) 137.51KB 35.11KB
fields (index.js) 230.87KB 56.83KB
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.65KB 1.06KB
i18n (pickLocalized.js) 1.70KB 0.83KB
i18n (provider.js) 9.48KB 3.27KB
i18n (useObjectLabel.js) 26.14KB 6.07KB
i18n (useSafeTranslation.js) 4.52KB 1.96KB
layout (index.js) 38.53KB 10.71KB
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.32KB 1.64KB
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.98KB 12.37KB
plugin-charts (index.js) 61.04KB 17.31KB
plugin-chatbot (index.js) 180.09KB 42.72KB
plugin-dashboard (index.js) 115.50KB 29.96KB
plugin-designer (index.js) 210.51KB 42.51KB
plugin-detail (index.js) 232.79KB 57.42KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 112.10KB 27.10KB
plugin-gantt (index.js) 162.55KB 39.57KB
plugin-grid (index.js) 186.61KB 49.34KB
plugin-kanban (index.js) 48.30KB 13.28KB
plugin-list (index.js) 105.12KB 25.48KB
plugin-map (index.js) 16.81KB 5.24KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 40.58KB 10.58KB
plugin-timeline (index.js) 25.76KB 7.33KB
plugin-tree (index.js) 8.50KB 2.88KB
plugin-view (index.js) 84.03KB 20.55KB
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.71KB 1.34KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
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

@yinlianghui
yinlianghui marked this pull request as ready for review August 7, 2026 16:18
@yinlianghui
yinlianghui added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 2904a7c Aug 7, 2026
18 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-3601-inert-dropped-entries branch August 7, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DROPPED_SCHEMA_EXPORTS 中 37 条已随 spec 退役而失效,断言退化为恒真

2 participants