wangdl
|
cdcf056ba5
|
fix: B1 — lockJob 原子递增 attemptCount + Engine 重试解锁逻辑
Deploy API Server / build-and-unit (push) Failing after 28s
Deploy API Server / current-integration (push) Has been skipped
Deploy API Server / backward-compat (push) Has been skipped
Deploy API Server / deploy (push) Has been skipped
- lockJob updateMany 新增 attemptCount: { increment: 1 }
- Engine retryable 错误: unlockForRetry() 重置为 queued 后再抛给 BullMQ
- Engine permanent 错误: 直接 markFailed + return(不抛错,BullMQ 不重试)
- unlockForRetry: 重置 lifecycleStatus→queued + 清除 lockedBy/lockedAt/lockUntil
- 更新测试: lockJob 验证 attemptCount 递增; schema validation 验证不抛错
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-20 18:42:19 +08:00 |
|
wangdl
|
471aa2b872
|
fix: #289 检修 — TOCTOU 幂等 + promptKey 传递 + require 清理
Deploy API Server / build-and-unit (push) Failing after 29s
Deploy API Server / current-integration (push) Has been skipped
Deploy API Server / backward-compat (push) Has been skipped
Deploy API Server / deploy (push) Has been skipped
- 幂等保护从 findUnique 预检改为 P2002 catch(消除 TOCTOU 竞态窗口)
- AiJobLifecycleRepository: CreateJobInput 新增 promptKey,createJob 写入
- AiJobCreationService: 从 JobDefinition 传递 promptKey 到 Job
- computeHash: 内联 require('crypto') → 顶层 import * as crypto
- 测试更新: 幂等场景改为 P2002 冲突 → findUniqueOrThrow 返回已有 Job
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-20 18:22:39 +08:00 |
|
wangdl
|
4c736f3658
|
fix: Repository 层移除 modelProvider/modelName 硬编码默认值
Deploy API Server / build-and-unit (push) Successful in 33s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / deploy (push) Successful in 1m3s
modelProvider/modelName 默认值从 Repository 移至 Service/JobDefinition 层。
若调用方未传入,依赖 Prisma schema @default 保证列非空。
避免 AiJobService 忘记传值时静默使用错误 provider。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-20 17:22:11 +08:00 |
|
wangdl
|
38d1c4f414
|
fix: requestCancellation TOCTOU 竞态 — update 改为 updateMany CAS
Deploy API Server / build-and-unit (push) Successful in 33s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / deploy (push) Has been cancelled
Deploy API Server / backward-compat (push) Has been cancelled
- running 路径:prisma.aiJob.update() → updateMany() CAS
- CAS 失败时重读当前状态:已取消则幂等返回,已终态则抛出 JobNotCancellableError
- 新增 2 个 TOCTOU 场景测试(已变 cancelled → 幂等,已变 succeeded → 报错)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-20 17:20:15 +08:00 |
|
wangdl
|
b08d27a449
|
feat: M-AI-03 AiJob 状态机与原子状态仓储
Deploy API Server / build-and-unit (push) Successful in 33s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / deploy (push) Successful in 1m4s
- AiJobStateMachine: 5 状态(queued/running/succeeded/failed/cancelled)、
合法/非法迁移验证、终态判断、双向 Shadow Write 映射
- AiJobLifecycleRepository: 唯一 lifecycleStatus 写入入口、
CAS(条件 UPDATE WHERE lifecycleStatus IN (...))抢锁/续锁/标记成功/失败/取消、
可选 tx 参数支持 Projector 事务内调用
- requestCancellation: queued 直接取消 → cancelled、
running 设置 cancelRequestedAt 信号
- 6 个类型化错误(JobLockConflict/JobNotActive/JobAlreadyTerminal/
JobNotCancellable/JobExtendLock/IllegalStateTransition)
- 41 个单元测试全部通过
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-20 17:17:12 +08:00 |
|