https://authzed.com logo
Title
d

dguhr-rh

01/30/2023, 10:46 AM
silly question, perhaps my google skills are bad this monday: Are caveats already available in the playground? (if yes: is there an example model showing a caveated model and relationships? if not: is there an example usnig the API client out there?)
v

vroldanbet

01/30/2023, 11:22 AM
they are available in the playground, but caveats is not enabled in our managed spicedb instances. This is a very silly example I just wrote: https://play.authzed.com/s/Ng8pr6sx_kw8/schema
d

dguhr-rh

01/30/2023, 11:28 AM
thanks, good to know. looking at your example, and https://github.com/authzed/spicedb/issues/386 - is it possible to add the caveat to the test relationship? e.g. [amount = 43] or sth, which should then assertTrue? Hope that makes sense. In the end I see I can add caveats, but not check if they apply or not 😉
(perhaps makes sense given you can't add a Context in the playground)
playing around, it seems i can define a relationship like
resource:someresource#writer@user:somegal[amount]
in your example, but I can't assert it. Would expect sth like e.g.
assertTrue:
...
  - resource:someresource#write@user:somegal[amount=43]
assertFalse:
  - resource:someresource#write@user:somegal[amount=41]
v

vroldanbet

01/30/2023, 11:57 AM
it should be possible to add context to relationships, and also assert them. We have a bunch of examples in our "consistency tests": https://github.com/authzed/spicedb/blob/e495350bee4e69ebfac6a1a847a4683859d179c8/internal/services/integrationtesting/testconfigs/caveatarrow.yaml#L23-L61
d

dguhr-rh

01/30/2023, 12:25 PM
Thanks @vroldanbet that example helped a lot to clarify. Here's an updated model where I added a caveated relationship
user:dominik[amount]
and the assertions (true for bigger than 42, false for lesser)
v

vroldanbet

01/30/2023, 12:27 PM
great! as I said earlier, playground should have full support for Caveats now, but we are still working on getting caveats ready for prime time in production, so if you want to use it, you'd have to run it with the corresponding experimental flag in your own SpiceDB deployment
d

dguhr-rh

01/30/2023, 12:27 PM
sure 🙂
v

vroldanbet

01/30/2023, 12:28 PM
Joey captured here what's missing in order to release to prod and removing the experimental flag: https://github.com/authzed/spicedb/issues/386#issuecomment-1404107141