cubicweb #6665455 bad sql generated from an RQL query with a variable referencing the eid [open]

E.g., in this forge, with the following query DISTINCT Any T WHERE X is T, X is Ticket, X eid E, X in_state ST, ST name "done", I get Ticket, TestExecution, Task.

done in<not specified>
closed by<not specified>