Skip to content

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

Description

@yinlianghui

发现于 objectui#3363 / PR #3600(顺带清理该列表两条时测量到,未在该 PR 修)。

现象

packages/types/src/__tests__/spec-ui-schema-reexports.test.tsDROPPED_SCHEMA_EXPORTS 是一份拒绝名单:#2561 决策 (a) 规定 @objectstack/spec/ui 的 zod 校验器(…Schema)不属于 @object-ui/types 的公开面,该测试逐条断言这些名字@object-ui/types 导出。

前提是这些名字在 spec 里确实存在、因而确实存在「被误再导出」的风险。当 spec 把某个 def 整个退役后,该条目就失去了意义:没有任何东西能再导出一个 spec 已不发布的名字,断言退化为恒真。

PR #3600 已按 objectui#3362 的残余清单删掉两条(NotificationActionSchema / EmbedConfigSchema,objectstack#5015 退役)。同类的还剩 37 条

测量

在 PR #3600 的分支上(已装 @objectstack/spec@17.0.0-rc.5),对列表逐条查 spec 是否仍发布该名 —— 带 Spec 前缀的条目按注释「listed under their exported alias」回退到去前缀的 spec 原名再查:

remaining entries: 82
TRULY INERT (neither alias nor spec name exists): 37

37 条清单:

来源退役 条目
objectstack#4988 / PR objectstack#5321(五个交互配置模块) DndConfigSchema DragItemSchema DropZoneSchema DragConstraintSchema DragHandleSchema DropEffectSchema FocusManagementSchema FocusTrapConfigSchema KeyboardNavigationConfigSchema KeyboardShortcutSchema ComponentAnimationSchema AnimationTriggerSchema MotionConfigSchema TransitionConfigSchema TransitionPresetSchema EasingFunctionSchema NotificationSchema NotificationConfigSchema SpecGestureConfigSchema SpecGestureTypeSchema SwipeGestureConfigSchema SwipeDirectionSchema PinchGestureConfigSchema LongPressGestureConfigSchema TouchInteractionSchema TouchTargetConfigSchema SpecOfflineConfigSchema OfflineCacheConfigSchema OfflineStrategySchema SyncConfigSchema ConflictResolutionSchema PersistStorageSchema EvictionPolicySchema
其它/待查 DensityModeSchema PerformanceConfigSchema PageTransitionSchema WcagContrastLevelSchema

复现脚本(仓根):

const ui = require('@objectstack/spec/ui');
const src = require('fs').readFileSync(
  'packages/types/src/__tests__/spec-ui-schema-reexports.test.ts', 'utf8');
const block = src.split('const DROPPED_SCHEMA_EXPORTS = [')[1].split('];')[0];
const names = [...block.matchAll(/'([A-Za-z0-9_]+)'/g)].map(m => m[1]);
const gone = names.filter(n => {
  const cands = [n];
  if (n.startsWith('Spec')) cands.push(n.slice(4));
  return !cands.some(c => c in ui);
});
console.log(gone.length, gone);

余下 45 条仍是真守卫(spec 确实还发布该名),不要整表删除。

为什么标 finding 而非缺陷

今天没有用户会碰到:测试是绿的,行为无影响,公开面无差异。代价是认知性的 —— 这份名单自称记录「objectui 刻意不再导出的 spec/ui 校验器」,读者会据此以为这些 def 在上游仍然存在;而恒真的断言会稀释这份名单里那 45 条真守卫的信噪比。属于「未被行使的漂移」。

严重性交 PM triage 判定,不自评。

建议处置(供参考,非结论)

三选一:

倾向 B:一次性清干净,并且让「随 spec 退役而失效」这件事从此自曝,而不是等下一个 agent 顺手测量才发现。


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions