   [db find args]
   (a/reduce (partial reduce-error-pair conj) [[] nil]
             (<?run db find args)))
+
+
+(defn <resolve-lookup-refs [db report]
+  (go-pair
+    (->>
+      (vec (for [[op & entity] (:entities report)]
+             (into [op] (for [field entity]
+                          (if (lookup-ref? field)
+                            (first (<? (<eavt db field))) ;; TODO improve this
+                            field)))))
+      (assoc-in report [:entities])))) ;; TODO: meta.
 
 (defonce -eid (atom (- 0x200 1)))
 

    (->> initial-report
         (preprocess db)

         (<resolve-id-literals db)
         (<?)


        (transduce conj [] initial-es))
      (assoc-in report [:entities]))))

(defn- lookup-ref? [x]
  (and (sequential? x)
       (= (count x) 2)))

(defn <?run
  "Execute the provided query on the provided DB.
   Returns a transduced channel of [result err] pairs.
