Expand description
The coverage report of GET /emulator/v1/projects/{p}:ruleCoverage: what each expression
of a ruleset evaluated to, as the official emulator reports it
(tools/oracle/rules_coverage.py, crates/hidane/tests/fixtures/rules_coverage.json).
- The report holds every expression of the ruleset’s first file that is not a literal (null,
a bool, a number, a string or bytes), each with the ones in it. Its roots are the
functions’ bodies and the
allowconditions in the order the ruleset nests them: the file’s functions, then each service’s functions, itsmatchstatements (each with its functions, thematchstatements in it, then itsallowstatements) and itsallowstatements. A body or a condition that is a literal is left out. - A function body with
lets starts at its firstlet: eachletholds its value and the body from the nextleton (or the result), and has the function’s result. - The expressions in one come in source order, but
x in yholdsyfirst. - An expression starts at its first token, or at the outermost parenthesis before it (but the object of a member, an index or a method leaves its outermost parenthesis to them), and ends with its last part: a call with its last argument (or its name), a list or a map with its last item (or its opening bracket), a path with its last segment, a member with its name; closing brackets are left out. Offsets count code points, and the end is inclusive.
- Each expression lists the distinct things it evaluated to, in the order first seen, with
how many times: a value, an error, or nothing (
{}) when&&,||or?:decided without it. An error is placed at a token of the expression that raised it (an operator, a function’s name, or the expression’s first token) and keeps that place as it goes up; a comparison a list’s filter does not decide is an error without either. - The statements of a request’s method count as a growing
||of them: the first evaluated once for each statement evaluated after it, and once more (Trace).
The official emulator evaluates a condition again after an error, or when it reads a
document, and its report counts both passes; hidane’s counts each evaluation once. It also
keeps at most MAX_VALUES distinct values per expression (docs/parity-exceptions.md).
Structs§
- Coverage
- A ruleset’s report: its expressions and what each evaluated to so far.
- Expression
- An expression of the report.
Constants§
- MAX_
VALUES - How many distinct values an expression keeps; later ones that differ from all of them are not counted.