cubicweb #3010148 relation_possible predicate crashes with some ambiguous relations [validation pending]

This can be observed on the primary view of a Program with the following relations defined :

  • (Executable, version_of, Program)
  • (Version, version_of, Project)

Traceback looks like

 File "/home/fcayre/Simulagora/cubicweb/cwvreg.py", line 433, in possible_actions
   actions = rset.possible_actions(**kwargs) # cached implementation
 File "/home/fcayre/Simulagora/cubicweb/rset.py", line 104, in possible_actions
   self.req, rset=self, **kwargs)
 File "/home/fcayre/Simulagora/cubicweb/cwvreg.py", line 427, in poss_visible_objects
   key=lambda x: x.order)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 370, in possible_objects
   obj = self._select_best(objects,  *args, **kwargs)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 385, in _select_best
   objectscore = obj.__select__(obj, *args, **kwargs)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 851, in traced
   ret = selector(cls, *args, **kwargs)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 1055, in __call__
   partscore = selector(cls, *args, **kwargs)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 851, in traced
   ret = selector(cls, *args, **kwargs)
 File "/home/fcayre/Simulagora/cubicweb/predicates.py", line 239, in __call__
   return super(PartialPredicateMixIn, self).__call__(cls, *args, **kwargs)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 851, in traced
   ret = selector(cls, *args, **kwargs)
 File "/home/fcayre/Simulagora/cubicweb/predicates.py", line 954, in __call__
   return EntityPredicate.__call__(self, cls, req, **kwargs)
 File "/home/fcayre/Simulagora/logilab/common/registry.py", line 851, in traced
   ret = selector(cls, *args, **kwargs)
 File "/home/fcayre/Simulagora/cubicweb/predicates.py", line 373, in __call__
   escore = self.score(req, rset, row, col)
 File "/home/fcayre/Simulagora/cubicweb/predicates.py", line 959, in score
   return EntityPredicate.score(self, *args)
 File "/home/fcayre/Simulagora/cubicweb/predicates.py", line 388, in score
   return self.score_entity(rset.get_entity(row, col))
 File "/home/fcayre/Simulagora/cubicweb/predicates.py", line 997, in score_entity
   rschema = rschema.role_rdef(entity.e_schema, self.target_etype, self.role)
 File "/home/fcayre/Simulagora/yams/schema.py", line 908, in role_rdef
   return self.rdefs[(ttype, etype)]
KeyError: ('Version', <Program ['watches', 'name', 'modification_date', 'instrument', 'is', 'cw_source', 'created_by', 'creation_date', 'is_instance_of', 'cwuri', 'eid', 'codetype', 'owned_by', 'monitors', 'identity', 'code_repo'] - ['watches', 'version_of', 'identity', 'monitors']>)
prioritynormal
typebug
done in3.16.6
load0.200
load left0.000
closed by#b0155bfd4e17 Protect against crash in the `relation_possible` predicate with ambiguous relations.
patchProtect against crash in the `relation_possible` predicate with ambiguous relations. [applied]