Closed ncalexan closed 6 years ago
Oh dear. transact_builder
invokes transact_terms
https://github.com/mozilla/mentat/blob/ab957948b4f642e9d4e5e6ac8169c8b382295573/db/src/tx.rs#L785
which invokes transact_simple_terms
https://github.com/mozilla/mentat/blob/ab957948b4f642e9d4e5e6ac8169c8b382295573/db/src/tx.rs#L544
which skips the first stage of the transact pipeline that turns entities
into terms
... and along the way does all of the schema-aware typechecking
https://github.com/mozilla/mentat/blob/ab957948b4f642e9d4e5e6ac8169c8b382295573/db/src/tx.rs#L532
It's probably not hard to address this, with some slight duplication of work, by growing typechecking assertions in the SchemaTypeChecking
trait and invoking them as part of the term processing loop. It will be a little awkward that passing an EDN :keyword/value
ident as the value to an attribute of type :db.type/ref
will look up the entid for you, but (as written) passing a term TypedValue::Keyword(...)
as the value to an attribute of type :db.type/ref
won't look up the entid for you... but that's the advantage and disadvantage of using a lower level interface.
It appears that
transact_builder
is not type-checking the provided values, so that, say:and
successfully transact. It's not clear to me where in the stack the error is:
transact
in general is not type checking correctly?transact_builder
, which was added long after the initialtransact
implementation, is inserting itself into the stack after the type checking is expected to have been done?In either case this is critical!