authzed / spicedb

Open Source, Google Zanzibar-inspired database for scalably storing and querying fine-grained authorization data
https://authzed.com/docs
Apache License 2.0
5.12k stars 278 forks source link

Language Server warnings for slow permissions definitions #2058

Open jzelinskie opened 2 months ago

jzelinskie commented 2 months ago

Problem Statement

Currently it's somewhat difficult to reason about the performance of a particular permission definition during schema development.

Solution Brainstorm

While we cannot know the distribution of data in the system until we're working against a live SpiceDB deployment, we can detect the level of nesting and use of costly operators (intersection, negation) to come up with a score and throw a warning when a definition is over a particular score.

tstirrat15 commented 2 months ago

This will probably be somewhere downstream of the composable schema proposal. We'll need a reachability graph at compile time, which I don't think we currently have.