Files
nexus/wiki/concepts/n8n-Workflow-Standard.md
2026-05-03 05:42:12 +08:00

63 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "n8n Workflow Standard"
type: concept
tags: [n8n, workflow, automation, reliability, standard]
sources: [automation-governance-architect]
last_updated: 2026-05-01
---
# n8n Workflow Standard
n8n 生产级工作流十步标准,所有节点必须遵循该结构,禁止节点失控扩散。
## 命名规范
遵循 `[ENV]-[SYSTEM]-[PROCESS]-[ACTION]-v[MAJOR.MINOR]` 格式,如:
- `PROD-CRM-LeadIntake-CreateRecord-v1.0`
- `TEST-DMS-DocumentArchive-Upload-v0.4`
## 十步标准(强制)
1. **Trigger**:触发器定义(定时 / Webhook / 事件)
2. **Input Validation**:输入校验
3. **Data Normalization**:数据标准化
4. **Business Logic**:业务逻辑
5. **External Actions**外部操作API 调用等)
6. **Result Validation**:结果校验
7. **Logging / Audit Trail**:日志与审计追踪
8. **Error Branch**:错误分支
9. **Fallback / Manual Recovery**:备用路径 / 人工恢复
10. **Completion / Status Writeback**:完成状态回写
## Reliability Baseline可靠性基线
每个重要工作流必须包含:
- 显式错误分支explicit error branches
- 幂等性或重复保护idempotency or duplicate protection
- 安全重试含停止条件safe retries with stop conditions
- 超时处理timeout handling
- 告警 / 通知行为alerting/notification
- 人工 fallback 路径manual fallback path
## Logging Baseline日志基线
最小日志记录:
- 工作流名称和版本
- 执行时间戳
- 源系统
- 受影响实体 ID
- 成功 / 失败状态
- 错误类型及简要原因
## Testing Baseline测试基线
生产推荐前必须完成:
- 快乐路径测试happy path test
- 无效输入测试invalid input test
- 外部依赖失败测试external dependency failure test
- 重复事件测试duplicate event test
- Fallback / 恢复测试fallback or recovery test
- 规模 / 重复合理性检查scale/repetition sanity check
## Sources
- [[automation-governance-architect]]