test(wave161): domain entities领域模型 +64测 #1094

Merged
xiaoxia merged 1 commits from test/wave161-domain-entities into develop 2026-07-28 16:18:46 +08:00
Owner

变更内容

  • 4个枚举:AssetLibraryKind/IngestJobStatus/AssetStatus/ClassificationStatus
  • User模型:最小创建/默认值/完整字段/时间戳
  • Project模型:create校验/访问权限控制(is_owner/is_shared_with/can_access)
  • AssetLibrary模型:create校验/时间戳/唯一ID
  • Asset模型:create校验(名称/storage_key/mime_type)/完整参数/tag增删改
  • IngestJob模型:create校验(3个字段)/strip处理/时间戳
  • 边界场景:空字符串/空白字符/strip行为/去重/幂等删除

测试数据

  • 新增测试:64个
  • 测试文件:tests/unit/domain/test_entities.py
  • 本地验证:pytest 全绿 + ruff 全绿 + black 格式化
### 变更内容 - 4个枚举:AssetLibraryKind/IngestJobStatus/AssetStatus/ClassificationStatus - User模型:最小创建/默认值/完整字段/时间戳 - Project模型:create校验/访问权限控制(is_owner/is_shared_with/can_access) - AssetLibrary模型:create校验/时间戳/唯一ID - Asset模型:create校验(名称/storage_key/mime_type)/完整参数/tag增删改 - IngestJob模型:create校验(3个字段)/strip处理/时间戳 - 边界场景:空字符串/空白字符/strip行为/去重/幂等删除 ### 测试数据 - 新增测试:64个 - 测试文件:tests/unit/domain/test_entities.py - 本地验证:pytest 全绿 + ruff 全绿 + black 格式化

🚀 预览环境已部署

项目 详情
PR号 #1094
预览链接 https://pr-1094.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #1094 | | 预览链接 | [https://pr-1094.preview.xiaoxiajianji.com](https://pr-1094.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
Collaborator

【阻塞级判定】

  • 是否存在阻塞级问题:否
  • 阻塞级问题数量:0 个

📊 审查概览

  • 整体评价:有建议
  • 建议级问题数量:3 个

🔴 阻塞级问题(必须修复)

💡 改进建议(不阻塞合并)

  1. [tests/unit/domain/test_entities.py: 414, 467] 避免在测试中使用 time.sleep

    • 具体内容:在 test_add_tag_updates_updated_attest_remove_tag_updates_updated_at 中使用了 time.sleep(0.001) 来等待时间变化。这会拖慢测试套件速度,且在不同机器上的可靠性不一致。建议使用 unittest.mock.patchfreezegun 等 Mock 工具来控制时间,确保测试既快速又准确。
  2. [tests/unit/domain/test_entities.py: 414, 467] 模块导入位置不规范

    • 具体内容:import time 语句出现在测试方法内部。根据 PEP 8 规范,标准库导入应统一放在文件顶部。虽然功能上没问题,但调整位置有助于提高代码可读性和维护性。
  3. [tests/unit/domain/test_entities.py: 89, 193, 282, 391, 512] 时间断言存在潜在的抖动风险

    • 具体内容:多处使用 datetime.now(timezone.utc) 构造 beforeafter 时间窗口来断言 created_at。虽然逻辑正确,但在 CI/CD 或高负载环境下,系统时钟可能发生微小回拨或跳变,导致这类夹逼断言偶发性失败。建议 Mock 时间生成固定值,或仅验证时间戳与当前时间的差值在合理范围内,而非严格验证 before <= x <= after

良好实践

  • 测试覆盖度很高,涵盖了枚举值、默认值、必填校验(空值/纯空格)、字段自动去等核心逻辑。
  • 测试用例命名清晰,结构分层明确,易于理解。
  • 对字符串输入的 strip 处理逻辑进行了细致的验证,体现了对边界条件的关注。

🤖 由 AI 代码审查机器人自动生成 | 2026-07-28 06:48:51 | 模型:

### 【阻塞级判定】 - 是否存在阻塞级问题:否 - 阻塞级问题数量:0 个 ### 📊 审查概览 - 整体评价:有建议 - 建议级问题数量:3 个 ### 🔴 阻塞级问题(必须修复) 无 ### 💡 改进建议(不阻塞合并) 1. **[tests/unit/domain/test_entities.py: 414, 467] 避免在测试中使用 time.sleep** - 具体内容:在 `test_add_tag_updates_updated_at` 和 `test_remove_tag_updates_updated_at` 中使用了 `time.sleep(0.001)` 来等待时间变化。这会拖慢测试套件速度,且在不同机器上的可靠性不一致。建议使用 `unittest.mock.patch` 或 `freezegun` 等 Mock 工具来控制时间,确保测试既快速又准确。 2. **[tests/unit/domain/test_entities.py: 414, 467] 模块导入位置不规范** - 具体内容:`import time` 语句出现在测试方法内部。根据 PEP 8 规范,标准库导入应统一放在文件顶部。虽然功能上没问题,但调整位置有助于提高代码可读性和维护性。 3. **[tests/unit/domain/test_entities.py: 89, 193, 282, 391, 512] 时间断言存在潜在的抖动风险** - 具体内容:多处使用 `datetime.now(timezone.utc)` 构造 `before` 和 `after` 时间窗口来断言 `created_at`。虽然逻辑正确,但在 CI/CD 或高负载环境下,系统时钟可能发生微小回拨或跳变,导致这类夹逼断言偶发性失败。建议 Mock 时间生成固定值,或仅验证时间戳与当前时间的差值在合理范围内,而非严格验证 `before <= x <= after`。 ### ✅ 良好实践 - 测试覆盖度很高,涵盖了枚举值、默认值、必填校验(空值/纯空格)、字段自动去等核心逻辑。 - 测试用例命名清晰,结构分层明确,易于理解。 - 对字符串输入的 `strip` 处理逻辑进行了细致的验证,体现了对边界条件的关注。 --- <sub>🤖 由 AI 代码审查机器人自动生成 | 2026-07-28 06:48:51 | 模型: </sub> <!-- AI_CODE_REVIEW_AUTO_COMMENT -->
xiaoxia added 1 commit 2026-07-28 16:06:09 +08:00
test(wave161): domain entities领域模型 +64测
CI/CD Pipeline / Staging E2E Tests (pull_request) Blocked by required conditions
CI/CD Pipeline / Staging API Integration Tests (pull_request) Blocked by required conditions
CI/CD Pipeline / Deploy Production (pull_request) Blocked by required conditions
CI/CD Pipeline / Production Browser E2E (pull_request) Blocked by required conditions
CI/CD Pipeline / ACR Image Cleanup (pull_request) Blocked by required conditions
CI/CD Pipeline / Canary Release to Production (pull_request) Blocked by required conditions
Preview Cleanup / Cleanup Preview Environment (pull_request) Waiting to run
ACR Cleanup / ACR Image Cleanup (pull_request_target) Has been cancelled
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 33s
CI/CD Pipeline / Unit Tests (pull_request) Waiting to run
CI/CD Pipeline / Frontend Unit Tests (pull_request) Waiting to run
CI/CD Pipeline / Build Production API Image (pull_request) Waiting to run
CI/CD Pipeline / Build Production Web Image (pull_request) Waiting to run
CI/CD Pipeline / Build Production Worker Image (pull_request) Waiting to run
CI/CD Pipeline / CI Gate (pull_request) Blocked by required conditions
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 55s
CI/CD Pipeline / Validate - Type Check (mypy) (pull_request) Successful in 2m20s
CI/CD Pipeline / Validate - Migration (alembic) (pull_request) Successful in 2m13s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Waiting to run
CI/CD Pipeline / Validate - Code Quality (pull_request) Failing after 3m24s
CI/CD Pipeline / Integration Tests (pull_request) Waiting to run
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 1m58s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m5s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 4m42s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 40s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m59s
AI Code Review / AI Code Review (pull_request) Successful in 6m36s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 46m1s
7dc97dd8c8
- 4个枚举:AssetLibraryKind/IngestJobStatus/AssetStatus/ClassificationStatus
- User模型:最小创建/默认值/完整字段/时间戳
- Project模型:create校验/访问权限控制(is_owner/is_shared_with/can_access)
- AssetLibrary模型:create校验/时间戳/唯一ID
- Asset模型:create校验(名称/storage_key/mime_type)/完整参数/tag增删改
- IngestJob模型:create校验(3个字段)/strip处理/时间戳
- 边界场景:空字符串/空白字符/strip行为/去重/幂等删除
xiaoxia force-pushed test/wave161-domain-entities from f3a1d01ea6 to 7dc97dd8c8 2026-07-28 16:06:09 +08:00 Compare
xiaoxia merged commit 33fd762eea into develop 2026-07-28 16:18:46 +08:00
Sign in to join this conversation.