wangdl
f1eb99b6fa
fix(quiz): complete cross-platform attempt and question type contract
...
Deploy API Server / build-and-unit (push) Failing after 42s
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
- Add attempt lifecycle with per-attempt answer visibility (#336 )
- Add atomic submission with updateMany CAS + $transaction (#337 )
- Add iOS attempt-based question loading + local answer cache (#338 )
- Freeze choice/fill/judge cross-platform contract with fill grading (#339 )
- Add per-question-type learning analysis accuracyByQuestionType (#340 )
- Add GATE E2E test suite with 17 scenarios (#341 )
- CLEANUP-01: Remove illegal type → choice silent degradation
- CLEANUP-02: Integrate QuizQuestionType enum into iOS quiz views
- CLEANUP-03: Test verification, git delivery, targeted gate review
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-24 19:55:05 +08:00
wangdl
06a0e21bbf
feat(M-AI-08-04): learning analysis validator + engine integration
...
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
- Schema validation: strengths/weaknesses/trends/risks/recommendations limits
- Evidence validation: sourceType enum, metricKey required
- Business validation: insufficientData confidence cap, evidence-required conclusions
- Content safety: medical diagnosis, personality judgment, markdown code blocks
- Engine: validate after executor in learning_analysis dispatch
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 21:43:15 +08:00
wangdl
1bb131a1bc
feat(M-AI-08-03): learning analysis prompt + schema + executor + engine dispatch
...
Deploy API Server / build-and-unit (push) Failing after 27s
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
Resolves A1/A2: learning-analysis prompt and Zod output schema created.
- Prompt: 6 analysis dimensions, evidence-required, no medical diagnosis
- Schema: strengths/weaknesses/trends/risks/recommendations with evidenceRefs
- Executor: AiGateway only, constructs user message from snapshot metrics
- Engine dispatch for learning_analysis job type
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 21:41:25 +08:00
wangdl
d368f1a97f
feat(M-AI-07-03): quiz generation Executor + Validator + prompt/schema
...
Deploy API Server / build-and-unit (push) Successful in 37s
Deploy API Server / backward-compat (push) Has been cancelled
Deploy API Server / deploy (push) Has been cancelled
Deploy API Server / current-integration (push) Has been cancelled
Resolves A1/A2: bring quiz prompt + output schema in-house from Runtime.
- quiz-generation.prompt.ts: system prompt with question design principles
- quiz-generation.schema.ts: Zod schema (choice/fill/judge types)
- Registered in PromptTemplateService with key 'quiz-generation' v1.0.0
- Executor: AiGateway call with knowledge items + generation params
- Validator: per-type validation (choice options/index, judge true/false)
- Engine dispatch for quiz_generation job type
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 20:40:12 +08:00
wangdl
f1e529b99e
feat: M-AI-06 Feynman ReviewCard Child Job 与可靠生成
...
Deploy API Server / build-and-unit (push) Failing after 26s
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
完成 M-AI-06 全部 7 个 Issue:
- 01: 审计冻结契约 (docs/architecture/m-ai-06-review-card-child-job-contract.md)
- 02: AiJobCreationService.createInTransaction(tx, input)
- 03: ReviewCard Generation Job Definition + Snapshot Builder
- 04: ReviewCard Generation Executor + 输出验证 Validator
- 05: ReviewCard Generation Projector + 卡片幂等 + Engine 接入
- 06: FeynmanProjector 接入 FEYNMAN_REVIEW_CARD_MODE Feature Flag
- 07: E2E 测试 (test/m-ai-06-review-card-child.e2e-spec.ts)
核心变更:
- 新增 10 个文件, 修改 7 个文件
- 新增 createInTransaction() 外部事务支持
- 新增 review_card_generation Job Type (ai-background / cheap tier)
- FeynmanProjector 根据 Feature Flag 路由 child_job / legacy_event
- Projector 入口幂等 + P2002 回退双重保障
- 测试: 单元 482 passed, E2E 待 CI 执行
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 19:27:14 +08:00
wangdl
8987598eb8
feat(M-AI-05): track Feynman unified engine migration implementation
...
23 files (+4676/-10):
- Contract: m-ai-05-feynman-migration-contract.md (737 lines)
- Gate audit: m-ai-05-gate-audit.md (318 lines)
- Job Definition + Snapshot Builder + Registration
- Executor + BusinessValidator + ReferenceValidator
- Projector (atomic transaction + 3-layer idempotency)
- ExecutionRouter (FeatureFlag + idempotencyKey)
- ObservabilityService (structured logging + counters)
- Engine: feynman_evaluation execution branch
- AiJobCreationService: feynman_evaluation safety branch
- Controller/Module: Router injection
- CI: path detection for m-ai-05
- E2E: 8 HTTP-layer scenarios (14 total)
- Unit tests: 104 new tests (5 spec files)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 17:44:58 +08:00
wangdl
f8bd950f1a
fix(M-AI-04-GATE-FIX-02): Worker AiJobModule, Projector observability, E2E fail-closed
...
Deploy API Server / build-and-unit (push) Successful in 35s
Deploy API Server / backward-compat (push) Has been cancelled
Deploy API Server / deploy (push) Has been cancelled
Deploy API Server / current-integration (push) Has been cancelled
P1-01: WorkerModule imports AiJobModule → AI_JOB_EXECUTION_ENGINE resolved
→ AiInteractiveJobWorker can execute Unified Jobs (not silently skip)
P1-02: Engine PROJECT phase wrapped in try-catch → incrementProjectorFailed
on ActiveRecall projector errors (independent of executor failures)
P2-01: E2E beforeAll fail() → throw new Error() → no ReferenceError risk
Observability coverage after fix:
- Creation: incrementUnifiedRequests, logRequest, logJobCreated, logJobCreateFailed ✅
- Execute success: incrementUnifiedExecuteSuccess, logExecutionCompleted ✅
- Execute failure: incrementUnifiedExecuteFailed, incrementUnifiedRetry, logExecutionFailed ✅
- Projector failure: incrementProjectorFailed ✅ (NEW)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 15:29:33 +08:00
wangdl
0ec58669dd
feat(M-AI-04): Active Recall 端到端迁移至统一 Job Engine
...
Deploy API Server / build-and-unit (push) Successful in 37s
Deploy API Server / current-integration (push) Failing after 1m35s
Deploy API Server / backward-compat (push) Successful in 17s
Deploy API Server / deploy (push) Has been skipped
M-AI-04-01: 审计并冻结迁移契约 (文档)
M-AI-04-02: 注册 JobDefinition + SnapshotBuilder (28 tests)
M-AI-04-03: Executor + BusinessValidator + ReferenceValidator (31 tests)
M-AI-04-04: Projector + Artifact + 幂等写入 (19 tests)
M-AI-04-05: 入口集成 (Router + CreationService + Engine + Executor)
M-AI-04-06: 状态兼容 + 结构化日志 + 指标计数器 (255 tests)
M-AI-04-07: 真实业务 E2E + CI 触发 + FeatureFlag 受控切换 (11 tests)
P0 修复:
- 跨用户 question 所有权校验 (active-recall.service.ts)
- E2E infra 不可用时 HARD FAIL (fail() 替代静默 skip)
添加文件:
- docs/architecture/m-ai-04-active-recall-migration-contract.md
- 12 个 ai-job 模块文件 (Definition/Snapshot/Executor/Validator/Projector/Router/Observability)
- test/m-ai-04-active-recall.e2e-spec.ts + setup
修改文件:
- active-recall.service.ts, active-recall.module.ts
- ai-job-creation.service.ts, ai-job-execution-engine.ts, ai-job.module.ts
- .gitea/workflows/deploy.yml (CI 变更检测)
- test/jest-e2e.json (setupFiles + globals)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 14:55:33 +08:00
wangdl
4cfcb7afe5
feat: M-AI-03 Result Projector 与 Artifact 原子提交框架
...
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
- result-projector.interface.ts: ResultProjector 接口冻结(ADR-003 §6.1)
project(tx, context) → ArtifactReference[]
- synthetic-result-projector.ts: 测试用 Synthetic Projector
幂等:已有 Artifact 时直接返回
- projection-executor.service.ts: ProjectionExecutor
事务内:projector.project(tx) + markSucceeded(tx) 原子提交
幂等检查:Job 已终态 → 跳过
NestJS multi-provider 注入 RESULT_PROJECTORS
- ai-job-execution-engine.ts: PROJECT 阶段改为调用 ProjectionExecutor
- ai-job.module.ts: 注册 ProjectionExecutor + SyntheticResultProjector
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 09:49:25 +08:00
wangdl
aa1ce45d80
fix: N1-N3 — crypto 顶层导入 + 移除冗余 AbortController + _def 重命名
...
Deploy API Server / build-and-unit (push) Failing after 27s
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
- N1: require('crypto') 内联 → import * as crypto 顶层导入
- N2: 移除 Engine 内未连接的 AbortController(timeout 委托给 AiGatewayService)
- N3: writeUsageLog 的 _def 参数 → definition
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 18:44:32 +08:00
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
d82ae8ba71
feat: M-AI-03 统一 AiJob Worker Execution Engine
...
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
- AiJobExecutionEngineImpl: 完整 5 阶段管线
PREPARE: read Job → terminal check → cancel check → Registry.get → CAS lockJob
RESOLVE: load Snapshot → schemaVersion check → AbortController timeout
EXECUTE: AiGatewayService.generate() (不直接导入 Provider SDK)
PROJECT: write validatedOutput + outputHash (#292 替换为 Projector)
COMPLETE: usageLog → markSucceeded
- 错误分类: classifyError() — 7 种错误码, retryable/permanent 分流
provider_rate_limited/timeout/unavailable → retryable → 抛给 BullMQ
schema/business/reference validation → permanent → markFailed
cancelled → markCancelled (3 个检查点: 执行前/Provider前/Projector前)
- Usage logging: 每次 Provider 调用写 AiUsageLog (jobId/attemptNo/credentialMode/token)
- AiJobModule: 使用 AI_JOB_EXECUTION_ENGINE token 注册,替换 #288 的 no-op
- 10 个单元测试: 全链路成功/终态跳过/取消(2)/错误分类(3)/锁冲突/Schema不兼容/UsageLog
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 18:30:02 +08:00