Skip to content

fix(deploy): 完善流量录制持久化 - #277

Merged
g1331 merged 2 commits into
masterfrom
fix/traffic-recording-persistence
Aug 16, 2026
Merged

fix(deploy): 完善流量录制持久化#277
g1331 merged 2 commits into
masterfrom
fix/traffic-recording-persistence

Conversation

@g1331

@g1331 g1331 commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

将生产环境的流量录制 fixture 默认写入 /app/data/traffic-recordings,并通过 autorouter-data named volume 保留容器重建与版本升级后的录制文件。同时修正过期录制清理在文件竞态消失时的幂等计数语义。

Related Issue

无现成 Issue;本 PR 对应分支 fix/traffic-recording-persistence 的部署持久化意图。

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (code improvement without changing functionality)
  • Tests (adding or updating tests)
  • Build/CI (changes to build system or CI configuration)

Changes

  • 将 Compose 生产默认录制目录切换到持久化应用数据卷。
  • 让 entrypoint 在迁移和启动前修复挂载卷权限,应用仍以 nextjs 用户运行。
  • 补充旧 tests/fixtures 部署的备份、路径迁移和升级说明。
  • 修正清理任务:文件在数据库索引删除后因竞态返回 ENOENT 时按幂等成功计数,不恢复可能已被其他清理任务删除的索引。
  • 增加部署配置与清理竞态回归测试。

Test Plan

  • Local focused tests pass (pnpm test:run tests/unit/services/traffic-recording-service.test.ts tests/unit/deployment/traffic-recording-persistence.test.ts)
  • Type check passes (pnpm exec tsc --noEmit)
  • Lint passes (pnpm lint)
  • Manual Docker container/volume recreation smoke (Docker CLI unavailable in the local environment; to be covered by CI or a Docker-capable reviewer)

Checklist

  • Code follows the project's coding standards
  • Tests have been added where necessary
  • Documentation has been updated (if applicable)
  • Changes do not introduce security vulnerabilities
  • Commit messages follow conventions

Additional Notes

本地 pre-commit hooks(Prettier、ESLint、TypeScript)均通过;pnpm docs:build 通过。旧部署必须在重建容器前按文档完成 fixture 迁移,否则旧容器可写层中的文件无法自动恢复。

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.62500% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.44%. Comparing base (16faa95) to head (4f13f03).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
+ Coverage   72.24%   72.44%   +0.20%     
==========================================
  Files         244      244              
  Lines       14416    14442      +26     
  Branches     4810     4817       +7     
==========================================
+ Hits        10415    10463      +48     
+ Misses       2618     2595      -23     
- Partials     1383     1384       +1     
Flag Coverage Δ
verify 72.44% <90.62%> (+0.20%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@g1331
g1331 merged commit ad2ff9d into master Aug 16, 2026
14 checks passed
@g1331
g1331 deleted the fix/traffic-recording-persistence branch August 16, 2026 15:47
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