A step-through debugger you can host in your JVM/Datastar app
When a policy gives a decision that you did not expect, you want to see which part of the input each step read.
- Regal, the linter and language server for Rego, steps through a policy in your editor.
rego4k-server-debuggersteps through it in the browser, and it can run inside your own application, behind your login. It highlights the part of the input that each step reads.
The debugger is a set of http4k routes and kotlinx.html components. Datastar, a small JavaScript library for pages that the server renders, updates the page in the browser.
The routes keep no state. The state of a debug session is in the Datastar signals of the page, and each response patches the signals and the page. Give your own DebuggerComponents, and the same routes drive a different UI. See The routes and the signals.
Mount DebuggerModule below a path of your own application, in your navigation, or run it as a server of its own with rego4k run --server --with-debugger. DebuggerComponents lets you redraw any part of the page.
Each step evaluates the query again from the start, so a step back costs the same as a step forward. Open the debugger at demo.rego4k.dev.
Replace it: draw each part of the page with your own DebuggerComponents, and list your own bundles with a BundleCatalog.

