feat(spec)!: 移除 ./ui 的 HttpMethod 导出 —— C14 双源清账,5 值子集用既有名 HttpMethodType (#4691) - #4727
Merged
Merged
Conversation
…ethodType` (#4691) `HttpMethod` 曾由三个入口导出但指向两个不同声明:`./shared`/`./api` 是 7 值 z.enum(含 HEAD/OPTIONS),`./ui` 是 `z.infer<typeof HttpMethodSchema>`(5 值 UI 子集)。同名异型,拿到哪个取决于 import 路径(#4411 陷阱),且两侧取值 集合不同,不能像 C11(#4688)那样用 re-export 收敛 —— 那会把 `./ui` 的类型 放宽到 7 值,而 `HttpRequestSchema.method` 运行时仍只接受 5 值,类型开始对 运行时说谎。 处置:删除 `./ui` 的 `HttpMethod` 导出(名字只剩 `./shared`+`./api` 的 7 值 那一个声明),并从 `./ui` re-export 既有的 5 值类型名 `HttpMethodType` (shared/http.zod.ts 的同一声明,零形状变化),迁移是同入口内的一次改名。 `./shared` 的 7 值声明与 `HttpMethodSchema` 的 5 值语义一字未动。 - dual-source-exports.baseline.json:删 `HttpMethod` 行(14 → 13, #4535 v17 双源账最后一条) - api-surface.json:`./ui` 一行对换(- HttpMethod (type) / + HttpMethodType (type)) - docs-import-surface.baseline.json +1 行、references/ui/http.mdx:生成器产出 - pin(view.test.ts [#4691]):compiler-API 断言 `./ui` 无 `HttpMethod`、 值域 7/5 双向 pin、`HttpRequestSchema.parse({method:'HEAD'})` 拒绝 pin; 全部 sabotage 实证 - changeset:@objectstack/spec major(移除已发布导出名),含 FROM → TO 已知外部消费者:objectui packages/types(type-only 一行),迁移单 objectui#3235;objectstack / cloud 两仓零消费者(实测)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176qgxgCXTJCUv4YFLtusP9
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 107 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
August 3, 2026 00:04
os-zhuang
enabled auto-merge
August 3, 2026 00:04
5 tasks
21 tasks
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 #4691
spec 双源清账 C14(#4535 v17 账最后一条):消除
HttpMethod双源。本单为停摆重派收尾——首个实施 agent 留下完整未提交、未验证的实现,本次逐项独立复核后补全交付;复核结论在文末「复核记录」。双源消除:前后对照
./sharedHttpMethod(7 值 const+type,含HEAD/OPTIONS)、HttpMethodSchema(5 值 zod)、HttpMethodType(5 值 type)./api./shared的 7 值HttpMethod./uiexport type HttpMethod = z.infer< typeof HttpMethodSchema >(5 值独立声明,与./shared同名异型 —— #4411 陷阱,且两侧取值集合不同)HttpMethod;新增 re-export 既有的HttpMethodType(shared/http.zod.ts同一声明,零形状变化)为什么不是 re-export 路线(C11 #4688 的做法,本簇不适用):把
./shared的HttpMethodre-export 进./ui会把该入口类型从 5 值悄悄放宽到 7 值,而HttpRequestSchema.method运行时仍只接受 5 值 ——method: 'HEAD'通过编译、.parse()抛错,类型对运行时说谎。实现走「删名字」:5 值类型保留它在./shared里的诚实名字HttpMethodType,并从./ui原地可得(编译器 "did you mean" 指向同一入口的正确名字,而不是引诱换路径拿到 7 值那个)。复核确认:
shared/http.zod.ts与 main 逐字节相同(diff 零接触)—— 7 值声明原样、HttpMethodSchema仍 5 值,无人「顺手统一」。消费者证据(三仓实测,全部本次重跑,不引用早前结论)
@objectstack/spec/ui且含HttpMethod的文件 +import * as … from '…/ui'命名空间用法view.zod.ts(实现本体)、references/ui/http.mdx(AUTO-GEN,本 PR 同步)、quick-reference.mdx:215(链接 shared/http 页,7 值侧,不受影响);examples/app-showcase的import * as ui无HttpMethod成员访问rg "HttpMethod"全仓link:,全仓无该字符串)packages/types/src/objectql.ts:35export type { HttpMethod } from '@objectstack/spec/ui';→packages/types/src/index.ts:329再导出 → 仓内下游packages/core/src/adapters/ApiDataSource.ts:18(经@object-ui/types,语义就是 5 值)。依赖区间^17.0.0-rc.1,下一个 rc 将以 TS2305 显形。迁移一行、零形状变化(HttpMethodType as HttpMethod),已立单 objectstack-ai/objectui#3235(含 A/B 两案与取舍)。index.ts:932的export type * as UI无UI.HttpMethod用法;spec-subschema-parity.test.ts只比较HttpMethodSchemaconst,不受影响即:issue 风险面里「仓内为零」经复核属实;「外部消费者不可见」现在可见了一个,正是 changeset 定 major 时预定价的那类,已转为跟踪单。
基线 14 → 13
dual-source-exports.baseline.json只删HttpMethod — [./api, ./shared (type)] ≠ [./ui (type)]一行(该 ratchet 按 AGENTS.md 属 hand-edited under review,删行由 gate 的 stale-line 检查反向验证)。实跑:authorable-surface 零变化
HttpMethod是纯 TS 类型别名,不进 schema 面。pnpm --filter @objectstack/spec build(内含gen:schema,1705 schemas)后git status --porcelain输出为空(生成物零漂移);check:generated:RENAMED_DEFS(scripts/lib/renamed-defs.ts)与KNOWN_STILL_DUAL_SOURCE(connector.test.ts:794,仍为[])均未动;无 tombstone、无 ADR-0087 conversion/migration,spec-changes.json/protocol-upgrade-guide.md零变化(均在上面 8 个 gate 内)。生成物 / 表面改动合法性(逐一核对)
api-surface.json:仅./ui一行对换- HttpMethod (type)/+ HttpMethodType (type)(check:api-surface绿 = 与重建后的 dist 逐字一致)。content/docs/references/ui/http.mdx(AUTO-GEN):import 示例 type 行去掉HttpMethod(check:docs绿 = 与生成器输出逐字一致)。docs-import-surface.baseline.json:+1 行ui/HttpMethod — no type export—— 生成器按 JSON-Schema 名HttpMethod解析./ui的 type 导出失败(名字已删,HttpMethodType与 schema 名不同属预期),该 ratchet 的设计就是以基线行显式记账、diff 可见。仅此一行,可逐字解释。回归 pin(4 条语义)+ sabotage 实证
packages/spec/src/ui/view.test.ts[#4691]块(3 个 it,覆盖 4 条 pin 语义;compiler-API 形态照 PR #4689,#4642 后本仓唯一有效的类型级 pin,含防空转守卫moduleSym must resolve+./ui表面非平凡断言):./ui无HttpMethod、有HttpMethodType且源自shared/http.zod.ts;./shared/./api的HttpMethod为同一声明。HEAD∈ 7 值 ∉ 5 值。HttpMethodSchema.parse('HEAD'/'OPTIONS')抛、HttpRequestSchema.parse({url, method:'HEAD'})抛、method:'PATCH'通过(防「拒绝一切」式空转)。sabotage 矩阵(逐个改坏 → 只跑
[#4691]块 → 复原;末态git status干净):Tests 3 passed, 214 skipped✅export type HttpMethod = z.infer< typeof HttpMethodSchema >AssertionError: expected [ 'reportForm', 'viewForm', …(413) ] to not include 'HttpMethod'export type { HttpMethod } from '../shared/http.zod'HttpMethodSchema放宽 5→7 值expected [ 'DELETE', 'GET', 'HEAD', …(4) ] to deeply equal [ 'DELETE', 'GET', 'PATCH', …(2) ];parse pin:expected [Function] to throw an errorHEAD/OPTIONS)expected [ 'DELETE', 'GET', 'PATCH', …(2) ] to deeply equal [ 'DELETE', 'GET', 'HEAD', …(4) ]changeset 定级
.changeset/http-method-dual-source-c14.md,@objectstack/specmajor:移除已发布导出名,外部import type { HttpMethod } from '@objectstack/spec/ui'以 TS2305 失败(与 C11 定 patch 的情形相反——那次名字仍在)。v17 pre 窗口实测开着(.changeset/pre.jsonmode: "pre", tagrc)。changeset 含 FROM → TO、以及「不要换成./shared路径保名字」的反模式警告。零元数据迁移。验证矩阵(实跑,全部串行于共享验证锁)
pnpm --filter @objectstack/spec build(gen:schema 1705 + gen:openapi + tsup + DTS)git status空check:generated(8 gate:api-surface / docs / authorable-surface / spec-changes / upgrade-guide / skill-refs / skill-docs / react-blocks)All 8 generated artifacts are up to date.check:dual-source-exportscheck:livenesscheck:strictness-ledgercheck:empty-statecheck:variant-docscheck:exported-anycheck:skill-examples(附加check:react-declaration-parity,无 manifest 按其常规行为跳过)pnpm --filter @objectstack/spec testTest Files 294 passed (294)/Tests 7390 passed (7390)pnpm --filter @objectstack/spec typecheckpnpm typecheck --concurrency=2Tasks: 122 successful, 122 total(8m22s)复核记录(对首次实现的逐项独立结论)
HttpMethodType」,不是禁止的HttpMethodre-export(S2 另证 pin 会拦截该错案)。shared/http.zod.ts与 main 逐字节相同;HttpMethodSchema未被放宽(发现即改回——未发现)。content/docs/releases/;无新 tombstone/conversion;KNOWN_STILL_DUAL_SOURCE仍[]。🤖 Generated with Claude Code
https://claude.ai/code/session_0176qgxgCXTJCUv4YFLtusP9
Generated by Claude Code