Skip to content

E5 遗漏面:端点 inputMapping / outputMapping 未实现(设计 §3.4 的 api-mapping.ts),E7 翻转前必须补 #5137

Closed

Description

@os-zhuang

事实

#5040 设计总表把 E5 行写成「执行目标 + 映射」,文件面含 api-mapping.ts(新)。但 E5 单(#5092)派发时声明的文件面只有 packages/runtime/src/endpoint-executor.ts + 测试 + changeset,PR #5136 因此只做了目标委派,没有做映射:

  • endpoint-executor.ts 把 query / body 原样送进委派调用,endpoint.inputMapping / endpoint.outputMapping 一次都没有被读取。

为什么必须在 E7(#5111)之前补

ApiEndpointSchema 声明了这两个键({source, target, transform?}[]),E7 的 publish 门按设计 §3.4 只拒绝 transform 子键,放行 source/target 形式的映射。如果翻转时 runtime 侧没有实现:

作者写了 inputMapping,publish 通过,端点跑起来,映射什么也不做 —— 「解析通过然后什么也不发生」,正是 #5040 设计开篇要消灭的中间态,也是 ADR-0049 declared≠enforced 的教科书形状。

对 AI 写元数据尤其糟:静默忽略的键不会有任何信号,错误会一直留在应用里。

建议范围(与设计 §3.4 一致,不扩权)

  1. 新纯模块 packages/runtime/src/api-mapping.ts:source/target 按点路径 get/set;inputMapping 作用于 {...query, ...body} → 目标入参;outputMapping 作用于目标结果 → 响应体;无 mapping 则原样直通(与今日 /data、/automation 行为一致)。
  2. 在 endpoint-executor.ts 的委派前 / 结果映射后各接一处(该文件届时无并行占用)。
  3. transform 不实现:全仓无「transformation function name」注册表,按设计 §3.4 由 E7 的 publish 门拒绝(带处方)。runtime 侧遇到带 transform 的条目应给结构化拒绝,不得静默忽略。
  4. 测试:点路径读写、缺失源字段的行为、query 与 body 的合并优先级、无 mapping 的直通、带 transform 的拒绝。

关联

Activity

  1. os-zhuang commented on Aug 4, 2026

    @os-zhuang
    ContributorAuthor

    PM 归并(执行器车道 session_01EYGdmvWP1ieZSLqvAW6uyd):本单即 E 系列补充单 E5c,与我稍后所立的 #5139 重复 —— 保留本单(立单在先),#5139 已关并指向此处。补充其结构化内容:


    Generated by Claude Code

  2. self-assigned this
    on Aug 4, 2026
  3. os-zhuang commented on Aug 4, 2026

    @os-zhuang
    ContributorAuthor

    认领(方案 A:实现) —— PM 会话 session_01EYGdmvWP1ieZSLqvAW6uyd(执行器车道),分支 claude/issue-5137-endpoint-mappings,R4 批与 #5093 并行派发。前置 #5129 已落 main(81e2744)。

    文件面声明(#4604,与 #5093 互斥):packages/runtime/src/api-mapping.ts(新)+ api-endpoint-step.ts(链内应用点)+ 测试 + changeset。不碰 packages/rest / http-dispatcher.ts / route-ledger.ts(#5093 的面)、endpoint-executor.ts(保持纯委派不感知映射)、packages/spec(词表冻结,映射语义以两键的 schema describe 为唯一依据)。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions