fix(core): replace removed countTokens call in lazy generator vertex test - #9893
fix(core): replace removed countTokens call in lazy generator vertex test#9893yiliang114 wants to merge 1 commit into
Conversation
|
Thanks for the PR! Template looks good ✓ Problem: observed, not theoretical. #9676 removed Direction: fully aligned — this unblocks main's E2E pipeline. No CHANGELOG signal needed for a build repair. Size: not applicable — test-only change (0 production lines; all 7 changed lines are in Approach: the scope is exactly right. The test's real assertion is the Risk: no elevated risk signals — test file only, no high-risk paths matched. Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:已观测到的真实问题,不是理论性加固。#9676 从 方向:完全对齐——修复 main 的 E2E 流水线阻塞。构建修复无需 CHANGELOG 信号。 规模:不适用——纯测试改动(0 行生产代码;全部 7 行改动都在 方案:范围恰好。测试真正的断言是 风险:无升级风险信号——仅测试文件,未命中高风险路径。 进入代码审查 🔍 — Qwen Code · qwen3.8-max Reviewed at |
Code reviewNo blockers — the fix is correct and minimal. I worked through the call chain to confirm the swapped trigger still exercises what the test asserts: CI evidenceThe deciding check is still running at the time of this pass; the table below is updated automatically once CI settles. The macOS/Windows test jobs and the CLI integration job show
Real-scenario testingN/A — test-only repair of a compile error; nothing user-visible to drive. 中文说明代码审查无阻塞问题——修复正确且最小化。 我核对了完整调用链以确认替换后的触发器仍然覆盖测试的断言目标: CI 证据本轮审查时决定性检查仍在运行;下方表格会在 CI 结束后自动更新。macOS/Windows 测试和 CLI 集成测试显示 真实场景测试N/A——纯测试文件的编译错误修复,无用户可见行为可驱动。 — Qwen Code · qwen3.8-max Reviewed at |
|
Confidence: 5/5 — textbook autofix repair: a real compile break on main, the minimal possible fix, and the call chain verified end to end. This is exactly the kind of PR the autofix loop should produce. The problem is unambiguous — One housekeeping item for whoever merges: this consolidates #9888 and #9890, but #9888 is still open and "Supersedes" won't auto-close it. Close it when this lands. 中文说明置信度:5/5 —— 教科书式的自动修复:main 上真实的编译错误、最小化的修复方案、调用链已端到端核实。 这正是 autofix 流程应该产出的 PR。问题毫无歧义——自 #9676 移除 给合并者的一个卫生事项:本 PR 收敛了 #9888 和 #9890,但 #9888 仍处于打开状态,"Supersedes" 不会自动关闭它——合并时请一并关闭。 — Qwen Code · qwen3.8-max Reviewed at |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
What this PR does
Replaces the removed
countTokenscall in the lazy-generator Vertex test withembedContent, the simplest surviving pass-through method on theContentGeneratorinterface. The test's actual assertion is theGoogleGenAIconstructor shape (vertexai: true, apiKey: undefined);countTokenswas only the trigger forcing lazy provider creation. The mock is swapped alongside the call (models.embedContentresolving{ embeddings: [] }).Why it's needed
#9676 removed
countTokensfrom theContentGeneratorinterface and the provider implementations, but this test survived still calling it. The result broketsc --buildinpackages/core(TS2339 at contentGenerator.test.ts:776), which fails the build step of every E2E shard — run 32709027390 failed all 8 shards at build, tracked by #9889. This is the same one-line repair as #9888 and #9890 (identical diffs); this PR consolidates the fix so there is one repair to merge.Reviewer Test Plan
How to verify
Run the exact step that failed in CI, now green:
cd packages/core && npx tsc --buildexits 0. Run the touched test file:npx vitest run src/core/contentGenerator.test.ts— 27/27 passing locally, including the changedbuilds the client in Vertex mode from the auth type alonetest.Evidence (Before & After)
N/A — test-only repair of a compile error, no user-visible change. Before:
src/core/contentGenerator.test.ts(776,21): error TS2339: Property 'countTokens' does not exist on type 'ContentGenerator'fromtsc --build(run 32709027390). After:tsc --buildexit 0, 27/27 tests passing.Tested on
Environment (optional)
Local Linux, Node v22,
npx tsc --buildandnpx vitest runinpackages/core; no sandbox.Risk & Scope
Linked Issues
Fixes #9889. Supersedes #9888 and #9890 (identical one-line repair; consolidating to a single PR).
中文说明
#9676 从
ContentGenerator接口移除了countTokens,但 contentGenerator.test.ts:776 的 Vertex 懒加载测试仍用它当触发器,导致tsc --build编译失败(TS2339),run 32709027390 全部 8 个 E2E shard 在构建阶段失败(#9889 跟踪)。本 PR 把触发器换成接口上仍存在的embedContent(mock 同步替换),测试断言本身(GoogleGenAI 构造参数)不变。与 #9888、#9890 是同一处单行修复,本 PR 用于收敛为单一修复。本地验证:tsc --build通过、该测试文件 27/27 通过。