cubicweb #2236985 rqlrewrite fails to remove rewritten entry for unsupported constraint and then crash [done]

A KeyError is raised when:

  • multiple snipset is to be inserted on a statement
  • some supported snipset adds ambiguity (increase the number of solution)
  • some unsupported snipset adds new variable
  • The new variable require rewritting
File "/home/pyves/src/fcw/cubicweb/", line 185, in rewrite
  newsolutions = self.remove_ambiguities(snippets, newsolutions)
File "/home/pyves/src/fcw/cubicweb/", line 436, in remove_ambiguities
  variantes = self.build_variantes(newsolutions)
File "/home/pyves/src/fcw/cubicweb/devtools/", line 340, in _build_variantes
  variantes = _orig_build_variantes(self, newsolutions)
File "/home/pyves/src/fcw/cubicweb/", line 470, in build_variantes
  variante.append( (key, sol[newvar]) )
KeyError: u'D'

This happen because the mechanism removing unsupported snipset does not remove entry in self.rewritten when it removes entry from

Iteration on self.rewritten then crash because values of rewritten are expected to be found in solution.


Removing rewritten at the same time than defined_vars should be enouth to remove the bug.

done in<not specified>
load left0.000
closed by#f23782a2cdee rqlrewrite: remove element in rewritten when we remove them from the select (closes #2236985)