Skip to content

ergo.rego 0.6.0

Latest

Choose a tag to compare

@github-actions github-actions released this 11 Nov 17:27
· 45 commits to main since this release
Immutable release. Only release title and notes can be modified.
rego-v0.6.0
c2d3160

Changed

  • A from line with more than one name needs every to read a list, and every works on a child subject, as spec 0.6 says. every artifact.pull_requests replaces artifact.pull_requests, and every trail.artifacts replaces trail.artifacts. Without every, $min_subjects fails as unusable and names the list and the fix. A line that ends at text, a number or true or false gives that value as a subject, the subjects of a line must be of one type, every reads one list per name, a name it reads as a list must be one in every item, every deployment is written wrong with deployment is a subject: write deployment whose … to narrow it, without every, and a list before named by each of says to use a child subject. A failure for mixed types, or for a name that is a list in some items only, lists the items it names in failed_items, and a child subject of such a line is still read under each parent. Reports change for every policy that reads a list through a path of two names or more, see spec/CHANGELOG.md.
  • Names resolve where spec 0.6 says, from their root or against the focus. A bare name on the right of the phrase after every or some reads the subject's field, and so do a name written with a dot and a named by field there. whose and that after every, some, count of, sum of and on a for item read the value the path ends at, so count of approvers.username whose state is "APPROVED" fails as not_an_object. The subject's name followed by a step, like pr.author, reads the subject's field inside a relative clause. In a from line, the right side of a some or every condition reads the candidate subject. Reports change for policies that write these, see spec/CHANGELOG.md. This version follows spec 0.6, so a policy says ergo_spec: v0.6, and the report's ergo says v0.6.
  • As spec 0.6 also says: pr named by k and pr[0] are allowed inside a relative clause; a whose that compares a field with itself says write pr.x; distinct no longer makes a bare name on the right written wrong; a sum of whose whose, or the right side of its that, reads a name of the value it adds is written wrong; a named by on the right of every or some reads the subject's key whatever the path starts at, $params and $input included; named by pr.k takes the key from the subject inside a relative clause, after any path; a root name in a whose or on the right of every or some is read once, up front, so a problem with it fails the row even on an empty list; a whose that compares a field with itself gives no advice when the subject's name needs double quotes; and messages name a value past the list after its item and a colon, list every item a count of or sum of couldn't read, say a root name no item can use once, and a root name's problem inside a relative clause once with no item, and an item of its own list once, like item 2 of $params.envs is null, which isn't an object, name a named by key that can't be read, name the item in item 2 of xs: k is missing for pr named by k in a relative clause, and write the item's path in full when a name on the right is spelled the same.
  • As spec 0.6 says, contains and does not contain read one value and never walk a list on their right side, so a list the path meets on the way fails as unusable, and a path like $input.k or $input.m named by key on a list input as not_an_object with $input is [...], which isn't an object, while a list it ends at is still one value. $refs list such a path as written, with the value null. The list after named by each of never walks a list either, and a message names text, a number or a list that stops the read of its keys. A right side that walks a list names the value where the read stopped when another item holds a list there, where it said item 1 of o is null. Reports change for policies that write these, see spec/CHANGELOG.md.
  • As spec 0.6 says, every, some, count of, sum of, a for item without a position and the right side of the phrases that take a list read each item of a list a path starts at, whether it is the subject, a part, a for alias or $input, and so does a second for item that starts at an alias holding a list. With the subject t holding [{"name": "a"}, {"name": "b"}], every name is "a" fails as value with item 2 of t: name is "b", where it failed as not_an_object. A check that also reads the subject's own field outside those, like every name is other or a for sentence o is boss, still fails as not_an_object, once. The right side of a list phrase after every, in a whose or in a that now reads a list in the middle of a name or an alias that is a list item by item, like every xs.v is in ys.v, where it failed as unusable or not_an_object. A path from $input on a list input, named by forms included, says $input is [...], which isn't an object, and $input[0].id on [1] fails as unusable where it failed as absent. A for item that isn't an object is named by its value, item 2 of t is 3, which isn't an object, where it said is null. A check that can't use a param or a named by key no longer says the list it reads isn't an object, in every, count of and sum of, and a root name inside a whose that isn't a list, or that is missing or null in an item of the subject, is said once, with no item.
  • A path that meets null partway along fails as null, where it failed as absent, and the message names the step that is null, as spec 0.6 says: c.z is 1 with c null says c is null, where it said c.z is missing, and pl.z is 1 with the part pl null says pl is null. The same goes for $input, $params, a parent's field, a for alias and a position on a null subject, alias or $input. exists and does not exist keep their causes and name the step. A key read from a field right after the null still decides. A whose condition on a from line reads the same way, so its $applies row fails as null with c is null, while a from line that walks through the null, like every prs.c.z, still fails $min_subjects as absent. A key read from a field after the null is named too, after the step, like s is null; p is 3, which isn't text.
  • require: some on a child subject needs a passing subject under each parent, as spec 0.6 says (require.some.parent). A commit whose pull requests all fail makes every commit.pull_requests with require: some not_met, where an approved pull request of another commit made it met. The failing subjects under a parent that has a passing one are no longer violations or counted in causes. Reports change for policies that use it, see spec/CHANGELOG.md.
  • A requirement on a child subject checks the ids of every ancestor of its subject too, the parent and the grandparent, on a new $unique_ancestor_ids row whose subject is the ancestor, as spec 0.6 says (unique_ids.ancestors). Two commits with the same sha now make a requirement on their pull requests not_met, under require: some too, where they counted as one commit and the requirement could be met. Reports of every requirement on a child subject change, see spec/CHANGELOG.md.
  • A name under a for line that doesn't depend on the item, a field of the subject or of a part, $params or $input with or without a path, or an alias of an earlier line, is read once, before any item, as spec 0.6 says (for.roots). When a compare or is in phrase reads it as a value, a problem with it fails the check on an empty list too, with or without , if any,, and the message names it once with no item in front, whatever its cause: z is missing, where it said item 1 of xs: z is missing; item 2 of xs: z is missing. Without , if any, the empty list is named after it, $params.q is "s", which isn't a number; xs is []. A name that depends on the item, the line's own alias or a named by key read from the item, keeps the item in front. What each item says on its own follows the names, without them: z is missing; item 1 of xs: m.v is 1; item 2 of xs: m.v is 3, and the cause is the worst of all. $params or $input read alone, like $params is 3 with null params, is such a name too, and failed_items lists every item that failed, also when a name is said once, so m.v is in $params.q with q holding text lists both items, where it listed none. A check that doesn't read $params keeps its usual message and the cause unusable when the params aren't an object. A root in a whose on the for line no longer hides what an item says on its own, whichever clause comes first: every xs whose k is in pr.z and whose v is 1 as m with pr.z holding "s" says pr.z is "s", which isn't a list; item 2 of xs: v is "x", which isn't a number, where it said only pr.z is "s", which isn't a list. A list on a later line that doesn't depend on the item is said before the items' problems. A named by key read from the item under null params says what missing params say. In a count of or sum of, a $params or $input name that is missing or null is named before the others, like $params.l is missing; pr.l is missing for count of xs whose w is in pr.l and whose v is in $params.l is 0, where it said pr.l is missing; $params.l is missing. Reports change for policies that write these.
  • Under a for line, is, count of, sum of and a named by key read a root once, before any item, as spec 0.6 says (for.roots). A root that is missing, null or of the wrong type fails the check on an empty list too, and is named once with no item in front: z is 1 with z holding "s" says z is "s", which isn't a number, count of z is 1 says z is "s", which isn't a list or an object, and m.t named by z is 1 with z holding 3 says z is 3, which isn't text, where it said it for each item. A key the row can't read is named before what each item says on its own. An object that count of or sum of reads fails on an empty list too, with z is {"a": 1}, which isn't a list, with or without a whose, as it does with items. A count of or sum of root is said once with items, where it was said for each item: count of z is at least m.v with z holding "s" says z is "s", which isn't a list or an object. A sentence that reads two roots isn't said again after them, and a root named before an item's own problem counts towards the cause, so zz is 3, which isn't text; item 1 of ws: w[0] named by zz is missing fails as unusable, not absent. A name that depends on the item and can't be read, like i.t holding "s" in every items as i, every $params.l whose v is at least i.t as x, makes the cause unusable where a missing or null item of $params.l gave absent or null, with the same message. The names of one sentence are said worst cause first and then by name. Reports change for policies that write these.
  • A check that reads a list or patterns from a $params or $input path, like x is in $params.l, w contains all of $input.required or s matches $params.p, lists that path in its row's inputs after the field it checks, as is at least lists its right side, as spec 0.6 says (path.right_inputs). The entry is there whatever the cause: a list that is missing or null is listed as null, and one that isn't a list with what it holds. x is in $params.l on {"x": 3} with {"l": [1, 2]} has the inputs x and $params.l, where it had x alone. The same goes for the assertions of a for line, an $applies row and an any_of row, and for $params.m named by k after these phrases, which was left out where w named by k was listed. The rows of every, some and count of list such a path from $input where they list the right side of is at least, like $input.l in every xs.n is in $input.l, and still leave out one from $params, as is at least does, and a for line's own row lists one from either, like $params.l for x.n is in $params.l, as it lists $params.z for x.n is at least $params.z. A violation lists a ref the row lists once, where it would list it twice. Changes the report of every such check.

Fixed

  • A count of after that that reads a part or the subject's own name, like count of xs that is count of cov.z is 1, counts the part's list, as spec 0.6 says, where it failed as not_an_object because the items weren't objects. With the part cov: c and the input {"c": {"z": [1, 2]}, "xs": [2, 5]} the check now passes. The same goes for every and some with such a that, on a for item and in an any_of option, and a part that is missing, null or not a list now fails as absent, null or unusable and names the part, like cov.z is missing. A parent's name and a for alias already worked.
  • A root name that a whose, or the phrase after every or some, reads as a list and that isn't one, like pr.z in count of xs whose v is in pr.z is 0 with pr.z holding "s", fails as unusable with pr.z is "s", which isn't a list on an empty list too, as spec 0.6 says, where the check passed, or failed as value on a for item. A $params or $input name there already failed on an empty list, and now names itself, like $params.q is "s", which isn't a list, where the message was count of xs whose v is in $params.q is 0 is false. A root of the wrong type for any other phrase fails the same way, before any item and on an empty list too, with no item in front, like pr.z is "s", which isn't a number for is at least, as spec 0.6 says. A root in a sentence under a for line is named once, with no item, and a root that reads the alias of the first item in the second item fails on an empty list too, like item 1 of ys: m.q is "s", which isn't a list.
  • A part that holds a list, like pl in m.v is in pl.z under every xs as m with has: {pl: c} and c holding [{"z": 1}], fails the for check as unusable with pl is [{"z": 1}], which isn't an object, as pl.z is 1 does, as spec 0.6 says (for.roots). count of xs whose v is in pl.z is 0 is read the same way. When the params aren't an object and a check that reads $params also has tied items, the message names $params first and then the tie, and the cause is ambiguous.
  • Every root name in a relative clause that fails is named, whatever its cause, in the order the sentence reads them, like $params.l is null; pr.l is "s", which isn't a list, and in front of what the items say when an item fails in a worse way, as spec 0.6 says, where a message could name only the roots with the row's cause, or only the first of two wrong-typed lists. A check's own row that fails as absent or null names a side read from the subject that is missing or null too, like c.z is missing, and d is null. A list in the middle of the name on the right of a phrase that doesn't take a list now says c is [], which isn't an object, where it said c is []. A for alias after is in counts as such a root too, like item 1 of ys: m.q is "s", which isn't a list, and a missing one in every xs whose v is in m.q, if any, exists on an empty list says item 1 of ys: m.q is missing, where it said item 1 of ys: xs is missing. A walk whose ref step can't be read names its path and then each root its phrase can't read, like xs named by $params.k is missing; q is missing, where it named only the root.