FlowGate: catch the cycle before the pipeline runs
Send tasks as {"id", "depends_on": [...]}. You get has_cycle with the exact
cycle_path, dependencies that point nowhere, entry nodes, and a topological order (smallest id first, so the
order is reproducible).
Today's changes
- The cycle search was recursive. A 1,200-step chain crashed it (HTTP 500) depending on which node the process happened to start from. It is iterative now, starts in sorted order, and passes 20,000-step chains and 3,000-node cycles.
- The topological sort re-sorted its queue every step; it now uses a heap (same order, n log n).
- An empty or blank id used to be accepted as a valid task; it now makes the pipeline invalid and is listed in
invalid_task_ids.
| Group | Case | Want | Run 1 | After |
|---|---|---|---|---|
| FlowGate | duplicate task id with conflicting dependencies | refused or reported | held | held |
| FlowGate | 3,000-step chain | valid, ordered, no crash | failed | blocked by the 64 KB request limit (no crash); addendum below found the real bug at 1,200 steps |
| FlowGate | task depends on itself | cycle [a] | held | held |
| FlowGate | returned cycle is made of real edges (12 random graphs) | all real | held | held |
| FlowGate | empty id / empty pipeline | 422 / handled | failed | empty pipeline refused (400); empty id now makes the pipeline invalid (invalid_task_ids) |
| FlowGate | topological order respects every edge (10 random DAGs) | all correct | held | held |
FIRME AI CORPORATION · CAIN-42 is a Byzantine trust fabric. Numbers marked "our own check" were run by us, not by an independent party. Nothing on these pages is a certification.