cubicweb #3806054 Cannot get the description of syntax_tree in the shell [validation pending]

Tested with Cubicweb 3.18.3

With any instance:

$ cubicweb-ctl shell myinstance
>>> rset = rql('CWUser X')
>>> stree = rset.syntax_tree()
>>> stree.get_description()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/alain/src/cubicweb/rql/", line 259, in get_description
    return [c.get_description(mainindex, tr) for c in self.children]
  File "/home/alain/src/cubicweb/rql/", line 446, in get_description
    descr.append(term.get_description(mainindex, tr) or 'Any')
  File "/home/alain/src/cubicweb/rql/", line 841, in get_description
    return self.variable.get_description(mainindex, tr)
  File "/home/alain/src/cubicweb/rql/", line 1019, in get_description
    for rel in self.stinfo['relations']:
KeyError: 'relations'

We can deal with this error by clearing caches:

>>> del rset._syntax_tree_cache_
>>> stree = rset.syntax_tree()
>>> stree.get_description()

Note that this issue does not appear when running a cubicweb instance and requresting the csvexport view which uses the syntax tree description to fetch column names.

An interesting starting point is cubicweb.view.AnyRsetView.columns_labels.

done in3.20.0
load left0.000
closed by<not specified>