Skip to content

Partial Evaluation produce duplicate rules #4516

@t83714

Description

@t83714

Partial Evaluation produce duplicate rules

General Summary

The partial evaluation result might include many duplicate / identical rules sometimes.

The sample response provided above includes 432 rules. Many of those are duplicated / identical rules. e.g. like (I converted AST into a more readable format):

{
  input.object.record.dcat-dataset-strings
  input.object.record.publishing.state
  NOT input.object.record.publishing.state = "draft"
  input.object.record.dataset-draft
  NOT input.object.record.dcat-dataset-strings
  input.object.record.publishing.state
  input.object.record.publishing.state = "published"
  NOT input.object.record.access-control.orgUnitId
}

or

{
  input.object.record.dcat-dataset-strings 
  input.object.record.publishing.state 
  NOT (input.object.record.publishing.state = "draft")
  input.object.record.dataset-draft
  NOT input.object.record.publishing.state = "published"
  input.object.record.publishing.state
  input.object.record.publishing.state = "published"
  "c59aa487-32fc-4d00-b16c-e070f2c88943" = input.object.record.access-control.orgUnitId
}

Those above are example rules that are duplicated more than once.

Steps To Reproduce

  • Download the example policy files and Run opa run -s [folder of policy files]
  • Send sample JSON request to compile endpoint

Expected behaviour

The partial evaluation result should not contain duplicate rules. But right now you can locate duplicate rules in the partial evaluation result.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions