Debugging Rego policies can be tricky. These projects and tools can help you work out what's going on.
Regal can be used to debug Rego policies by identifying common mistakes. See Bugs for some example issues it can identify automatically.
Regal also implements a language server and debug adapter for Rego to allow clients to debug Rego code as users type.
The extension provides support for debugging Rego policies using the native VS Code debugging interface. This is based on Regal's Debug Adapter, see the VS Code documentation to get started.
OPA Errors is a guide aimed at helping users debug OPA errors by documenting common errors and fixes in detail.
The playground is a great place to debug Rego policies as you can quickly iterate on the policy and data at the same time before sharing links to collaborate on a fix with others.
The rego-test-assertions library is designed to make debugging Rego tests easier.