Repository navigation
test(ai): 单测与真实凭据隔离(预算漏洞修复) - #17
Merged
Merged
Conversation
services/ai/.env 现在持有真实 StepFun key,原有单测会意外发起真实 provider 调用(预算漏洞)。修复: - conftest autouse fixture:强制 ARRIVAL_FAKE_MODEL=1 + 清除模型凭据 env + get_settings 缓存清理——单测永不花真实预算 - assess_payload 增加 model 注入参数(_UNSET 哨兵区分未传/None), 『无适配器 → 诚实失败』分支改为直接单元测试,不受 .env 干扰 - readyz 未配置态改用注入 Settings 测试(env 删除无法模拟文件凭据) - smoke_stepfun.py 修 lint(CI 实测抓到 6 处);真实冒烟复跑确认 修复后脚本可用(中文观察输出正常) AI 服务 15 项测试全绿;本地累计真实请求 4/6(预算内),此后单测零调用。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
services/ai/.env 含真实 key 后单测会意外发起真实调用。conftest 强制离线适配器 + 缓存清理;无适配器分支改直测;冒烟脚本 lint 修复并复跑验证。