fix(graph): reject physical queue feedback and source aliases - #32
Conversation
`queue-cycle` asked whether a terminal destination appears in the set of this graph's sources. Set membership cannot tell a loop from a chain: two paths joined through one queue — `app.in` to `app.mid` on one, `app.mid` to `app.out` on the other — make `app.mid` a terminal destination and a source, and messages pass through it once and stop. That graph is legal on master, and the refusal told it that work "would circulate for ever", which is not true of it. The check now walks the queue graph forward from the destination and asks whether it can arrive back. The case the rule is for — a one-node target whose ingress and egress are the same name — still answers yes on the first hop. It matters beyond the false 422: a rule that refuses a stored document also stops it from restarting, so a graph that has been running for months would not have come back after the next deploy. Claude-Session: https://claude.ai/code/session_012K8u7BEJyd6nDNMCQAgH3z
|
This rule is retroactive on documents that are already in the store.
#66 draws the line — a stored document is refused only for For #34 specifically this is not hypothetical: |
Problem
The graph validator only treated explicitly declared ingress queues as owned inputs. The compiled plan also contains Gate-owned interior source queues, so two unsafe physical topologies passed validation even when the logical node DAG looked acyclic:
Fix
queue-cyclevalidation problem;Notes for Alice
Normal graph-to-graph chaining remains legal: graph A may write to a queue that graph B owns as its ingress. The producer does not claim its terminal egress as a source. The new refusals only prevent multiple Gate consumers of the same physical source and feedback from a graph's terminal output into one of its own sources.
The durable-store collision check is still a read/check operation, as before; this PR strengthens which queues it checks but does not claim to solve a simultaneous cross-replica declaration race.
Verification
cargo fmt --all -- --checkcargo test --workspacecargo clippy --workspace --all-targets -- -D warnings