[bug]: Align Graph.add_edge and validate_self collector type validation
Is there an existing issue for this problem?
- I have searched the existing issues and found no duplicate.
Install method
Manual (in-process graph test; no server installation used)
Describe your environment
- Operating system: Linux
- GPU vendor: None (CPU; not involved)
- Version number: main @ 13aff5c (in-process review reproduction)
What happened
Graph.add_edge() and Graph.validate_self() do not enforce the same collector type invariants. Some collector changes can be accepted while editing, then rejected only when the full graph is validated. Review reproductions include a collector feeding an If branch and a related Collect -> Iterate mismatch.
What you expected to happen
Define which collector and downstream type invariants must hold after each add_edge() call, and make mutation-time validation and validate_self() follow that contract without rejecting unrelated incomplete nodes.
How to reproduce the problem
- Build a graph with a collector connected to an If branch and an otherwise incomplete opposite branch.
- Add item/collection edges that produce a type mismatch through that branch.
- Compare whether add_edge() accepts the edit with whether validate_self() accepts the resulting graph.
- Repeat for the related Collect -> Iterate topology.
Additional context
This is a broader graph-editing contract question, separate from PR 343's targeted revalidation when an If branch becomes complete. Existing incomplete-node workflows must remain editable.
Source: invoke-ai/InvokeAI