          ::provides (-> out get-root-node ::provides)
          ::run-or   [(::root out)]}))))
 
-(defn compute-root-and [out env node]
+(defn compute-root-and
+  [out env node]
   (if (= (::root out) (::node-id node))
     out
     (compute-root-branch out (assoc env ::branch-type ::run-and) node

           ::provides provides
           ::run-and  [(::root out)]})))))

(defn create-sym-node
  [out
   {::keys                           [run-next provides input]
    :com.wsscode.pathom.connect/keys [attribute sym index-resolvers]

(defn merge-node-provides [out target-node-id {::keys [provides]}]
  (update-in out [::nodes target-node-id ::provides] merge-io provides))

(defn collapse-dynamic-nodes
  "Collapses new-node into collapse-node-id. This function is intended to be used
  to merge two dynamic nodes. When this happens, the requires and provides of both
  nodes will get merged, new-node is gonna be removed from the graph and new provides
  get propagated back."
  [{::keys [root] :as out}
   env
   new-node
   collapse-node-id]
  (-> out
      (merge-node-requires collapse-node-id new-node)
      (merge-node-provides collapse-node-id new-node)
      (merge-node-requires root new-node)
      (remove-node new-node)
      (propagate-provides {::node-id collapse-node-id})
      (simplify-branch env)))

(defn add-branch-node
  "Given a branch node is the root, this function will add the new node as part
  of that branch node. If the node is a repeating dynamic node it will cause the new node
  to be collapsed into the already existent dynamic node."
  [{::keys [root] :as out}
   {::keys [branch-type] :as env}
   {::keys [node-id]}]
  (let [node (get-node out node-id)]
    (if-let [collapse-node-id (find-dynamic-node-to-merge out env node)]
      (collapse-dynamic-nodes out env node collapse-node-id)
      (-> out
          (update-in [::nodes root branch-type] conj node-id)
          (merge-node-provides root node)
