Found the root cause for a few subtle bugs in our pathom graph. Is it a bug or a misunderstanding?
(def query-order-sensitive-lenient-index
(assoc
(pci/register
[(pco/resolver 'friend
{::pco/input [:person/id]
::pco/output [:person/friend]
::pco/resolve (fn [env input]
{:person/friend {:person/id (random-uuid)}})})
; This input can not be satisfied by the index
(pco/resolver 'unreachable
{::pco/input [{:person/friend [:person/name]}]
::pco/output [:person/all-friend-names]
::pco/resolve (fn [env input] "Cannot get here")})])
:com.wsscode.pathom3.error/lenient-mode? true))
; ✅ Resolves :person/friend, fails to resolve :person/all-friend-names
(p.eql/process-one
query-order-sensitive-lenient-index
{[:person/id (random-uuid)]
[:person/friend
:person/all-friend-names]})
;=>
{:person/friend {:person/id #uuid "41b460cd-9f73-4a8f-bee6-61b529d2eb22"},
:com.wsscode.pathom3.connect.runner/attribute-errors {:person/all-friend-names {:com.wsscode.pathom3.error/cause :com.wsscode.pathom3.error/attribute-unreachable}}}
; 🔴 Also fails to resolve :person/friend
(p.eql/process-one
query-order-sensitive-lenient-index
{[:person/id (random-uuid)]
[:person/all-friend-names ; Because this attribute is before :person/friend
:person/friend]})
;=>
{:com.wsscode.pathom3.connect.runner/attribute-errors {:person/all-friend-names {:com.wsscode.pathom3.error/cause :com.wsscode.pathom3.error/attribute-unreachable},
:person/friend {:com.wsscode.pathom3.error/cause :com.wsscode.pathom3.error/attribute-unreachable}}}In the second case, the attribute order in the query fails the one attribute (:person/friend) that should always succeed