Skip to content

refactor!: remove the generated ProviderName types - #246

Merged
eric8810 merged 8 commits into
masterfrom
refactor/remove-generated-provider-name-types
Oct 17, 2026
Merged

eric8810 merged 8 commits into
masterfrom
refactor/remove-generated-provider-name-types

Conversation

@cunninghamcard-bit

@cunninghamcard-bit cunninghamcard-bit commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Requested by li

Summary

Before: the repo ships a generated ProviderName string-literal union (Rust, Node and the other bindings), produced by scripts/gen_provider_names.py and checked for drift in CI. The list duplicates the provider registry and goes stale whenever a provider is added.

After: ProviderName and its generator are removed. Provider names come from the registry at runtime (provider_names()), and the drift check is gone from CI and scripts/local-ci.sh.

This PR goes first: #247 merges it and [1/8] (#249) merges #247, so the AI SDK migration series ([1/8] to [8/8]) carries it from its first layer. Merge order: #246, #247, then the series.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • New provider
  • New / updated binding
  • Docs / RFC

Checklist

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (cassette playback — no network/keys)
  • Added or updated cassette tests / contract fixtures for behavior changes
  • Updated relevant docs (README.md, docs/, rfc/, bindings/README.md)
  • Commit messages follow Conventional Commits

Notes for reviewers

chenhaonan and others added 5 commits October 11, 2026 16:30
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit 758d0bc)
The returned impl Iterator is already must_use, so clippy's
double_must_use rejected it.

(provider.rs part of commit 8397424)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa
…e removal

- scripts/gen_providers_doc.py: the `provider_name` module no longer exists;
  the docstrings and the section-header guard now name only `provider`.
  `--check` output is unchanged.
- docs/internal/phase4-audit.md: add a follow-up note (same style as
  RFC-0020) so the historical audit no longer reads as if the generated
  ProviderName types and their drift tests still exist.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
(cherry picked from commit dfcd54f)
The A2 line said Node would keep a generated string-literal union for
completion. It does not: overlay-registered provider names can never be
part of a compile-time union, so keeping one would keep the second name
path this PR removes. Record the actual A2 scope.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
(cherry picked from commit 3e2d9fc)

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

评审结论:需小改后可合并(1 项阻塞)

与 RFC-0036 A2 方向完全一致,实现干净:provider 名统一字符串后,运行期列表由 registry 导出(provider_names(),测试锁定数量与 registry 一致)、overlay 注册名可解析、未知名报 NoSuchProvider;8 语言副本、生成器、CI 漂移门禁与文档引用全部移除,CHANGELOG 按 breaking 记录并给出迁移写法,ROADMAP 版本语义行同步修订(Node 不保留 union 的理由成立:overlay 名进不了编译期联合类型)。

阻塞项:tools/aimux-web/web/src/types/ProviderName.ts(262 行)未删除。该文件在 master 上就是零引用孤儿,本 PR 删了它的生成器 scripts/gen_provider_names.py,却把文件留着,头部仍写着 "GENERATED by scripts/gen_provider_names.py. Do not edit manually"。RFC-0036 §12.3 A2 验收要求 "Rust/各绑定/web 副本与生成入口退出"。请在本 PR 删除(一行 git rm),或显式声明依赖 #247、撤回 "independent, can merge at any time" 的声明。

建议(非阻塞):

  1. docs/quality-audit/p2:76、p4-release-v021:15/429、p6-rfc-consistency:7/68 三份历史报告仍把 gen_provider_names.py --check 描述为现行门禁,按 docs/internal/phase4-audit.md 的惯例补"后续变更"注记;
  2. node build:typed 的 rmSync(dist) 核实过与 napi 产物(包根 index.js/*.node)不冲突且能防止已删类型的残留产物进 npm 包——合理,建议在提交信息注明动机。

疑问:绑定层原先经 ProviderName 常量对象获得运行期 provider 列表,现在只有 Rust(provider_names())和 web API 满足"registry 导出"——绑定层的列表暴露是留给 ops 协议(RFC-0039 §4.1)还是有意不做?另 checklist 的 cargo test --workspace 未勾选,是否本地验证过?

评审深度:41 files 全量 stat;provider.rs/lib.rs/CHANGELOG/ROADMAP/ci.yml/local-ci.sh 等完整 diff 细读;绑定测试删除抽检(Java/Kotlin/Swift/Python);全分支 grep 残留为零。未运行 cargo/npm。

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request Changes —— 合并前需完成(详细核验见上一条评审):

  1. 删除 tools/aimux-web/web/src/types/ProviderName.ts(262 行孤儿文件,头部仍声称由已删除的 gen_provider_names.py 生成)——RFC-0036 §12.3 A2 验收要求 "Rust/各绑定/web 副本与生成入口退出";或显式声明依赖 #247 并撤回 "independent, can merge at any time"。

改完即可合并;其余为非阻塞建议(quality-audit 三份历史报告补注记、build:typed 的 rmSync 动机注明)。

…redaction (#248)

aimux-providers/src/provider.rs and lib.rs conflicted where #248 adds
`provider_api_key_env` next to this branch's `provider_names`; both are
kept and exported.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa
tools/aimux-web/web/src/types/ProviderName.ts was the eighth copy written
by scripts/gen_provider_names.py, which this branch deletes. Nothing
imports it (it is an orphan on master too), and its header still claimed
the deleted generator. RFC-0036 §12.3 A2 requires every Rust, binding
and web copy and the generator to go.

The three quality-audit reports that cite `gen_provider_names.py --check`
as a current gate get a later-change note, as docs/internal/phase4-audit.md
already has.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa
Brings in #266 (a blank key on a custom base URL is sent as an empty
key, as the AI SDK does for apiKey: '').

Resolution: no conflicts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa
cunninghamcard-bit pushed a commit that referenced this pull request Oct 16, 2026
Brings in #247 (with #246) through the layer below: ts-rs exports run
only under the ts-export feature, and the generated ProviderName types
are gone.

Resolution: aimux-core files keep this layer's code with every export
gated, including the ones this layer adds (RecordingOperation's among
them); the rest merges cleanly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa

Copy link
Copy Markdown
Contributor Author
eric 的意见 我们的处理 位置
web 控制台里还留着一份 ProviderName.ts(阻塞) 删掉了这个文件,本 PR 不再依赖 #247(ec7ab7c0) tools/aimux-web/web/src/types/ProviderName.ts(已删除)
三份历史质量报告还把生成脚本写成现行门禁 按 phase4-audit 的惯例,每份开头加一行"后续变更"说明,正文不改(ec7ab7c0) docs/quality-audit/p2-provider-abstraction-audit.md:7、p4-release-v021-head-review.md:17、p6-rfc-consistency-round3-review.md:15
build:typed 先清空 dist 的动机写进提交信息 已推送的提交信息不改写,动机在这里说明:清空 dist 是为了不让已删除类型的旧产物进 npm 包 bindings/node/package.json:43
绑定层以后从哪里拿 provider 列表 由 #265 的 manifest 提供:manifest 顶层加 packages,runtime.describe 的 capabilities 加 packages,两者和 provider.create 用同一份注册表生成,不手写常量(#265 的 560709f,已推送)。上游 ai 也没有单独的列表 API,只在 NoSuchProviderError 上带 availableProviders #265:aimux-ops/src/manifest.rs、aimux-ops/src/ops/runtime.rs
cargo test --workspace 跑过没有 跑过。合并 master 后全部 Rust 测试 4055 个通过,0 个失败 —

Generated by Claude Code

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复核通过,撤回修改请求。逐项核实:ProviderName.ts 已删除(本 PR 不再依赖 #247)✓;三份 quality-audit 报告已加"后续变更"注记 ✓;build:typed 动机已说明 ✓;绑定层 provider 列表由 #265 的 manifest packages 字段提供(560709f4,与 provider.create 同一注册表,不手写常量)——方案合理,上游也无独立列表 API ✓。批准。

@eric8810
eric8810 merged commit 4764da8 into master Oct 17, 2026
26 checks passed
eric8810 added a commit that referenced this pull request Oct 17, 2026
master 带入 #262(CI 提速,含 cargo-ndk@4.1.2 与 changes/ci-result 任务表)与 #246 的 squash;
scripts/gen_ts_types.py 冲突取本分支版本(双 crate ts-export 门控的超集),
ci.yml 自动合并将 web-typecheck 正确接进 #262 的 run-map 与 ci-result。
eric8810 added a commit that referenced this pull request Oct 17, 2026
master 带入 #262/#246/#247 的 squash;三个冲突文件取本分支版本
(ci.yml 为已调和 #262 任务表 + web-typecheck + pin 脚本测试的超集),
gen_ts_types.py 自动合并。
cunninghamcard-bit pushed a commit that referenced this pull request Oct 17, 2026
Brings in master at ec338c9 (#262, #246 and #247, each squashed into one
commit) through [7/8]. The tree is unchanged: this branch already had
all three.

Resolution: no conflicts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3WxDBWBA4ituJjXsHaEAa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants