# liteflow-bug-demo
**Repository Path**: sopping/liteflow-bug-demo
## Basic Information
- **Project Name**: liteflow-bug-demo
- **Description**: liteflow的bug复现demo
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-11-20
- **Last Updated**: 2025-11-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 总结
1. 文件模式下,不同chain的定义顺序,会导致部分chain的bind数据获取异常
2. db模式下,加载顺序未知、部分chain修改时,更加剧导致bind数据获取异常
# 复现步骤
1. 启动服务
2. 调用`/api/run`
3. 查看返回值中各个node的`bind`数据
4. db模式可以通过`/api/refresh`,触发单个chain的重新load,然后继续调用`/api/run`接口查看效果
## 文件模式
三个flow文件的各个chain内流程编排是一致的,重点关注`flow1_chainA`的位置:
- flow1.xml:`flow1_chainA` 在`flow1_chain*`的后面
- flow2.xml:`flow2_chainA` 在`flow2_chain*`的中间
- flow3.xml:`flow3_chainA` 在`flow3_chain*`的前面
| chain | node | 预期 | flow1 | flow2 | flow3 |
|:-------|:------|:--------------------|:---------|---------------------|:-----------------|
| chain1 | nodeA | `direct_bind` | ❌ `null` | ❌ `expression_bind` | ✅ |
| chain1 | nodeB | `direct_bind` | ✅ | ✅ | ✅ |
| chain1 | nodeC | `chainC_inner_bind` | ✅ | ✅ | ✅ |
| chain2 | nodeA | `expression_bind` | ❌ `null` | ✅ | ❌`direct_bind` |
| chain2 | nodeB | `expression_bind` | ✅ | ✅ | ✅ |
| chain2 | nodeC | `chainC_inner_bind` | ✅ | ✅ | ✅ |
| chain3 | nodeA | `chain_bind` | ❌ `null` | ✅ | ❌`direct_bind` |
| chain3 | nodeB | `expression_bind` | ✅ | ✅ | ✅ |
### flow1.xml
```xml
THEN(
flow1_chainA.bind("source", "direct_bind"),
nodeB.bind("source", "direct_bind"),
flow1_chainC_inner_bind.bind("source", "direct_bind")
)
.bind("source", "expression_bind");
THEN(
flow1_chainA,
nodeB,
flow1_chainC_inner_bind
)
.bind("source", "expression_bind")
THEN(
flow1_chainA.bind("source", "chain_bind"),
nodeB
)
.bind("source", "expression_bind")
THEN(nodeA);
THEN(nodeC).bind("source", "chainC_inner_bind");
```
### flow2.xml
```xml
THEN(
flow2_chainA.bind("source", "direct_bind"),
nodeB.bind("source", "direct_bind"),
flow2_chainC_inner_bind.bind("source", "direct_bind")
)
.bind("source", "expression_bind");
THEN(nodeA);
THEN(
flow2_chainA,
nodeB,
flow2_chainC_inner_bind
)
.bind("source", "expression_bind")
THEN(
flow2_chainA.bind("source", "chain_bind"),
nodeB
)
.bind("source", "expression_bind")
THEN(nodeC).bind("source", "chainC_inner_bind");
```
### flow3.xml
```xml
THEN(nodeA);
THEN(
flow3_chainA.bind("source", "direct_bind"),
nodeB.bind("source", "direct_bind"),
flow3_chainC_inner_bind.bind("source", "direct_bind")
)
.bind("source", "expression_bind");
THEN(
flow3_chainA,
nodeB,
flow3_chainC_inner_bind
)
.bind("source", "expression_bind")
THEN(
flow3_chainA.bind("source", "chain_bind"),
nodeB
)
.bind("source", "expression_bind")
THEN(nodeC).bind("source", "chainC_inner_bind");
```
## db模式
由于db模式中的chain加载顺序更加不可控,所以结果也是千奇百怪;再叠加部分chain的refresh,会是结果更加不可预测,这里就不放结果了