Skip to content

fix(ci): 等待部署 smoke 请求结算 - #286

Merged
g1331 merged 1 commit into
masterfrom
fix/deploy-smoke-cleanup-race
Aug 21, 2026
Merged

fix(ci): 等待部署 smoke 请求结算#286
g1331 merged 1 commit into
masterfrom
fix/deploy-smoke-cleanup-race

Conversation

@g1331

@g1331 g1331 commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

修复 Personal Deploy 的 smoke 验证在请求返回后立即删除测试 upstream,导致异步 billing snapshot 写入触发 upstream 外键错误的问题。

Related Issue

无。

Type of Change

  • Bug fix
  • Build/CI
  • Tests / validation
  • Breaking change

Root Cause

代理请求返回并不代表 request log 与 billing snapshot 已经完成异步结算。原 smoke 脚本在收到 completion 与 stream 响应后直接进入 finally,删除测试 upstream;随后 billing snapshot 写入使用已删除的 upstream_id,触发外键错误。

Changes

  • 在 cleanup 前通过 Admin Logs API 按 smoke API Key 查询两条请求。
  • 轮询直到两条日志都具有终态 status_codebilling_status 字段已经出现,最多等待 30 秒,每 250ms 重试。
  • 超时抛错使 smoke 验证失败;finally 仍执行 API Key、upstream 和 mock server 的 best-effort cleanup。
  • 未修改生产代理逻辑、数据库 schema 或公共 API。

Test Plan

  • pnpm exec prettier --check .github/workflows/deploy-personal.yml:通过。
  • git diff --check:通过。
  • PR CI 将运行 actionlint、Quality、Production Build、Migration Consistency、Proxy Stability、Playwright E2E 与 Verify Status。

Additional Notes

该修复只改变部署 smoke 的资源生命周期等待边界,不改变正常请求行为。

@g1331
g1331 merged commit b0d463d into master Aug 21, 2026
12 checks passed
@g1331
g1331 deleted the fix/deploy-smoke-cleanup-race branch August 21, 2026 14:01
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