Skip to content

Assert triggers on true. #9136

@ho94949

Description

@ho94949
  • Gel Version: 7.1+ec15259
  • Gel CLI Version: Gel CLI 7.7.0+3788f53
  • OS Version: Ubuntu 24.04.2 LTS

Steps to Reproduce:

Insert multiple data into B and C. Run following with proper parameter:

with
  t := assert_exists(select A filter .id = <uuid>$a),
  b := <uuid>$b,
  c := assert(t.f = b)
select c;

This raises AssertError, however

with
  t := assert_exists(select A filter .id = <uuid>$a),
  b := <uuid>$b,
  c := (t.f = b)
select c;

Returns { true } as expected.

The following workaround works

with
  t := assert_exists(select A filter .id = <uuid>$a),
  f := assert_single(t.f),
  b := <uuid>$b,
  c := assert(assert_exists(f, message := <str>f) = b)
select c;

I don't know why, but I've found that passing message is important to make assert pass.

Schema:

The schema used in my project is complex, but the core is as follows:

default.gel

module default {
  abstract type A {
    required f: uuid {
      default := uuid_generate_v1mc();
    }
  }
  type B extending A { }
  type C extending A { }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions