           (if (and dead-vars? (uses-dead-vars? s av-map ))
             (do (util/print-debug 1 "Pruning due to dead vars") nil)
             (let [sources-by-type (source-vars-by-type s vars deadlock? components? )]
- ;;           (println sources-by-type)
+;              (println sources-by-type)
               (if sources-by-type
                 (util/prln-debug 2
                  (util/cond-let [sources]

        [t f]
        [f t]))))


;; TODO: add assertions on precond var = effect var
;; Recall: greedy helps the most when, e.g., lots of passengers and not much room.

                              (apply concat (vals dtg))))]
        (concat
         (when (= cur-val dst-val) [#{}])
         (when (seq actions) (if pre-partition? (structural-partitions actions) [(set actions)])))))))


(comment (util/singleton? (get effect-cluster-map v)))

;; TODO: where do happy belong?
;; TODO: better choice of unhappy child?
(defn bottom-up-expand-actions [s p unhappy-children child-map prevail-map auxiliary-map possible-actions-fn]
  (let [children                (possible-children s p child-map prevail-map auxiliary-map)
        c                       (first (util/intersection (set children) (set unhappy-children)))
        _ (util/assert-is (identity c) "%s" [s p unhappy-children children (do (clojure.inspector/inspect-tree (sort-by key s)) nil)])
        actions (state/get-var s (possible-actions-var c))
        [concerned indifferent] (util/separate #(contains? (:precond-map %) p) actions)
        [happy unhappy]         (util/separate #(can-greedily-use? s % p c) concerned)
        lazy-set                (set (concat happy indifferent))]
    (assert (= :wait (state/get-var s (possible-actions-var p))))
    (when-let [cur-c (state/get-var s (child-var p))] (assert (= cur-c c)))
    (assert (seq unhappy))
    (concat
     (when (seq lazy-set)
       [(make-set-actions-action c lazy-set)])
     (for [other-c (remove #{c} children)]
       (make-set-child-action p other-c))
     (for [[p-val wanting-actions] (prune-and-group-actions s p c unhappy)
           possible-next-actions (possible-actions-fn (state/set-var s (possible-actions-var c) (set wanting-actions))
                                                      p (state/get-var s p) p-val)]
       (make-bottom-up-expand-action s p c (set wanting-actions) possible-next-actions)))))

;; NOTE: what if there are multiple actions on a var; some ready to fire, and some blocked?
;; this will be a source, but we cannot proceed.
;; need to split on this!
;; Worse, can have none greedy and ones blocked on various things.
;; Options are to split when blocking happens, always, or greedily execute just those that can.
;; TODO: think about if we should split when blocking happens
;; With part?, this is no longer an issue.
(defn greedy-fire-actions [s v possible-actions-fn]
  (let [actions-by-block (group-by #(blocking-set s % v) (state/get-var s (possible-actions-var v)))]
    (assert (or (seq (actions-by-block #{})) (> (count actions-by-block) 1)))
