The words the code of both engines uses for the ideas of Ergo, and what each one means. It's for people who work on Ergo. REFERENCE.md is for people who write policies, and it says "cause" where the code often says "flaw", for example.
The aim is one word for one idea. Some words aren't there yet, and the last section lists where.
The thing a requirement checks, like a deployment or a pull request, and also each one of them. REFERENCE.md says "A subject is the kind of thing a requirement checks" and, a few lines later, "each item is a subject".
- Rust:
find_subjectsinsubjects.rsfinds them,Subjectinpolicy.rsis the definition written in the policy, andCtx.subjectinpath.rsis the one being checked. - Rego:
_subject_definpolicy/subjects.regois the definition, andsubjis the value being checked in most rules.
One element of a list in the report, written {"name": ..., "value": ..., "locations": [...]}. REFERENCE.md puts it like this: "Every entry in a row's inputs, in a check's $refs and in failed_items has locations".
- Rust:
inputinreport.rsbuilds one, andsubject_entrybuilds a subject's entry insubjects. - Rego:
_entry_anchorinreport/requirements.rego.
The Rust engine also has two structs called Entry that aren't this: one in subjects.rs, a subject with where it was found, and one in ops/walk.rs, one step of a walk.
One element of a list that a check or a from line reads, like a file in files. In a report it shows as "item": "item 1 of files" in failed_items, and REFERENCE.md writes "An item of the list that isn't an object, like a string or a null, is still a subject."
- Rust:
WalkIteminops/walk.rs, andItemAtin the same file. - Rego:
_item_atinlines/walk.rego, anddata.ergo_item.
Where a name starts reading. Outside a relative clause that's the subject, unless the name is $input, $params, a for name, a part, a parent subject's name or the subject's own name. REFERENCE.md says "Everywhere else, names resolve from their root:". Inside a relative clause, a name starts at the focus instead.
- Rust:
is_rootandrootinpath.rs,from_a_rootinops/walk.rs,root_textinops/message.rs. - Rego:
_root_read_flawand_plain_root_flawinlines/roots.rego.
What a relative clause is about, like each approver. REFERENCE.md gives xs whose count of ys.k is 1, where k of each y is read inside the focus, and says "inside one a name resolves against the focus, the thing the clause is about".
- Rust:
focus_ctxandfocus_lostinops/walk.rs. - Rego:
_focus_entryinlines/walk.regoand_tally_focus_causeinchecks/derived.rego.
Something wrong in the policy as written, like unknown field op. A problem fails the $well_formed row, and REFERENCE.md says "A problem fails $well_formed on every requirement that names a subject whose chain has it". It's about what the author wrote, never about the input.
- Rust:
Problemsandadd_probleminpolicy.rs,well_formed_rowinreport.rs. - Rego:
policy/problems.rego, like_unknown_problems, and_well_formed_rowinreport/chains.regoandreport/entry.rego.
Why one item failed its check, a fact about the data, as text: $params.q is "s", which isn't a number. A fault is a piece of a row's message. REFERENCE.md never uses the word.
- Rust:
root_faultinops/message.rs, and the textfor_line.rsbuilds inown_beside_rootand aroundroot_fault. - Rego:
_m_faultand_m_faultsinmessages/faults.rego, and_tally_root_faultinlines/roots.rego.
Why a check got its verdict: Satisfied, NotAnObject, Ambiguous, Unusable, Absent, Null or Value. REFERENCE.md and spec/semantics.md call it a cause.
- Rust:
Causeincause.rs. - Rego: the
causeof a row.
The code also says flaw for two ideas, and flaw isn't a word of Ergo: use cause for why a check got its verdict, including when a root couldn't be read (root_flaw in Rust and the flaw arguments in checks/derived.rego are causes), and problem for something wrong in the policy (_number_flaw, meta_number_flaws and _from_path_flaws are problems).
One input in a policy's tests field, with the outcome its report must have, so a policy can be tested. REFERENCE.md says "A policy can carry examples". It is experimental, and ergo test runs them.
- Rust:
ergo testin theergocommand reads thetestsfield and runs each example, inengines/rust/engine/src/examples.rs. - Rego:
ergo.regodoesn't run examples.ergo test --engine regobuilds each example's report with it.
What an example says its report must have: a list of outcome lines. REFERENCE.md writes "the outcome", and ergo report --format outcome prints one for a report.
- Rust: the code in the
ergocommand that prints and compares outcomes. - Rego: none.
One line of an outcome, in the words the report uses, like deployment d2 fails not_self_approved or approved is not met: with its lines under it. A line a report has no row for doesn't agree with it, and a report row that no line names is fine.
- Rust: the same code as for an outcome.
- Rego: none.
These feed the renames later. Nothing here has changed.
- subject: three ideas under one word.
Subjectinengines/rust/engine/src/policy.rsis the definition,Ctx.subjectinpath.rsis one value, andREFERENCE.mduses it for both the kind and each one. A kind of thing and one of them need two words. - entry:
Entryinengines/rust/engine/src/subjects.rsandEntryinops/walk.rsare two structs for two ideas, and neither is the report's entry._focus_entryinengines/rego/src/lines/walk.regois the walk one, and_entry_refinengines/rego/src/reading/values.regobuilds a{"type", "id"}reference to a subject found in the input, which is not the report's entry either. - item:
Iteminengines/rust/engine/src/checks.rsis one line of a check (its text and what it does),Iteminops/for_line.rsis the part of aforline that picks something, andWalkIteminops/walk.rsis one list element. Only the last one is whatREFERENCE.mdcalls an item. - root:
Location.rootinengines/rust/engine/src/path.rsis which document a value came from,InputorParams, whichREFERENCE.mdcalls "the root of the params"._is_rootinengines/rego/src/policy/subjects.regois true for a subject that has noof, one that isn't built on another subject. A subject other subjects are built on is still a root in this sense. - flaw: the code says
flawfor two ideas, and the words to use arecauseandproblem. These names mean a problem in the policy:_number_flawand_number_flawsinengines/rego/src/checks/leaf_ops.rego,meta_number_flawsandnumber_flawsin Rust,_from_path_flawsinengines/rego/src/lines/from_lines.rego, and_s_join_flawsand_s_elapsed_flawinengines/rego/src/sentences/. These mean a cause:root_flaw,root_flaw_ordered,root_flaw_counted,root_flaw_with,sentence_root_flaw,outer_flaw,reads_a_flawed_root,unflawed_cause,left_flawedandright_flawedin the Rust engine (mostlyops/message.rs,ops/for_line.rsandops/lists.rs), and_flawinengines/rego/src/policy/problems.rego(used inreport/chains.regoandreport/evaluation.rego, it returns"unusable"or an empty string),sentence_flawinengines/rust/engine/src/ops/for_line.rs(a local name and a parameter that hold thesentence_root_flawresult),_cond_flaw,_root_read_flaw,_plain_root_flaw,_leaf_root_flaw,_walk_root_flaw,_walk_flawed,_for_flawed_cause,_list_flaw,_list_flawed,_ref_step_flaw,_ref_step_flawed,_flawed_root_msgs,check_flaws,filter_flawsand theflawandflawsarguments in the Rego engine. The bare local nameflawedis a cause too (39 uses in Rust and Rego), and so is the test helperflawed_withinengines/rust/engine/src/ops/lists/tests.rs(16 uses). Three test names in Rust say it as well:a_written_list_or_a_field_on_the_right_is_never_a_flawanda_ref_that_reads_the_wrong_kind_of_value_is_a_flaw_and_a_missing_one_is_notinops/lists/tests.rs, anda_walk_without_a_flawed_check_is_not_flawed_and_one_inside_an_any_of_is_asked_tooinops/walk/tests.rs. About 270 lines of code in all, 44 distinct names counting the two spec rule names below. - flaw in the spec: the rule ids
walk.flawsandfor.flawsinspec/semantics.md, the spec cases and both CHANGELOGs are causes too. Renaming them changes the spec and its changelog, so it is a separate and larger step than renaming code. - fault: in Rust,
root_faultinops/message.rsreturns text. In Rego,_m_faultinmessages/faults.regoreturns pairs of a path and the kind wanted ([check.path, "a number"]), and the text comes later from_m_isnt. Same word, different things, and Rego's_m_key_faultreturns text like Rust's. - problem: no mismatch found. Both engines use the word only for what
$well_formedlists.