Skip to content

驱动工厂仍保留 4 处未声明的 ?? 容错,应按 ADR-0087 转换层退役(#4410 收尾发现) #4456

Closed

Description

@os-zhuang

#4410 给 datasource.config 装上了 per-driver 的 zod 门禁,作者侧现在只有一种拼写。但
createDefaultDatasourceDriverFactory 里仍留着几处未声明的读取侧 ?? 回退——它们不是
契约的一部分,任何文档、表单、示例都没写过,纯粹是"读的人比较宽容"才碰巧能用:

位置 容错的拼写 契约里的键
buildSqlConnection(sqlite 分支) cfg.file / cfg.database filename
buildSqlConnection(pg 分支) cfg.connectionString url
buildSqlConnection / buildMysqlConnection cfg.user username
buildMongoUrl cfg.uri url

这正是 AGENTS.md Prime Directive #12 点名的债:"When you must tolerate an alias at all,
declare it as a conversion-layer entry (never a bare ??), so it is declared, loud, tested,
and removable on a schedule."
filters → filter、object → objectName 已经按这条路
毕业了(flow-node-crud-filter-alias 等),这四处是同一形状。

#4410 为什么没有顺手删掉。 删了会静默改变已持久化的运行时数据源的行为:一条早先通过
API 存进 sys_metadata、config 里写着 file 的记录,删回退之后会落到 :memory:——
数据位置无声改变,比现在的容错更糟。正确做法是 ADR-0087 D2 的转换条目:在加载时把旧键改写
成规范键(applyConversionsToStoredItem 会对存量数据重放整条链,#3903),然后回退就可以
真的删除,而不是继续留在 reader 里。

建议做法

  1. 加一条 datasource-config-driver-key-aliases 转换条目(含 fixture),覆盖上表四组映射;
    需要一个 mapDatasources walker(conversions/walk.ts 目前没有)。
  2. 转换落地后删除工厂里的四处 ??,并把 sqlite.zod.ts / mongo.zod.ts 里"工厂仍容忍
    存量记录"的注释一并删掉——那两段注释是专门为这个中间状态写的。
  3. spec-changes / upgrade-guide 按常规重新生成。

关联:#4410(本 issue 的来源)、#3796(同类 alias 毕业)、ADR-0087 D2、ADR-0078。

Activity

  1. added
    pm:queueReady for the PM dispatch loop
    pm:dispatchedDispatched to a dev agent by /pm-dispatch
    and removed
    pm:queueReady for the PM dispatch loop
    on Aug 2, 2026
  2. self-assigned this
    on Aug 2, 2026
  3. os-zhuang commented on Aug 2, 2026

    @os-zhuang
    ContributorAuthor

    🔒 CLAIM — pm-dispatch round 6
    branch: claude/issue-4456-datasource-key-alias-conversion
    worktree: objectstack-issue-4456
    本轮由 PM 会话派发给 os-dev agent。若另有会话已在做此题,以本 issue 更早的 CLAIM 评论为准,后到者退出。


    Generated by Claude Code

  4. os-zhuang commented on Aug 2, 2026

    @os-zhuang
    ContributorAuthor

    PM 复核:ACCEPT ✅(PR #4637,已转正并挂自动合并,CI 绿后进队列)


    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

Labels

pm:dispatchedDispatched to a dev agent by /pm-dispatch

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions