anchor.diff:    "Add a persona's key to a project's key data."
     (validate-key (keydata future)
       (aif (persona-challenge-response-valid-p persona-id challenge-response)
  -         (alet ((perms (get-user-project-permissions user-id project-id)))
  +         ;; make sure this persona has some for of access to this project
  +         (alet ((perms (get-user-project-permissions persona-id project-id)))
              (if (<= 1 perms)
                  (alet* ((sock (db-sock))
  +                       ;; this is a subquery that takes project.keys and updates
  +                       ;; it according to its existing data: if keys already
  +                       ;; contains an entry(s) for this persona, they are replaced
  +                       ;; with the new entry, otherwise the new entry is slapped
  +                       ;; onto the end of the keys array
                          (sub-query (r:r
                                       ;; if the keys array already contains {a: <persona-id>} ...
                                       (:branch (:contains
  
positive.code:                                                    ;; :default prevents "BAD KEY" errors
                                                     (:default (:attr key "a") nil)))
                                                 persona-id)
                                        ;; key already exists in project, update it (ugh)
                                        (:)
                                        ;; this is a new key, add it
                                        (:append
                                          (:row "keys")
                                          `(("a" . ,persona-id)
                                            ("k" . ,keydata))))))
                         (query (r:r
                                  (:update
                                    (:get (:table "projects") project-id)
  
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)
  