anchor.diff:                                                     ;; :default prevents "BAD KEY" errors
                                                      (:default (:attr key "a") nil)))
                                                  persona-id)
  -                                      ;; key already exists in project, update it (ugh)
  -                                      (:)
  +                                      ;; key already exists in project, update it
  +                                      (:append
  +                                        ;; filter all keys out where key.a == <persona-id>
  +                                        (:filter
  +                                          (:row "keys")
  +                                          (r:fn (k)
  +                                            (:~ (:&& (:has-fields k "a")
  +                                                     (:== (:attr k "a") persona-id)))))
  +                                        `(("a" . ,persona-id)
  +                                          ("k" . ,keydata)))
                                         ;; this is a new key, add it
                                         (:append
                                           (:row "keys")
                                           `(("a" . ,persona-id)
                                             ("k" . ,keydata))))))
  +                       ;; main update, takes sub-query above and uses it to
  +                       ;; update the projects's keys
                          (query (r:r
                                   (:update
                                     (:get (:table "projects") project-id)
  
positive.code: 
  (defafun edit-project (future) (user-id project-id project-data)
    "Edit an existing project."
    ;; first, check if the user owns the project
    (alet ((perms (get-user-project-permissions user-id project-id)))
      (if (<= 3 perms)
          (validate-project (project-data future :edit t)
  
negative.code: (defafun get-user-projects (future) (user-id get-notes)
    "Get all projects for a user, ordered by sort order."
    (alet* ((sock (db-sock))
            (query (r:r (:get-all
                            (:table "projects")
                            user-id
                            :index "user_id")))
            (cursor (r:run sock query))
            (projects (r:to-array sock cursor)))
      (if (r:cursorp cursor)
  