   "Mark attribute k as unreachable on db. Returns ::unreachable."
   [{::keys [data-bank]} k]
   (swap! data-bank update ::unreachable (fnil conj #{}) k)
-  ::unreachable)
+  {::error ::unreachable})
+
+(s/fdef unreachable
+  :args (s/cat :env (s/keys :req [::data-bank]) :k ::p.connect/attribute)
+  :ret ::error-box)
+
+(defn print-trace [{::keys [depth]
+                    :or    {depth 0}} & messages]
+  (apply println (apply str (repeat depth "  "))
+    "- " messages))
 
 (defn seek-attr
   "Try to run more resolvers to get more attributes of type `attr`."
-  [{::keys           [data-bank resolver-trace]
+  [{::keys           [data-bank resolver-trace depth]
     ::p.connect/keys [indexes]
+    :or              {depth 0}
     :as              env}
    attr]
   (let [db      @data-bank
         db-keys (set (keys db))
         {::p.connect/keys [index-oir index-resolvers]} indexes]
+    (print-trace env "seeking" attr)
     (if-let [attr-resolvers (get index-oir attr)]
-      (if-let [attr-set (->> attr-resolvers
-                             (mapcat (fn [[attrs syms]]
-                                       (let [missing (set/difference attrs db-keys)]
-                                         (for [s syms]
-                                           {:sym     s
-                                            :data    (get index-resolvers s)
-                                            :attrs   attrs
-                                            :missing missing}))))
-                             (sort-by (comp count :missing))
-                             (eduction
-                               (remove (comp (or resolver-trace #{}) :sym))
-                               (keep (fn [{:keys [sym data]}]
-                                       (if (and (test-resolver (update env ::resolver-trace (fnil conj #{}) sym) data)
-                                                (not= (get db attr) (get @data-bank attr)))
-                                         (get @data-bank attr)))))
-                             (first))]
-        attr-set
-        (unreachable env attr))
+      (or (->> attr-resolvers
+               (mapcat (fn [[attrs syms]]
+                         (let [missing (set/difference attrs db-keys)]
+                           (for [s syms]
+                             {:sym     s
+                              :data    (get index-resolvers s)
+                              :attrs   attrs
+                              :missing missing}))))
+               (sort-by (comp count :missing))
+               (eduction
+                 (remove (comp (or resolver-trace #{}) :sym))
+                 (keep (fn [{:keys [sym data]}]
+                         (print-trace env "trying to read from" sym)
+                         (test-resolver (-> env
+                                            (assoc ::depth (inc depth))
+                                            (update ::resolver-trace (fnil conj #{}) sym)) data)
+                         (when (not= (get db attr) (get @data-bank attr))
+                           (get @data-bank attr)))))
+               (reduce-first))
+          (unreachable env attr))
       (unreachable env attr))))
+
+(s/fdef seek-attr
+  :args (s/cat :env (s/keys :req [::data-bank ::p.connect/indexes]
+                            :opt [::resolver-trace])
+               :attr ::p.connect/attribute)
+  :ret (s/or :err ::error-box :inputs ::values))
 
 (defn resolve-attr
   "Find a value for an attribute."

  ([{::keys [data-bank] :as env}
    {::p.connect/keys [sym] :as resolver}
    input]
   (let [f (resolve sym)]
     (let [out (try
                 (some-> (f env input)
                         (dissoc ::p.connect/env))
                 (catch Throwable e
                   e))]
       (swap! data-bank update-in [::call-history sym] assoc input out)
       (log! env resolver {:in input :out out})
       (if (map? out)
         (swap! data-bank bank-add out)))
     env)))


  (let [db @data-bank]
    (or (get db attr)
        (if (contains? (::unreachable db) attr)
          {::error ::unreachable}
          (seek-attr env attr)))))

(defn discover-data
