状态:规划已确认,实施顺序固定为 V50 → V55。执行时每个 Task 均采用测试 先行,并在进入下一版本前提交对应的可重复验证证据。版本顺序和增量测试范围见 V50–V55 顺序交付与增量验证计划。
目标: 在不中断现有 n8n 生产流程的前提下,建立 DataOps 自有的 AI 调度 控制面、MCP 安全网关和数据任务运行时,以 Kestra OSS 作为确定性调度引擎; 完成逐流程双跑、对账、切换和回滚验证后下线 n8n。
架构: DataOps 保存 WorkflowSpec、版本、策略、环境激活和审计;调度智能体 通过 Context MCP 获取业务上下文,通过 Scheduling MCP Gateway 执行受控复合 操作;Kestra 负责调度状态机,DataOps Runner 使用现有数据库资源池执行数据任务。
技术栈: Flask、PostgreSQL 16、Neo4j、MinIO、Kestra OSS、Kestra Python MCP Server、DeepSeek/可配置 LLM、SQLAlchemy、Docker Compose、pytest、Vue 2。
sql.query、sql.execute、python、http、condition、
parallel、subflow 和 notify。data_source_uid,不在 Kestra 或 WorkflowSpec 中保存凭据。flowchart LR
K0["K0 决策冻结与盘点"] --> A["A 引擎无关领域模型"]
K0 --> B["B Kestra 与引擎适配"]
K0 --> C["C DataOps Runner"]
K0 --> D["D Context MCP"]
A --> E["E Scheduling MCP Gateway"]
B --> E
D --> E
C --> F["F 首批数据任务节点"]
E --> G["G 调度规划智能体"]
F --> G
G --> H["H 双轨影子运行与对账"]
H --> I["I 分批切换与稳定观察"]
I --> J["J n8n 只读归档与下线"]
可以并行推进:
必须串行的门槛:
文件:
docs/architecture/ADR-002-workflow-engine.mddocs/architecture/ADR-004-ai-first-kestra-orchestration.mddocs/generated/n8n_migration_inventory.jsonscripts/inventory_n8n_workflows.pytests/test_n8n_migration_inventory.py工作项:
完成证据:
文件:
migrations/versions/20260718_60_workflow_engine_abstraction.pyapp/core/orchestration/models.pyapp/core/orchestration/spec.pyapp/core/orchestration/repository.pyapp/core/orchestration/policy.pyapp/core/data_flow/workflow_repository.pytests/core/orchestration/test_spec.pytests/core/orchestration/test_repository.pytests/core/orchestration/test_policy.py工作项:
engine_type、engine_definition_id、
engine_revision 和 deployment_metadata,回填现有记录为 n8n。n8n_workflow_id 和 n8n_workflow_name,禁止破坏性删除。workflow_schedules、workflow_runs、workflow_task_runs、
workflow_engine_bindings 和 workflow_plan_audits。完成证据:
文件:
deploy/docker/docker-compose.ymldeploy/docker/postgres/init/000-init.sqldeploy/docker/README.mddeploy/docker/kestra/application.ymldeploy/docker/kestra/mcp.env.exampletests/test_kestra_local_contract.pytests/integration/test_kestra_mcp_contract.py工作项:
ee 工具组,并由 Gateway 控制允许的工具集合。完成证据:
文件:
app/core/orchestration/engines/base.pyapp/core/orchestration/engines/n8n.pyapp/core/orchestration/engines/kestra.pyapp/core/orchestration/compilers/kestra.pyapp/core/orchestration/service.pytests/core/orchestration/test_engine_contract.pytests/core/orchestration/test_kestra_compiler.py工作项:
validate、deploy_disabled、activate、deactivate、execute、
pause、kill、replay、backfill、get_execution 和 get_logs 接口。N8nAdapter,保持迁移期行为兼容。完成证据:
文件:
app/runner/__init__.pyapp/runner/api.pyapp/runner/executor.pyapp/runner/auth.pyapp/runner/node_registry.pyapp/core/data_source/runtime.pyapp/core/data_source/manager.pydeploy/docker/runner.Dockerfiledeploy/docker/docker-compose.ymltests/runner/test_executor.pytests/integration/test_runner_datasource_pool.py工作项:
current_app 解耦为显式配置,使 Runner 可独立启动。data_source_uid、
purpose、参数和 correlation ID。sql.query 强制只读,sql.execute 需要写入策略。完成证据:
文件:
mcp-servers/dataops-context/server.pymcp-servers/dataops-context/tools/dataflows.pymcp-servers/dataops-context/tools/lineage.pymcp-servers/dataops-context/tools/datasources.pymcp-servers/dataops-context/tools/executions.pymcp-servers/dataops-context/tools/plans.pytests/mcp/test_dataops_context_mcp.py只读工具:
list_dataflowsdescribe_dataflowget_dataflow_dependenciesget_data_lineagelist_datasource_capabilitiesget_datasource_pool_healthget_execution_historyget_sla_constraintsestimate_schedule_capacity校验工具:
validate_workflow_specvalidate_schedule_plansimulate_schedulecompare_execution_results工作项:
完成证据:
文件:
mcp-servers/dataops-scheduling/server.pymcp-servers/dataops-scheduling/policy.pymcp-servers/dataops-scheduling/kestra_client.pymcp-servers/dataops-scheduling/tools/planning.pymcp-servers/dataops-scheduling/tools/lifecycle.pytests/mcp/test_scheduling_gateway.pytests/security/test_scheduling_tool_boundaries.py向智能体开放的复合工具:
create_candidate_plandeploy_disabled_versionrun_canarypromote_candidatepause_scheduleretry_failed_executionbackfill_bounded_windowrollback_to_previous_version不得直接开放:
delete flow/executionchange_status策略至少校验:
完成证据:
文件:
app/core/orchestration/agent/planner.pyapp/core/orchestration/agent/prompts.pyapp/core/orchestration/agent/schemas.pyapp/core/orchestration/agent/evaluator.pyapp/core/orchestration/agent/recovery.pytests/agent/test_planner_scenarios.pytests/agent/test_recovery_scenarios.py工作项:
固定评测场景:
完成证据:
文件:
app/core/orchestration/migration/dual_run.pyapp/core/orchestration/migration/reconciliation.pyapp/commands/migrate_n8n_workflow.pyapp/commands/reconcile_dual_run.pytests/integration/test_n8n_kestra_dual_run.pydocs/runbooks/kestra-dual-run-and-rollback.md双轨模式:
| 模式 | 正式引擎 | 影子引擎 | 写入规则 |
|---|---|---|---|
n8n_primary |
n8n | 无 | 原有行为 |
n8n_primary_kestra_shadow |
n8n | Kestra | 只读或隔离目标 |
kestra_primary_n8n_standby |
Kestra | n8n | 仅 Kestra 写正式目标 |
kestra_primary |
Kestra | 无 | n8n 只读归档 |
工作项:
完成证据:
推广批次:
每批进入条件:
每批退出条件:
只有同时满足以下条件才允许进入下线变更:
kestra_primary,不存在未处理双轨差异。下线文件:
deploy/docker/docker-compose.ymldeploy/docker/README.mdfrontend/src/router/routes.jsfrontend/src/api/dataFactory.jsapp/api/data_factory/routes.pyapp/core/data_factory/migrations/versions/<date>_retire_n8n_runtime.pydocs/runbooks/n8n-archive-and-retirement.md下线原则:
n8n_workflow_id 的删除使用后续独立迁移。| 维度 | 必验内容 |
|---|---|
| 合约 | WorkflowSpec、MCP 工具、Kestra API、Runner API、OpenAPI |
| 数据 | 行数、主键、哈希、分区、重复写、事务不确定状态 |
| 调度 | 时区、Cron、指定时间、并发、错过调度、Backfill、Replay |
| 恢复 | Pause、Kill、Restart、Resume、回滚、组件重启 |
| 安全 | RBAC、工具白名单、秘密脱敏、任务令牌、Prompt injection |
| 资源 | 连接预算、池超时、熔断、Runner 扩缩、长任务 |
| AI | 结构化输出、策略拒绝、模型降级、决策审计、场景回放 |
| 迁移 | 双轨角色、影子隔离、对账、单流程切换、n8n 回切 |
本计划不以日历日期替代完成证据,按以下版本顺序组织:
每个版本应独立形成可回滚变更;V50–V54 期间 n8n 均保持正式运行。V55 可以在 n8n Standby 状态结束阶段性交付,不把“已部署 Kestra”或“已经完成切换” 误报为“已经完成 n8n 下线”。
每个版本采用 L1 变更级、必要的 L2 边界级和 L3 场景级验证,不重复运行全量 测试。只有 V55 准备正式移除 n8n,或发生全局基础设施/公共协议变更时,才触发 一次 L4 全量验证。具体命令、退出条件和验证记录模板见 V50–V55 顺序交付与增量验证计划。