Repository navigation
refactor!: remove the generated ProviderName types - #246
Conversation
Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0eb91-5e79-775e-975e-b85e2ac49ab6 (cherry picked from commit 7f68ac3)
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
left a comment
There was a problem hiding this comment.
评审结论:需小改后可合并(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" 的声明。
建议(非阻塞):
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的惯例补"后续变更"注记;- 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
left a comment
There was a problem hiding this comment.
Request Changes —— 合并前需完成(详细核验见上一条评审):
- 删除
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
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
Generated by Claude Code |
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
Requested by li
Summary
Before: the repo ships a generated
ProviderNamestring-literal union (Rust, Node and the other bindings), produced byscripts/gen_provider_names.pyand checked for drift in CI. The list duplicates the provider registry and goes stale whenever a provider is added.After:
ProviderNameand its generator are removed. Provider names come from the registry at runtime (provider_names()), and the drift check is gone from CI andscripts/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
Checklist
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspassescargo test --workspacepasses (cassette playback — no network/keys)README.md,docs/,rfc/,bindings/README.md)Notes for reviewers
master; first in the merge order. Split out of [1/8] ([1/8] chore: CI on every PR and test fixture cleanup #249).ProviderNametype; the CHANGELOG entry and ROADMAP note say so.scripts/local-ci.shandscripts/gen_ts_types.py.ProviderName.tsis deleted too. Bindings get the provider list from thepackagesof the [14/14] feat!: ops layer, C ABI and bindings #265 manifest, generated from the same registry asprovider.create.