   (let [st @state]
     (om-next/db->tree query (get st key) st)))
 
+;; When adding a new key, be sure to add a read-remote implementation. Returning
+;; true will pass the entire query on to the remote send function. Returning
+;; false will send nothing to the remote. Returning a modified AST will send
+;; that modified query to the remote.
+(defmethod read-remote :default [env key params]
+  (throw (js/Error. (str "No remote behavior defined in the parser for " (pr-str key) "."))))
+
 
 (def
   ^{:private true

    :user/bitbucket-authorized?})


;; :app/current-user works much like :default, but it's a bit of a special case,
;; as some of its data is never fetched by the remote, and only exists in the
;; initial app state, added from the page's renderContext. We exclude those keys
;; here so we don't try to read them remotely.
(defmethod read-remote :app/current-user
  [{:keys [ast] :as env} key params]
  (-> ast
      (assoc :query-root true)
      ;; Don't pass renderContext keys on to the remote. They're
      ;; local-only.
      (update :children
              (fn [children]
                (into []
                      (remove #(contains? render-context-keys (:key %)))
                      children)))
      recalculate-query))

;; :legacy/state reads the entire map under :legacy/state in the app state. It
;; does no db->tree massaging, because the legacy state lives in the om.core

                                              :dispatch-key (first ident)
                                              :query-root true))))))]

    ;; Only include this key in the remote query if there are any children left.
    (if (seq (:children new-ast))
      (recalculate-query new-ast)
      nil)))
