cubicweb #3724892 caching constraint types crashes migrations [validation pending]

during elo migration, the contraint type IntervalBoundConstraint Type is added and is necessary to do a sync_schema_prop_perms of entities, but is sometimes not available yet (in cache).

the following code is not sufficient to enable migration:

if not rql('CWConstraintType C WHERE C name "IntervalBoundConstraint"'):
    create_entity('CWConstraintType', name=u'IntervalBoundConstraint')

sync_schema_props_perms('CWConstraintType')

Traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cubicweb/cwctl.py", line 162, in run_arg
    status = cmdmeth(appid)
  File "/usr/lib/python2.7/dist-packages/cubicweb/cwctl.py", line 784, in upgrade_instance
    mih.migrate(vcconf, reversed(toupgrade), self.config)
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/migractions.py", line 152, in migrate
    super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options)
  File "/usr/lib/python2.7/dist-packages/cubicweb/migration.py", line 181, in migrate
    self.cmd_process_script(script)
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/migractions.py", line 157, in cmd_process_script
    migrscript, funcname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cubicweb/migration.py", line 350, in cmd_process_script
    execfile(migrscript, scriptlocals)
  File "/usr/share/cubicweb/cubes/forge/migration/1.10.1_Any.py", line 5, in <module>
    sync_schema_props_perms()
  File "/usr/lib/python2.7/dist-packages/cubicweb/migration.py", line 137, in <lambda>
    meth=meth)
  File "/usr/lib/python2.7/dist-packages/cubicweb/migration.py", line 203, in interact
    return meth(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/migractions.py", line 1194, in cmd_sync_schema_props_perms
    syncprops=syncprops, syncperms=syncperms)
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/migractions.py", line 559, in _synchronize_eschema
    syncprops=syncprops, syncperms=syncperms)
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/migractions.py", line 648, in _synchronize_rdef_schema
    ask_confirm=confirm)
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/migractions.py", line 323, in rqlexecall
    for rql, kwargs in rqliter:
  File "/usr/lib/python2.7/dist-packages/cubicweb/server/schemaserial.py", line 548, in constraints2rql
    values = {'ct': cstrtypemap[constraint.type()],
KeyError: 'IntervalBoundConstraint'
instance ptonelli-jplorg not upgraded: 'IntervalBoundConstraint'
prioritynormal
typebug
done in3.20.0
load1.000
load left0.000
closed by#57a16bef82c0 [migration] make sure the repo knows about all constraint types
patch[server] do not cache cubicweb constraint types during migrations (closes #3724892) [rejected][migration] stop caching the mapping from constraint type name to eid [applied][migration] make sure the repo knows about all constraint types [applied]