Which kinds of test RegelRecht has, where each one lives, the recipe that runs it locally and the CI job that runs it on a pull request.
The repository has about twenty kinds of test, and the kind decides who acts on a failure. A red engine test is a bug in the engine. A red scenario next to a law means the law or the scenario changed, and someone has to judge which.
The table lists the tests in this repository and the jobs that run them here. The CI column names the job; what each job does is on CI/CD.
| Kind | Where it lives | Run it locally | In CI |
|---|---|---|---|
| Law validation (BDD bucket A) | corpus/regulation/**/scenarios/*.feature | BDD_BUCKET=corpus just bdd | No, on purpose |
| Engine conformance (BDD bucket B) | bdd/conformance/*.feature, ruleworks in bdd/conformance/fixtures/ | BDD_BUCKET=conformance just bdd | BDD conformance |
| The cell’s BDD suite and its constructs | packages/cel/bdd/ | just bdd | BDD conformance |
| Demo scenarios | corpus/demo/regulation/**/scenarios/ | just bdd-demo | BDD demo |
| Scenarios of the chronolexografie PoC | packages/poc-chronolexografie/corpus/ | just bdd-chrono | BDD demo |
| Example caller of the reusable BDD workflow | bdd/external-corpus-example/ | see BDD scenarios from another repository | Example corpus, Example reports hold only its scenarios |
| Scenarios of the JavaScript PoCs | frontend-poc-*/tests/scenarios.test.js | npm test -w frontend-poc-<slug> | E2E (mocked) |
| Rust unit and integration tests | packages/*/src/, packages/*/tests/ | just test | Rust tests |
| Golden fixtures | packages/engine/tests/golden_tests.rs | just test | Rust tests |
| Trace snapshots | packages/engine/tests/trace_integration.rs | just test | Rust tests |
| Corpus type check | packages/engine/tests/typecheck_corpus.rs | just test | Rust tests |
| Schema conformance | packages/engine/tests/schema_conformance.rs | just schema-conformance | Rust tests |
| Schema validation | the corpora | just validate | Pre-commit |
| Script tests | script/*.test.sh, script/*.test.mjs | just check | Pre-commit |
| Frontend unit tests and type checks | frontend/, frontend-lawmaking/, frontend-demo/, packages/frontend-shared/, packages/poc-chronolexografie/frontend/ | just frontend-test | Frontend tests |
| Unit tests of the JavaScript PoCs | frontend-poc-*/src/ | npm test -w frontend-poc-<slug> | E2E (mocked); wetsgeschiedenis: Frontend tests |
| PoC tests against the engine or the casus | frontend-poc-*/tests/, packages/poc-chronolexografie/frontend/tests/ | npm test -w <workspace> | E2E (mocked); wetsgeschiedenis and chronolexografie: Frontend tests |
| Editor end to end, mocked | frontend/e2e/ | just test-e2e | E2E (mocked) |
| Walkthrough pipeline | script/walkthrough/tests/ | just walkthrough test | Frontend tests |
| Walkthrough replay | frontend-demo/scripts/verify-walkthrough.mjs | just walkthrough verify | Rondleiding speelt terug |
| Docs source checks | docs/scripts/check-*.mjs | npm run check:source in docs/ | Docs source checks |
| Docs accessibility | docs/scripts/, pa11y | just docs-a11y | Docs accessibility gate |
| Smoketest of a deployed editor | frontend/e2e-smoke/ | just smoke-preview <pr> | No, it needs a deployment |
| Mutation testing | packages/engine, packages/pipeline, packages/cel | just mutants-diff | Mutation Testing (diff) |
| Benchmarks | packages/engine/benches/ | just bench | No |
A test of the engine or the law format is named after the construct it tests. That holds for the test file, the feature, the construct directory and the test function: a function says what the construct does (a_grant_revoked_on_objection_does_not_count), not what happens in its case (a refused parking card). The law or case only makes the test concrete, so its name belongs in a fixture or a Background. A large test file is split into a directory, tests/<construct>/main.rs with one module per construct beside it, as packages/cel/tests/submission_lifecycle/ is. Bucket A is the exception, because a scenario next to a rulework tests that rulework. So a test that only checks the values of one rulework belongs there and not in a Rust test.
A test of a construct runs on the smallest rulework that makes the construct possible: fictional, cut down to what the test reads, and a fixture of the test’s own crate. It does not read the corpus, because a change to a law would then turn a test of the engine red. Nor does it read a copy of real legislation, which carries far more than the test exercises. Where a construct builds on a general act such as the Awb, the fixture is a mini-version of that act with only the articles the tests reach. The exception is a test whose subject is the corpus itself, such as the corpus type check.
Most behavior is tested with Gherkin feature files, which the Rust engine runs through cucumber-rs.
Feature files live in two places, and the difference decides who fixes a failure:
corpus/regulation/**/scenarios/*.feature, run against the real corpus. A failure means a law changed or the scenario went stale, and a human decides which. Scenarios tagged @wip are skipped.bdd/conformance/*.feature, tagged by tier, proving an engine speaks the whole language. CI blocks on this bucket. Its features run against the fictional test_* ruleworks in bdd/conformance/fixtures/regulation alone, a mini Awb among them, whatever REGULATION_PATH says. Those ruleworks are not part of the corpus, so the editor and the demo never show them, and a change to a real law cannot turn this bucket red.The cell has a BDD suite of its own in packages/cel/bdd/, outside both buckets. Its steps record submissions, decisions and facts in a cell’s chronicle, evaluate a reduction that plays the chronicle forward, and check what the engine did. A well-founded objection, for example, makes the engine play the chronicle again without the decision it revokes, while an unfounded one leaves the decision standing. They stay out of bdd/grammar.yaml, which is the contract every engine (Rust and JS) executes, because recording a chronicle is the cell’s job and only the Rust engine plays one forward; the JS engines do not implement projection. The features in packages/cel/bdd/features run against the ruleworks in packages/cel/bdd/fixtures alone, a mini Awb among them. Each construct set under packages/cel/bdd/constructs/ runs against its own. Neither reads the corpus. bdd/README.md explains how that suite reuses the canonical steps and the generator, and why its runner sits in packages/cel.
A construct of the law format that is hard to get right gets a directory of its own under packages/cel/bdd/constructs/. The first, hook_open_term_host_fill, is an open term of a hook that the law the hook fires on fills, with the decision term of Awb 4:13 as its case. A construct’s features load only the ruleworks in its regulation/ directory. For hooks that matters. A hook fires on every decision or submission its applies_to matches, in every loaded rulework, so loading the whole corpus would bring in hooks the construct is not about.
In the hook_open_term_host_fill construct, a mini-Awb (test_general_administrative_act, after Awb 4:2 and 4:13) meets three fictional permit acts. An application is recorded on the day it arrives, which is the moment Awb 4:13 counts from, and the decision follows on a later day. The scenarios check what the application holds, the last day of the term, and whether the decision came on or before it: well within the term, on the last day, one day late, and counted from receipt rather than from the date on the application. Two permit acts set a term of their own, and between them they show both routes to the last day, decision_deadline. test_permit_act_short_term sets two weeks with an override on decision_deadline. test_permit_act_implements sets one week by filling the open term statutory_decision_term of 4:13 with implements. Under the hook on its application, only that act fills it (RFC-058). In both cases the fallback of lid 2, reasonable_decision_term_end, stays eight weeks.
To add a construct:
packages/cel/bdd/constructs/<construct>/ with a regulation/ and a scenarios/ directory. The runner fails when either is missing or when scenarios/ holds no feature.regulation/, in the layout of the corpus. Give each an $id starting with test_, mark the text FICTIEF, and invent the content: no real case, no real person. A general law the construct builds on, such as the Awb, is a mini-version holding only what the scenarios need. The construct then does not change when the corpus does. just validate and the pre-commit hook check the ruleworks against the schema.scenarios/, in English. A feature may use the canonical steps and the cell’s own. A decision the cell takes (the cell decides ...) sets the result, so Then output ... equals ... reads what the decision and the hooks on it gave.@wip and a comment above it that names the missing piece and the branch or issue that builds it.just bdd and the CI job “BDD conformance” run the constructs with the rest of the cell’s suite; no recipe or workflow changes.
The runner reads the set from where a feature sits, whichever directory <set> is. BDD_CONSTRUCT_SETS names sets from outside the crate: a :-separated list of set directories. When it is set, the runner plays those sets alone and leaves out its own suite, which runs in regelrecht’s CI. A directory in it that is not a set, or that holds no feature, fails the run as a construct would. The engine’s own runner does not look at where a feature sits and always loads the corpus.
bdd/grammar.yaml is the single source of truth for the step phrasings. The bindings for every engine are generated from it: Rust through packages/engine/build.rs, the editor and demo JavaScript through bdd/codegen/gen-js.mjs, which writes packages/frontend-shared/src/gherkin/grammar.generated.js (re-exported for the editor by frontend/src/gherkin/). Never hand-edit a generated file. Change grammar.yaml and run just bdd-codegen.
A step that is not in grammar.yaml does not exist. A minimal scenario:
Laws that need source data (BRP, Belastingdienst, and the like) provide it with a data-table step keyed on the identifier the law looks up:
See corpus/regulation/nl/wet/wet_op_de_zorgtoeslag/scenarios/eligibility.feature for a complete, data-driven example.
When a rulework in a directory of REGULATION_PATH cannot be loaded, the run fails and names the file; the loader does not skip it.
just bdd-chrono runs bucket A over the corpus of the chronolexografie PoC, which keeps its own copies of the real ruleworks it uses so that work on the PoC leaves corpus/regulation/ alone. Their scenarios went along with them. Two of those features are still identical to the originals in the corpus: criteria.feature of the Regeling gehandicaptenparkeerkaart and regio_en_vakanties.feature of the Regeling vaststelling schoolvakanties. Both copies stay. The PoC’s copy of the parking card regulation already makes a choice of its own on article 2, so that feature tests a different version. The PoC’s ruleworks change only when someone works on the PoC, so a red scenario there is a real error and runs in CI. The originals are bucket A and stay out.
Two other PoCs run their scenarios against the engine built to WASM instead, through tests/scenarios.test.js in their frontend. They are listed in BDD_RUNNERS in script/orphan-tests.mjs, which is how the orphan check knows their features are read.
Test scenarios are derived from the Memorie van Toelichting (MvT), the explanatory memorandum that accompanies Dutch legislation. The MvT contains examples and reasoning from the legislature that serve as ground truth for expected behavior.
A corpus kept in another repository runs its scenarios in its own CI by calling the reusable workflow .github/workflows/corpus-bdd.yml. The workflow checks out the caller and regelrecht side by side and builds the engine. It then runs bucket A over the caller’s ruleworks, the construct sets in a directory of the caller, or both:
The commit after @ fixes the workflow and the engine together: with regelrecht-ref left empty, the workflow checks out regelrecht at the commit it was read from. Pin a commit, not a branch: a change in regelrecht then reaches the corpus as an update someone reviews. Set regelrecht-ref only to try another engine under the same workflow.
With include-central-corpus, the ruleworks of corpus/regulation load beside the caller’s but their scenarios do not run: BDD_SCENARIO_PATH keeps bucket A to the caller’s directory. A $id that both directories hold fails every scenario, with a file from each in the message. A corpus with its own version of a central rulework therefore leaves include-central-corpus off, and keeps every central rulework its scenarios read in its own directory. The engine keeps one version per $id and valid_from. Without the check, a file with the same valid_from would replace the other, and the order of REGULATION_PATH would decide which one stays; a file with another valid_from would quietly join it as an extra version.
Within one directory, the versions of a rulework load side by side.
Each construct set of the caller is named after the construct it tests, as the sets here are. The construct sets run through the cell’s runner, without its own suite. Each run writes a JUnit report through BDD_JUNIT, so both reports hold only the caller’s scenarios. The workflow uploads them as one artifact, named by artifact-name (default bdd-reports), and lists the counts and every failed scenario in the step summary. The job fails when either run fails. .github/workflows/corpus-bdd-example.yml calls it against the fictional corpus in bdd/external-corpus-example whenever the workflow, a runner or the example corpus changes.
To run the example locally, from packages/engine and then from packages/cel:
The Rust unit and integration tests, across every crate in the workspace:
A few crates also have a recipe of their own, such as just pipeline-test and just pipeline-integration-test (the second needs Docker); just lists them.
Each crate’s tests read their own fixtures. Those of packages/cel are in packages/cel/tests/fixtures/corpus/, and the reduction tests of the engine (packages/engine/tests/reduction.rs) have theirs in packages/engine/tests/fixtures/reduction/. A fixture is YAML made for its tests and holds only what they read: the cells, and fictional rulework and reductions cut down to the articles and outputs a test exercises. The real laws these tests build on are replaced by fictional mini-versions in the same fixtures, each after a real act (test_general_administrative_act after the Awb, test_school_leave_act after article 13a of the Leerplichtwet 1969, test_traffic_decree after the BABW). They keep the article numbers of that act, so a test can still say which article it exercises.
packages/engine/tests/golden_tests.rs runs the JSON cases in packages/engine/tests/fixtures/*.json, each a law as YAML text with parameters and an expected result. Conformance describes their format and where they came from.
packages/engine/tests/trace_integration.rs evaluates a decision across laws, compares each rendered trace with its snapshot (expected_allowance_trace.txt, expected_premium_trace.txt), and checks what each step of the trace carries. It reads a fictional chain in packages/engine/tests/fixtures/trace/: an allowance act that reads a register, calls an income act and leaves an open term to a regulation, and a mini general act whose two hooks fire on the decision. That is what a trace across laws shows. A rulework added to the chain can fire a hook and change the expected trace. A few unit tests in packages/engine/src (article.rs, resolver.rs, service.rs) read the same chain, and one of them counts its ruleworks.
packages/engine/tests/typecheck_corpus.rs runs the static type check over the corpus, the demo corpus and the corpus of the chronolexografie PoC, and fails on any finding. Unlike the trace test it reads the live corpora on purpose, because it guards the corpus.
Checks that the Rust law-model accepts exactly what the JSON schema accepts. It is a different suite from engine conformance, BDD bucket B: that one runs scenarios, this one compares the model with the schema. just test includes it. What it covers, and what conformance does not cover yet, is on Conformance; adding a fixture is described in packages/engine/tests/schema_conformance/README.md.
Every rulework is validated against the JSON schema. Without arguments, just validate checks the corpus (corpus/regulation), the ruleworks and reductions of the chronolexografie PoC, and the fixtures of the cell’s BDD suite (packages/cel/bdd/fixtures: its regulation/ directory and the reductions of its cell), the regulation/ directory of each construct in packages/cel/bdd/constructs, the fictional ruleworks of bucket B in bdd/conformance/fixtures/regulation, and the fictional outside corpus in bdd/external-corpus-example. It leaves the demo corpus out; just validate-demo covers that. The pre-commit hook runs the same recipe on the changed files in all of these directories, the demo corpus included, and CI runs the hooks over the whole tree.
just frontend-test runs the unit tests and type checks of the editor, lawmaking, the demo, the shared package and the chronolexografie PoC. just test-e2e builds the engine to WASM and drives the editor with Playwright against mocked backends. Where frontend code and its tests go is on Frontend code.
just smoke-preview is the one test that runs against a deployed editor: a preview by its pull request number, or a URL. It logs in through the real Keycloak and needs the test user’s credentials, so CI does not run it. Deployment covers previews and waking one up first.
just demo-check checks the demo end to end: the laws, their scenarios, the frontend tests, and the WASM build. Run it before pushing anything demo-related.
The recorded walkthrough has two checks. just walkthrough test runs the pytest suite of the pipeline that cuts and subtitles the takes, in script/walkthrough/tests/. just walkthrough verify replays every chapter headless and names each recorded action that finds nothing on the page, which is the CI job “Rondleiding speelt terug”. The route from recording to release is on Demo.
The scripts in script/ that decide something in CI, such as a merge gate or the orphan check, have a test suite next to them: script/<name>.test.sh or script/<name>.test.mjs. A pre-commit hook runs each suite when the script or the workflow it guards changes, and a just recipe runs it by hand (just ci-gate-test, just orphan-tests-test). just check runs most of them; CI runs every hook in the Pre-commit job. Change a script that decides green or red together with its suite.
npm run check:source in docs/ checks the docs without building them. Among other things it checks that cited paths exist, that Gherkin steps are in the grammar, the prose style, and the RFC numbering and coverage. just docs-a11y builds the site and runs the accessibility gate, pa11y included. The writing rules behind the prose check are in the docs-writing skill.
cargo-mutants checks whether the tests actually pin behavior or merely execute it. CI runs the diff variant as a gate on changed code. The weekly full run (mutation-testing.yml) mutates the engine and the cell and opens an issue with what survived.
Line coverage is no measure of this. A line counts as covered when a test runs it, whether or not an assertion depends on what it computed. Read a coverage percentage as context next to the mutation results, never on its own.
cargo-mutants breaks the Rust code and runs the Rust tests. It does not run the BDD suites, which are test = false, so it says nothing about whether the language suites pin a construct. Bucket B is the contract every engine has to meet, and an engine other than the Rust one has none of the Rust unit tests behind it.
Construct mutation asks that question of the law format. just construct-mutants breaks one construct at a time in every synthetic test_* rulework. ADD becomes SUBTRACT, GREATER_THAN becomes GREATER_THAN_OR_EQUAL, an EQUALS gets wrapped in a NOT, the hooks of an article are dropped. Real ruleworks in the corpus are left alone.
With one construct broken, the run executes bucket B and the cell’s suite. A construct is pinned when either suite turns red. The mutations keep the rulework valid against the schema, so a red suite usually means an assertion noticed. It can also be a run-time error the mutation caused, such as a division by zero after MULTIPLY became DIVIDE; the run counts that as pinned too. The same holds for a mutant the engine’s type check refuses when it loads. Removing nullable, an implements or the defaults of open_terms can do that, and then every scenario turns red without an assertion having noticed.
The mutations are in packages/engine/tests/common/construct_mutation.rs, and the driver and its report in script/construct-mutants.mjs. A construct the run has no mutation for is listed in NOT_MUTATED in the same file, with the reason. packages/engine/tests/construct_coverage.rs runs with the other Rust tests and fails when the schema has an operation or a property in neither list, so a new construct arrives with a decision about how its tests are measured.
bdd/construct-gaps.txt lists the constructs that no scenario pins yet. The workflow Construct mutation runs the check on a pull request that changes the scenarios, the synthetic ruleworks, the schema or the mutations. It turns red when a construct that is not on the list is not pinned. It also turns red when a listed gap gets pinned, so a gap leaves the list as soon as a scenario covers it. In CI it runs in four shards of about six minutes each. It also runs weekly, and the issue of the weekly mutation run carries its report.
Performance benchmarks using Criterion:
just check runs formatting, lints, a build check, schema and annotation validation, the script test suites, and the full Rust test suite. It needs no npm dependencies. Run it before pushing, and after a frontend change also just frontend-test: the frontend unit tests and type checks, as CI runs them. The Playwright suite is just test-e2e.
The first three also run on their own, and the pre-commit hooks call them the same way:
A test that no CI job starts never fails, so a missing hook or step goes unnoticed for months. An audit of the repository in October 2026 found seventeen. just orphan-tests (script/check-orphan-tests.mjs) reads what CI runs: the steps in .github/workflows/, the pre-commit hooks, and every Justfile recipe and npm script those reach. It fails on any of these:
*.test.ts, *.test.js or *.test.mjs file that no command names and that no vitest run in CI picks up through its config’s include and exclude*.test.sh or test-*.sh script that no hook or step runs, directly or through a recipe that one of them callscargo test in CI covers.feature file that no BDD runner in CI reads. The engine reads the directories that BDD_BUCKET and REGULATION_PATH select per step; the PoC runners are listed in BDD_RUNNERS in script/orphan-tests.mjs@wip tag or an #[ignore] without a comment that says why, above it or on the same line (#[ignore = "..."] counts too)The guard skips two directories. Bucket A over the live laws in corpus/regulation stays out of CI on purpose. bdd/external-corpus-example does run, but through the inputs of the reusable workflow, which the guard cannot read. EXCEPTIONS in script/orphan-tests.mjs records both reasons. The guard runs as a pre-commit hook and therefore in the Pre-commit check. Its own suite is just orphan-tests-test, with a passing and a failing case for each rule.
It reads YAML and shell line by line and leans towards counting a test as run. A recipe with a case counts as running every branch, and a file counts as run once it is the command or an argument of an interpreter such as node or bash. The vitest include and exclude lists and the cargo flags that narrow a run (--no-run, --lib, --test) decide what a run covers. Beyond those, a test drops out only through a literal if: false on its step or job, a leg under a matrix exclude, or a hook that CI never runs. Any other condition still counts as a run. So does a workflow that only runs on a schedule, and so does a step with continue-on-error. Playwright *.spec.* files and the pytest suites are outside its scope. Whether a test that runs also tests something is still a question for review.
An exploration into transparent, executable legislation, and one of the three projects in the starting selection of the Nederlandse Digitale Dienst.
GitHub repository
How it works
Demo walkthrough
Stay informed
Roadmap (Dutch)
Documentation
Research
Basiswerk recht (Dutch)
Nederlandse Digitale Dienst
Ministry of Economic Affairs and Climate Policy