Skip to content

v0.41.1

Latest

Choose a tag to compare

@github-actions github-actions released this 02 Jun 18:10
· 8 commits to main since this release
Immutable release. Only release title and notes can be modified.
118f8d3

We've been getting a new version of Regal for an exciting summer of high performance Rego development.

This release brings automatic Rego test generation, as well as squashing a bunch of issues under the hood with sweeping enhancements to the core language server code.

NOTE this is the same code as that of v0.41.0 — just that the combination of a release deployment issue and immutable releases just had that one end up without any downloadable artifacts. That is now corrected!

New Feature: Automatic Test Generation

A first pass at automatic test generation has landed in the language server (#1982), thanks to @SeanLedford! With a new code action available when working in a policy file, Regal can generate a test stub based on the current state of the workspace. This uses the values found in input.json to populate the with statements in the generated test.

Language Server Improvements

This release includes significant internal improvements to the language server.

Completion performance has seen a major improvement: for clients like VS Code that support a default replacement range, the completion payload is now roughly half the size it was before, and clients generally do no longer need to send continuous requests to the server for more suggestions once you start typing (#1992).

The folding range provider has been rewritten in Rego (#1979), and now additionally honours client capabilities like lineFoldingOnly and rangeLimit.

The handling of input.json and input.yaml files has been overhauled (#2002). These files are now tracked as first-class workspace state: they are parsed and cached when saved, and the server now requests update notifications for them from the client, rather than re-parsing the file on each evaluation, or debug sessions started.

OPA v1.17.0

Regal has been updated to OPA v1.17.0 (#2014). This OPA release notably introduces future.keywords.not, which improves the semantics of the not keyword by wrapping composite-expression negation in an implicit body. Thanks @johanfylling for making sure this also works in Regal now!

Regal's RoAST representation (and docs) have been updated to support the new ast.Not form introduced alongside this feature (#1985).

RoAST module.comments Representation

The RoAST representation of module.comments has changed (#1987). Comments are now represented as plain locations rather than base64-encoded text, allowing Regal to retrieve the original text from the source file directly with less bytes to transfer and parse. Note: this is a breaking change for custom rules that reference input.comments directly. Users should instead prefer to reference data.regal.ast.comments_decoded, which provides comment locations in the usual form and which will remain stable even through future format changes.

Bug Fixes

  • Addressed a panic in regal fix caused by fixes being applied in non-deterministic order; opa-fmt could reduce line count such that use-assignment-operator would then access out-of-bounds row numbers (#2003) as reported by @erazemk
  • The unassigned-return-value rule now correctly flags namespaced builtins like json.match_schema(...) in addition to flat builtins like lower(...) (#2005) — thanks @mvanhorn for the fix and @anderseknert for the report
  • Nicer formatting of with sequences (#1969)
  • regal/ast: metadata labels field is now recognized as a valid metadata key, aligned with OPA v1.17.0 (#1983, #1988) — thanks @srenatus
  • Regal fix now works regardless of local git state (#2011). Thanks @seiyab for the report in #2006

New Contributors

  • @mvanhorn added pre-commit hooks for regal fix in #1976
  • @sspaink added support for recursive JSON schemas in OPA, and later applied that fix in our schemas #1967

All changes

Full Changelog: v0.40.0...v0.41.0