refactor(types)!: reclaim natural names GestureType / GestureConfig - #3600
Merged
Conversation
…3363) `@objectstack/spec` 17.0.0-rc.3 deleted the whole `ui/touch` module (objectstack#4988, PR objectstack#5321), vacating three names objectui had renamed away from in objectstack#4115 purely to avoid a collision. The inverted tripwire PR #3568 left in `page-nav-misc-spec-parity.test.ts` fired and named this card as the follow-up. Two of the three workarounds have outlived their reason and are undone: TouchGestureType -> GestureType TouchGestureConfig -> GestureConfig Old names are gone, not deprecated, following the precedent of the objectstack#4115 batch that introduced them: "an alias would preserve exactly the ambiguity being removed". The retired spec vocabulary keeps its `Spec…` prefix, which is now the only thing distinguishing the two contracts. `PWAOfflineConfig` is deliberately NOT reclaimed. The spec vacated `OfflineConfig` too, but the spec was never its only claimant: that rename was a cross-package arbitration between two objectui packages and `@object-ui/react` won it. Since #3568 declared it locally, the spec's vacancy no longer says anything about whether the name is free -- it is not. The tripwire now pins the `@object-ui/react` owner directly, so that reason cannot expire unnoticed either. Also removes two inert `DROPPED_SCHEMA_EXPORTS` entries whose spec-side names objectstack#5015 retired (#3362 residue). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3363
承接 PR #3568 留下的反向 tripwire。
@objectstack/spec17.0.0-rc.3 整删ui/touch/ui/offline(objectstack#4988,PR objectstack#5321),腾空了 objectstack#4115 当年为避让而改掉的三个名字。#3568 把page-nav-misc-spec-parity.test.ts的三行断言反转为「spec 已腾空」,并点名本单做回收。三个名字里回收了两个,第三个经实测不能回收 —— 详见下文,这是本 PR 与派单预期唯一的偏差。
回收(2/3)
TouchGestureTypeGestureTypetap/swipe-left/swipe-up…)TouchGestureConfigGestureConfigaction处理器绑定形状一字未改(成员、可选性完全一致),只是名字。
@object-ui/types声明,@object-ui/mobile再导出。spec 侧腾空已实测确认,不是从 issue 状态推断的:
旧名直接删除,不留 deprecated alias
派单让我「按仓库既往改名先例实测定」。先例找到了,而且就是引入这三个前缀名的那一批(objectstack#4115),
packages/types/CHANGELOG.md:496的迁移说明原文:该批次的 bump 是 minor(
## 17.2.0→### Minor Changes),与 AGENTS.md「破坏性变更也标 minor,绝不 major」的固定版本组约定一致,本 PR 照此办理。这条先例在本例中比一般情形更有力:这几个改名要防的歧义,本就是两个同名类型;留下
TouchGestureType与GestureType并存,等于一边宣称退役一边把「一个概念两种拼法」原样恢复。SpecGestureType/SpecGestureConfig等Spec…前缀全部保留不动 —— #3568 已写明该前缀是刻意的,如今它成了区分两套 contract 的唯一依据,useSpecGesture仍旧把一套映射到另一套。PWAOfflineConfig不回收 —— 派单前提在此处不成立spec 确实也腾空了
OfflineConfig,但spec 从来不是唯一的主张者。这个改名当年是两个 objectui 包之间的跨包仲裁,而@object-ui/react赢了。三处仓内证据:packages/react/src/hooks/useOffline.ts:104——packages/react/src/hooks/__tests__/offline-nav-performance-spec-parity.test.ts:299—— 明确称其为 "a cross-package call"。packages/types/CHANGELOG.md:498—— "@object-ui/react'suseOfflineconfig remains the spec-shapedOfflineConfig, so both concepts stay reachable under distinguishable names"。关键在于 #3568 改变了这个名字的归属方式:在此之前
@object-ui/react的OfflineConfig是从 spec 再导出的,所以 spec 侧的断言顺带覆盖了它;#3568 按 spec 退役 ledger 的指示把它本地声明了(export interface OfflineConfig,useOffline.ts:118)。于是 spec 的腾空不再能说明这个名字是否可用 —— 它不可用。强行回收的代价:
@object-ui/types与@object-ui/react会各自公开一个语义不同的OfflineConfig(前者是 service-worker 路由缓存{ defaultStrategy, routes, maxCacheSize },后者是离线数据/同步模型{ strategy, cache, sync, queueMaxSize },连大小写风格都不同 —— kebab-case vs snake_case),而这两个包是常常一起被 import 的。这正是 objectstack#4115 当初把它改走的那个歧义,也正是「让 AI 写的代码不容易出错」最怕的形状:两个同名、字段相似、都合法的类型。因此把理由从散文改成了机器校验的钉子。
page-nav-misc-spec-parity.test.ts新增一条断言:@object-ui/react仍然声明OfflineConfig。若它哪天改名或消失,该断言变红,失败信息直接告诉下一位读者「回收现在可以做了」—— 解锁信号从此指向正确的仓库,而不是指向 spec。tripwire 的处置(逐条,非批量重拼)
GestureType/GestureConfig两行OfflineConfig行@object-ui/react归属钉。TouchGestureType/TouchGestureConfig」两行PWAOfflineConfig」顺带:#3362 残余两行(objectstack#5015)
spec-ui-schema-reexports.test.ts的DROPPED_SCHEMA_EXPORTS删去NotificationActionSchema/EmbedConfigSchema。该列表是「objectui 刻意不再导出的 spec/ui zod schema」拒绝名单;objectstack#5015 / PR objectstack#5300 把这两个 def 整个退役后,spec 已不发布这两个名字,断言退化为恒真(没有东西能再导出它)。实测确认:验证
全部在共享 heavy-verify 锁下串行执行,4 GB heap cap。
git grep 'TouchGestureType|TouchGestureConfig|PWAOfflineConfig'全仓pnpm --filter types/mobile/react/core type-checkpnpm type-checkvitest run(tripwire / gesture parity / reexports)vitest run packages/types packages/mobilepnpm --filter types/mobile lintuseOfflineSync.ts,先前既有)node scripts/check-control-bytes.mjsnode scripts/check-changeset-no-major.mjsnode scripts/check-changeset-fixed.mjs消费者逐条处置
types/src/mobile.ts声明 ×2 +GestureContext.type+MobileComponentConfig.gesturestypes/src/index.ts导出块mobile/src/index.ts再导出mobile/src/useGesture.ts×2mobile/src/useSpecGesture.ts×4GestureType现在指本地类型)mobile/src/MobileProvider.tsx×3(PWAOfflineConfig)react/.../offline-nav-performance-spec-parity.test.ts:302、react/.../useOffline.ts:108提及PWAOfflineConfigCHANGELOG.md反向验证(先声明预期方向,再执行)
改名类变更没有 before-green/after-red 的通用方向,照实说明存在哪几种:
新增的
@object-ui/react归属钉 —— 预期 RED,实测 RED。 把useOffline.ts的export interface OfflineConfig改名为OfflineDataConfig:这条最要紧:新钉子的全部价值就在于它会响,且响的时候直接交出解锁指令。已还原。
旧名不得残存 —— 预期 RED,实测 RED。 在消费者里种回旧拼法(
import type { TouchGestureType as GestureType }):这同时机械证明了「不留 alias」的决定确实落实 —— 若留了 deprecated alias,这一步会是绿的。已还原。
被改写的两行 tripwire —— 诚实说明:此处不存在方向翻转。
GestureType/GestureConfig两行在 chore(deps): track the @objectstack family at 17.0.0-rc.5 and restore green #3568 之后就已经是绿的(spec 当时已腾空),本 PR 之后仍是绿的;变的是断言的含义而非判定:此前它守的是一个潜在冲突(当时没有任何包导出GestureType),现在它守的是一个实际冲突(@object-ui/types真的导出了这个名字)。制造一个「改前红」需要伪造 spec 的导出集,那只会验证测试框架而非本变更,故不做。这一点如实记录,不套模板。越界记录:发现但未修
DROPPED_SCHEMA_EXPORTS剩余 82 条里,还有 37 条与本次删掉的两条同类(spec 已不发布该名,断言恒真),绝大多数来自 objectstack#4988 那五个交互模块。已按 Prime Directive #10 另行立单(observation-class,finding,不带pm:queue),不在本 PR 修 —— 本单文件面只覆盖 #3362 残余点名的那两条。Draft —— 待远端 CI 全绿后再转 ready。
Generated by Claude Code
Generated by Claude Code