Skip to content

test(ai): 单测与真实凭据隔离(预算漏洞修复) - #17

Merged
qrx-joe merged 1 commit into
mainfrom
codex/test-isolation-offline
Sep 7, 2026
Merged

qrx-joe merged 1 commit into
mainfrom
codex/test-isolation-offline

Conversation

@qrx-joe

@qrx-joe qrx-joe commented Sep 7, 2026

Copy link
Copy Markdown
Owner

services/ai/.env 含真实 key 后单测会意外发起真实调用。conftest 强制离线适配器 + 缓存清理;无适配器分支改直测;冒烟脚本 lint 修复并复跑验证。

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(预算内),此后单测零调用。
@qrx-joe
qrx-joe merged commit 19c6573 into main Sep 7, 2026
@qrx-joe
qrx-joe deleted the codex/test-isolation-offline branch September 7, 2026 08:48
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.

1 participant