状态:实施序列已确认;必须按 V50 → V55 顺序推进。每个版本只有在本版本 增量验证通过并留下验证记录后,才能进入下一版本。
V50–V55 是 DataOps Platform 的功能交付里程碑,不是 Alembic migration
revision,也不替代 pyproject.toml 中的产品语义版本。
仓库已经存在 20260718_50_datasource_credentials.py,因此 Kestra 编排相关的
第一条数据库迁移继续使用主计划中的 20260718_60_workflow_engine_abstraction.py。
不得为了匹配 V50 名称而重命名已经存在或已经执行的迁移。
flowchart LR
V50["V50\n迁移基线与引擎无关模型"] --> V51["V51\nKestra 与引擎适配"]
V51 --> V52["V52\nDataOps Runner 与资源池"]
V52 --> V53["V53\nContext / Scheduling MCP"]
V53 --> V54["V54\nAI 调度规划闭环"]
V54 --> V55["V55\n双轨迁移、切换与有条件退役"]
统一规则:
docs/validation/kestra-v<version>.md,记录代码版本、测试命令、
结果、已知限制和是否允许进入下一版本。| 级别 | 内容 | 使用时机 |
|---|---|---|
| L1 变更级 | 新增/修改模块的单元测试、Schema 和静态检查 | 每个版本必跑 |
| L2 边界级 | 相邻模块契约、数据库迁移、MCP/API 合约 | 该版本改变边界时运行 |
| L3 场景级 | 只启动相关容器的集成或冒烟场景 | V51–V55 按范围运行 |
| L4 全量级 | 全部 Python 测试、前端构建、完整本地栈验收 | 不按版本重复执行;仅在 V55 真正下线 n8n 前执行一次 |
出现以下情况可以额外触发 L4,但必须在验证记录中说明原因:
代码格式化、文档修改或单一模块变更不得机械触发 L4。
在不改变生产执行路径的前提下,完成 n8n 资产盘点、WorkflowSpec/SchedulePlan Schema、通用引擎绑定和迁移审计模型,为后续接入 Kestra 建立稳定契约。
app/core/orchestration/ 领域模块。engine_type、engine_definition_id、engine_revision 和绑定表。engine_type='n8n',保留原有 n8n 字段。L1:
.venv/bin/python -m pytest -q \
tests/test_n8n_migration_inventory.py \
tests/core/orchestration/test_spec.py \
tests/core/orchestration/test_repository.py \
tests/core/orchestration/test_policy.py
L2:
.venv/bin/python -m pytest -q \
tests/test_database_migrations.py \
tests/test_workflow_version_schema.py \
tests/test_workflow_repository.py \
tests/test_workflow_activation.py
回滚新建表和新增字段;DataOps 恢复只读取原有 n8n 映射。不得删除或重写现有 n8n Workflow。
在本地隔离环境部署固定版本 Kestra OSS 和官方 Python MCP,完成
N8nAdapter、KestraAdapter 与确定性 Kestra 编译器;n8n 仍是唯一正式引擎。
L1/L2:
.venv/bin/python -m pytest -q \
tests/test_kestra_local_contract.py \
tests/core/orchestration/test_engine_contract.py \
tests/core/orchestration/test_kestra_compiler.py
L3 仅启动 PostgreSQL、Kestra 和 MCP:
docker compose -f deploy/docker/docker-compose.yml up -d postgres kestra kestra-mcp
.venv/bin/python -m pytest -q tests/integration/test_kestra_mcp_contract.py
停止 Kestra/MCP 容器并删除未激活的 Kestra 测试定义;n8n 保持正式执行。
把数据任务执行从 Flask 请求进程解耦到 DataOps Runner,复用现有
DataSourceConnectionManager,让 Kestra 只携带数据源 UID 和任务身份。
sql.query、sql.execute、受限 python 和 http 节点。L1/L2:
.venv/bin/python -m pytest -q \
tests/runner \
tests/core/data_source \
tests/test_datasource_api_security.py \
tests/test_datasource_pool_diagnostics.py
L3 只验证 Runner 与两个外部测试数据库:
docker compose -f deploy/docker/docker-compose.yml up -d \
postgres source-postgres source-mysql runner
.venv/bin/python -m pytest -q \
tests/integration/test_runner_datasource_pool.py \
tests/integration/test_datasource_pool_failures.py
停止 Runner 和 Kestra 测试调用;保留现有 Flask 内的数据源连接池路径,不迁移 正式任务。
建立 AI 可读的业务上下文面和可写的受控调度面,将权限、审计和危险动作限制 放在 DataOps,而不是依赖 Kestra 企业版能力。
L1/L2:
.venv/bin/python -m pytest -q \
tests/mcp/test_dataops_context_mcp.py \
tests/mcp/test_scheduling_gateway.py \
tests/security/test_scheduling_tool_boundaries.py \
tests/test_permission_matrix.py \
tests/test_system_auth.py
L3 只验证 Gateway → Kestra/MCP → 审计链路:
.venv/bin/python -m pytest -q \
tests/integration/test_kestra_mcp_contract.py \
tests/integration/test_scheduling_gateway_audit.py
撤销智能体身份的 Gateway 访问权限并停止两个 MCP 服务;Kestra 保持禁用版本, n8n 继续正式运行。
让调度智能体通过 DataOps MCP 完成“观察 → 生成候选 → 校验 → 模拟 → 禁用发布 → Canary → 推广建议 → 监控 → 恢复/回滚”的受控闭环。
L1/L2:
.venv/bin/python -m pytest -q \
tests/agent/test_planner_scenarios.py \
tests/agent/test_recovery_scenarios.py \
tests/mcp/test_scheduling_gateway.py \
tests/security/test_scheduling_tool_boundaries.py
L3 运行固定 AI 场景和只读 Canary:
.venv/bin/python -m pytest -q \
tests/integration/test_agent_kestra_canary.py \
tests/integration/test_agent_model_offline.py
禁用调度智能体和所有候选 Kestra Trigger;保留审计记录,n8n 继续正式运行。
建立结果对账、单流程角色切换和自动回滚机制,按风险批次从
n8n_primary_kestra_shadow 切换到 kestra_primary_n8n_standby;只有满足统一
退出门槛后,才进入 kestra_primary 和 n8n 运行时下线。
迁移和角色切换测试:
.venv/bin/python -m pytest -q \
tests/integration/test_n8n_kestra_dual_run.py \
tests/integration/test_workflow_reconciliation.py \
tests/integration/test_workflow_engine_cutover.py \
tests/integration/test_workflow_engine_rollback.py
每个迁移批次只运行该批流程的对账、SLA、连接预算和故障恢复场景,不重复执行 不相关业务域测试。
只有准备正式移除 n8n 运行依赖时,执行一次 L4:
.venv/bin/python -m pytest -q
npm --prefix frontend run build
docker compose -f deploy/docker/docker-compose.yml up -d --build
完整本地栈随后只执行关键验收路径:登录、数据源健康、一个只读流程、一个幂等 写流程、失败恢复、回填、回滚和 n8n 已归档不可再激活。L4 通过不代表自动批准 下线,仍需满足下述退出门槛。
若任一条件未满足,V55 可以以 kestra_primary_n8n_standby 状态完成阶段性交付,
但不得宣称 n8n 已经下线。
单流程回滚到 n8n_primary 或上一稳定 Kestra 版本。已经移除 n8n 运行容器后,
只能依据 V55 下线前归档和恢复演练执行独立恢复变更,不允许在故障现场临时重建
未知版本。
每个版本完成时创建对应验证记录:
# Kestra V5x 验证记录
- 代码版本:
- 验证日期:
- 变更范围:
- 执行的 L1/L2/L3 测试:
- 未执行的测试及原因:
- 测试结果:
- 数据迁移升级/降级结果:
- 安全与秘密检查结果:
- 已知限制:
- 回滚点:
- 结论:允许/不允许进入 V5(x+1)
验证记录必须明确列出“未执行的测试及原因”,避免把增量验证描述成全量通过。
| 交付版本 | 主计划 Task |
|---|---|
| V50 | Task 0–1 |
| V51 | Task 2–3 |
| V52 | Task 4 |
| V53 | Task 5–6 |
| V54 | Task 7 + 首批只读 Canary |
| V55 | Task 8–10 |
详细文件清单和技术边界继续以 Kestra AI-first Data Factory 双轨改造实施计划 为准;本文件是实施顺序和验证范围的执行入口。