       (empty? filtered-errors) (/ complex 2.0)
       :else false)))
 
+(defn ancester-key-rules
+  "Returns all the key terminal ancester rules for a given type."
+  [typ']
+  (doall
+   (distinct
+    (for [typ (cons typ' (ancestor-typs typ'))
+          [ky _ [parent-type _ t] :as rule] (schema-rules :-)
+          :when (= t typ)]
+     rule))))
+
+(defn concrete-parent [typ']
+  (for [[ky _ [parent-type _ t]] (ancester-key-rules typ')]
+    t))
 
 (defn parents-for-type [typ']
-  (concat (not-empty
-           (for [[ky _ [parent-type _ typ]] (schema-rules :-)
-                 :when (= typ typ')]
-             [ky parent-type]))
-          (not-empty
-           (apply concat
-                  (for [[up-type _ typ] (schema-rules :--)
-                        :when (= typ typ')]
-                    (parents-for-type up-type))))))
+  (for [[ky _ [parent-type _ t]] (ancester-key-rules typ')]
+    [ky parent-type]))
+
+#_(with-schema
+    (index-spec
+     (spec 'Rooter {:hi (ref-schema 'A)})
+     (spec 'Rooter2 {:hi (ref-schema 'B)})
+     (or-spec 'A
+              (ref-schema 'B)
+              (ref-schema 'BB))
+     (or-spec 'B
+              (ref-schema 'C)
+              (ref-schema 'CC))
+     (or-spec 'C
+              (ref-schema 'D)
+              (ref-schema 'DD))
+     (spec 'D {:now 3}))
+    (concrete-parent 'D))
 
 #_(with-schema
   (index-spec
    (spec 'Rooter {:hi (ref-schema 'A)})
+   (spec 'Rooter2 {:hi (ref-schema 'B)})
    (or-spec 'A
             (ref-schema 'B)
             (ref-schema 'BB))

      (fetch-pred :== parent-type)
      (fetch-pred :=> parent-type)))

(defn decendent-typs [t]
  (distinct
   (apply concat
         (for [[_ _ child-type] (schema-rules [:-- t])]
           (cons child-type (decendent-typs child-type))))))

(defn ancestor-typs [t]
  (distinct

  )



;; spiking on yet another way of analyzing a configuration for errors

