docs(adr-0121): 声明式端点的路由归属与通道分工 —— 命名空间制 + actions/apis 按调用方分工 + type: flow 保留 (#5060) - #5064
Merged
Merged
Conversation
…ype: flow` 保留 (#5060) 维护者 2026-08-04 三项裁决的持久记录。docs-only:不改任何代码或 schema, 执行体由 #5040 的 E 系列(E7 翻转 PR 落 publish 门)实施。 D1/D2 命名空间制:`ApiEndpointSchema.path` 今天只约束首字符为斜杠,应用元数据 因此可以合法认领 `/api/v1/data/…` 或与另一个已安装包互撞。路径收紧为 `<运行前缀>/apps/<命名空间>/<子路径>`——`apps` 是平台保留的唯一切出段(已实核: domain registry 前缀集与 LEGACY_CHAIN_PREFIXES 中均无 `/apps`),命名空间段派生自 `manifest.namespace`(stack 上唯一同时 URL 安全、带实例内唯一性契约、且已作为每个 对象名前缀被强制的身份键;`App.apis` 已于 spec 17.0.0 退役并留墓碑,声明单位是 stack 不是 app)。撞内建域与跨应用互撞由此在构造上消失,#5040 设计 §1 的保留前缀 pin 清单与 spec/runtime 双端一致性测试整体作废。 D3 通道分工:调用方在平台内(会话、平台方言:UI 按钮、AI/MCP、SDK)→ actions; 调用方在平台外(第三方 webhook、合作方系统)→ apis。判据的维度是调用方在哪, 不是「做什么」——后者会退化成口味之争。 D4-D6 `type: flow` 保留,配三条纪律:判据入两侧 describe(spec 车道执行项)、 同管线红线(flow 端点纯委派 automation 服务,选错通道只是风格问题不是行为问题)、 匿名端点防呆门(`authRequired: false` 必须伴随 `rateLimit`)。签名验证明示为将来 词表候选,不预支。 替代方案按两轴收录 O1(自由路径 + 保留前缀门)与 O3(actions 全面替代 / Dataverse 模式)及否决理由。 编号取 0121:0120 已被开放 PR #5054 占用(origin/main + 开放 PR 双查)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYGdmvWP1ieZSLqvAW6uyd
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-zhuang
marked this pull request as ready for review
August 4, 2026 01:37
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 #5060
维护者 2026-08-04 三项裁决的持久记录落档。docs-only —— 不改任何代码、schema 或生成物;执行体由 #5040 的 E 系列(E7 翻转 PR 落 publish 门)实施。
编号:0121,不是预计的 0120
按验收要求以
origin/main+ 开放 PR 双查:origin/main的docs/adr/最大编号是 0119,但开放 PR #5054 已占用 0120(docs/adr/0120-unique-scope-vocabulary-and-null-safe-tenant-uniqueness.md,#4986/#5030)。故取下一空位 0121。0121 在origin/main与全部开放 PR 的改动文件中均未出现。落档内容
运行前缀 + /apps/命名空间/子路径,publish 期强制manifest.namespace),作者只自由命名子路径actions;调用方在平台外 →apistype: flow保留在ApiEndpointauthRequired: false未声明rateLimit→ publish 拒绝并附处方起草时实核过的事实(全部以
origin/main@94f7b6a为准)起草要求「命名派生源要点名,不能含糊」,以下四条是 D1/D2 的地基,逐条核过:
apps段确实可切:domain registry 的前缀集(/health/ready/data/meta/actions/mcp/ai/auth/analytics/i18n/notifications/security/keys/ui/share-links/packages/automation,见packages/runtime/src/domains/*.ts与http-dispatcher.ts)与LEGACY_CHAIN_PREFIXES(packages/runtime/src/route-ledger.ts)中均无/apps,切出即生效。apis:是ObjectStackDefinitionSchema顶层键;App.apis已于 spec 17.0.0 退役并留墓碑(packages/spec/src/ui/app.zod.ts:"Declarative endpoints belong to the stack (defineStack({ apis })), not the app shell.")。所以身份键取 stack 身份,AppSchema.name这一读法在结构上不成立。manifest.namespace(packages/spec/src/kernel/manifest.zod.ts)—— stack 上唯一同时满足「URL 安全(^[a-z][a-z0-9_]{1,19}$)/带实例内唯一性契约/已作为每个对象名前缀被强制执行(validateObjectNamespacePrefix,packages/spec/src/kernel/namespace-prefix.ts,两处执行点)」的键。manifest.id虽必填但是反向域名且 schema 上零字符集约束,不 URL 安全;同文件既有的deriveNamespaceFromPackageId说明「id → namespace」本就是既有规范化方向。path确实无归属约束:packages/spec/src/api/endpoint.zod.ts上只有z.string().regex(/^\//)。与既有 ADR 的关系(已逐份 grep 核对,无冲突)
apis:(ApiEndpoint)入站面全链路零执行:元数据装载成功、路由从未挂载、matchEndpoint全仓无实现 #4936)→ 17.x 执行器(17.x 立项:建设声明式 ApiEndpoint 执行器(挂载 + matchEndpoint + authRequired/cacheTtl/inputMapping/outputMapping 逐键接线) #5040)→ E7 翻转 PR 实施本 ADR 的 publish 门;apps/命名空间/…而非 0028 设想的裸命名空间段)—— 已在「非目标」写明;副作用:#5040 设计文档的两处收窄
D1 生效后,#5040 设计 §1 的保留前缀 pin 清单 + spec/runtime 双端一致性测试整体作废(E1/E3 面缩小),§7-8「部署前缀与声明脱钩」大幅收窄。ADR 正文把「需要一个测试来防止腐坏的机制,本身就是腐坏的机制」写成了否决 O1 的理由。
Alternatives Considered(按要求收录,各自两轴分析)
apis:(ApiEndpoint)入站面全链路零执行:元数据装载成功、路由从未挂载、matchEndpoint全仓无实现 #4936 已有裁决冲突(词表退役再重引入必然引回同一套),且把第三方 webhook 接收赶出元数据面、赶进不受 publish 门约束的手写 handler。apps段终身保留)在「后果」中如实列出。Changeset
按仓内近期 ADR PR 惯例实核后随带
.changeset/adr-0121-endpoint-routing-namespace.md:docs-only 的 ADR 变更在本仓的先例(adr-0078-status-calibration、adr-0044-revise-service-owned-note、adr-0104-attestation-adr-note等)一律是空 frontmatter(---/---)+ 正文散文 + 结尾「Documentation only; releases nothing.」,本 PR 照此形制。验收自检
docs/adr/0121-*.md,头部格式对齐 ADR-0118(状态/日期/关联/执行项/动因 bullet 列表,中文正文)apis:(ApiEndpoint)入站面全链路零执行:元数据装载成功、路由从未挂载、matchEndpoint全仓无实现 #4936 /ApiRegistry/api-registryplugin 只在packages/core/examples/里被装配,无任何真实 composition 挂载 ——ApiEndpointRegistrationSchema因此整面零执行 #4939 / 17.x 立项:建设声明式 ApiEndpoint 执行器(挂载 + matchEndpoint + authRequired/cacheTtl/inputMapping/outputMapping 逐键接线) #5040,并写明 E7 翻转 PR 落 publish 门、describe 修改属 spec 车道执行项content/docs/releases/、未改任何.zod.ts/ runtime 代码 / 生成物(diff 仅 2 个新增文件)顺带记录的域外发现
Proposed,但它已被 AGENTS.md、runtime 代码注释与多个在飞 issue 当作生效决定引用 #5063(观察类,未认领,无pm:queue):ADR-0076 状态行仍是Proposed,但它已被 AGENTS.md、packages/runtime/src/domains/actions.ts文件头与 声明式apis:(ApiEndpoint)入站面全链路零执行:元数据装载成功、路由从未挂载、matchEndpoint全仓无实现 #4936/ApiRegistry/api-registryplugin 只在packages/core/examples/里被装配,无任何真实 composition 挂载 ——ApiEndpointRegistrationSchema因此整面零执行 #4939/17.x 立项:建设声明式 ApiEndpoint 执行器(挂载 + matchEndpoint + authRequired/cacheTtl/inputMapping/outputMapping 逐键接线) #5040 当作生效决定引用 —— 与 [docs] ADR-0078 状态行仍写「Proposed/核心机制未建」——与 #4544 已落地的完整性闸门相反,需更新 #4787→docs(adr-0078): 状态行与实现对齐 —— 完整性闸门已落地,逐阶段标注 (#4787) #4919 对 ADR-0078 做过的状态行校准同形状。纯文档动作,未在本 PR 顺手做。🤖 Generated with Claude Code
https://claude.ai/code/session_01EYGdmvWP1ieZSLqvAW6uyd
Generated by Claude Code