Released docs. You are viewing the documentation published with v0.48.0. Development docs are available at Latest.
If you are writing a registry project, rstack dev runs it on your machine. It starts the products
the project lists, runs short scenarios against them, and removes everything when you stop. One
product is enough: you do not need the others to try yours. This page starts with one product on its
own, then runs several together, and ends with the reference for the plan, applications, issuer
binding, isolation and recovery.
Before you start
Section titled “Before you start”You need:
- Docker. A run starts its own PostgreSQL server in a container, so the first run pulls the image and needs network access. If you cannot use Docker, run your own server and read Use a PostgreSQL server you run.
curl.- A checkout of Registry Stack at the release you installed, for the example projects.
A plan that lists only Evidence starts no database and needs no Docker.
Install the components
Section titled “Install the components”Install rstack from one verified release, then add the component your project uses, such as Base
Registry Engine (BReg). The steps are in
Decide your first Base Registry Engine registry.
rstack install bregCheck the selected installation before you continue:
rstack components listSuccess is a breg line that says installed. available means that the selected release
provides the component but it is not installed, so run the rstack install command again.
unavailable means that the selected release does not provide the component for your platform. If
your shell cannot find rstack, or the command says No installation selected, repeat the verified
rstack installation steps linked above. rstack dev asks only for the components the plan lists,
so a BReg-only project needs no casework.
Build from source
Section titled “Build from source”If you build the components yourself, build the command-line tool and the server of each product you
run in one command, then tell rstack where they are with the RSTACK_*_BIN variables:
cargo build --locked -p registry-bregctl -p registry-breg --features registry-breg/runtime --binsexport RSTACK_BREGCTL_BIN="$PWD/target/debug/bregctl"export RSTACK_BREG_BIN="$PWD/target/debug/breg"Casework uses RSTACK_CASEWORKCTL_BIN and RSTACK_CASEWORK_BIN the same way, and Evidence uses
RSTACK_EVIDENCECTL_BIN and RSTACK_EVIDENCE_BIN. Rebuild after every source change, because a
stale binary fails the run in confusing ways.
On macOS, a source build of the products links a dynamic FIPS library that the loader cannot find,
so a binary started outside Cargo aborts with Library not loaded. Source the helper in your
current shell and build through it, as CONTRIBUTING.md in the checkout describes. Installed
releases do not need this.
The development runner is the crates/registry-rstack-dev crate. Each supported product CLI links
it behind a hidden subcommand, and rstack dev runs it through the CLI of the plan’s first product
in the order BReg, Casework, Evidence, Messaging.
Run one product on its own
Section titled “Run one product on its own”The BReg minimal example is a small directory registry with a plan file, dev.yaml, and one
scenario. Copy it from your checkout and work in the copy:
cp -R path/to/registry-stack/products/breg/examples/minimal ./directoryrstack dev reads dev.yaml and the scenario file it names. Product files stay byte-for-byte
unchanged, and generated settings, keys and packages live in the run’s owner-only scratch
directory. Check the plan, then start the run:
rstack dev check ./directoryrstack dev start ./directory --ttl 30mcheck validates the plan and resolves its fixtures, grants and references with the installed
authoring tools. It works with the database offline and needs no Docker. Success is
Development plan is valid and exit status 0. Add --deny-warnings to refuse any warning. With the
global --format json option, check writes a BRegCtlReport with command set to dev-check.
Fix every error before you start: the report names the plan field that caused it.
start pulls the PostgreSQL image on the first run, creates databases and logins for the run,
starts BReg on a loopback port, runs the scenario, and returns while BReg keeps running. The time to
live (TTL) begins when the run is ready and defaults to 30 minutes. --ttl takes one whole number
from 1s to 24h with an s, m or h suffix:
Run 2f17770cb47d4502ad0b809a529f4309 ready breg http://127.0.0.1:64930 Scenario directory-contact passed Logs STATE_DIRECTORY/2f17770cb47d4502ad0b809a529f4309/logs rstack dev token 2f17770cb47d4502ad0b809a529f4309 --as editor rstack dev token 2f17770cb47d4502ad0b809a529f4309 --as foreign-editorYour run ID and port differ, and STATE_DIRECTORY stands for the state directory your run reports.
Copy the run ID: every later command takes it. The scenario has already created a contact and read
it back. rstack dev status RUN_ID repeats this report at any time.
Call the product with a token
Section titled “Call the product with a token”token writes a short-lived bearer header file for a test person and prints where it is. Tokens
expire five minutes after issue, or with the run if that is sooner, so ask again when one lapses.
Pass the header file to curl with --header @FILE:
RUN=2f17770cb47d4502ad0b809a529f4309HEADERS="$(rstack dev token "$RUN" --as editor | awk '$1 == "breg" && $2 == "headers" {print $3}')"curl -sS --header @"$HEADERS" http://127.0.0.1:64930/v1/records/contactsUse the BReg URL from your own report. The response lists the contact the scenario created:
{"items":[{"domainData":{"email":"contact@example.test","jurisdiction":"zone-a","name":"Example contact"},"recordIdentifier":"1a34839c-66d8-44d2-a7aa-136de5615d07","revisionIdentifier":"1"}],"meta":{"datasetIdentifier":"directory","recordTypeIdentifier":"contact","registryIdentifier":"local-directory"},"pageInfo":{"nextCursor":null}}Stop the run
Section titled “Stop the run”rstack dev stop "$RUN"Success is Run RUN_ID stopped. Stop, and TTL expiry, terminate the services and remove the run’s
databases, roles, keys, files and containers.
Other products on their own
Section titled “Other products on their own”Casework runs on its own the same way. The products/casework/examples/standalone-decision
example lists only Casework, creates a request as one test person, and has another decide it, with
no BReg binary present.
Evidence runs on its own too, and it needs no database and no Docker. The
products/evidence/examples/standalone example lists only Evidence and asks it for an adult-status
assertion as one test person. Evidence reads a data source, so start the example’s synthetic source
in its own terminal, in the copy of the example:
python3 serve-source.py --port 8081Then run the plan from another terminal in the same directory:
rstack dev start .Success is Scenario ask-adult-status passed and one evidence URL. The run is its own issuer, so
the plan sets issuer: run and the test token’s requester tag is the grant’s profile, which
must be a tag the requesterTags of an access profile in your dev-authority.yaml lists. The run
uses your local-target.yaml and the authority it names. The run packages the project, activates
its authority and starts evidence serve inside the run directory. It never writes to your project.
rstack dev stop RUN_ID removes everything. Evidence on its own has the
details.
Messaging runs without contacting a real provider. For each provider in the project’s
messaging.yaml, the run starts a sink on loopback: Mailpit in a labelled Docker container for an
smtp provider, and a mock gateway inside the supervisor for an http provider. The gateway
answers each send with queued and then posts a signed delivered callback to the run’s Messaging
runtime. A plan with an smtp provider needs Docker for Mailpit even when you supply the database
by address. stop, TTL expiry and --recover remove Mailpit with the run. The
products/messaging/examples/starter example sends one SMS through the gateway as a scenario.
Messaging and its sinks has the details.
Read the run report
Section titled “Read the run report”The start and status reports carry two maps for tools that work beside the run. With the global
--format json option they are runtimeConfigs and sinks in the registry.rstack.dev.v1 report.
The human report prints the same facts.
runtimeConfigsmaps each product to the absolute path of the runtime configuration the run wrote for it. For Evidence it is<run>/evidence-candidate/runtime.yaml. Pass that path toevidencectl request prepare --runtime-configinstead of guessing it. The human report prints oneRuntime config PRODUCT PATHline per product. Only the address line starts with the product name, soawk '$1 == "breg" {print $2}'reads the address.sinksmaps each Messaging provider to its sink, where you can read what the run sent:{"type":"smtp","smtp":"HOST:PORT","url":"MAILPIT_URL"}for Mailpit, or{"type":"http","url":"GATEWAY_ORIGIN/sent"}for the mock gateway. It is absent when the run has no sink.
Run several products together
Section titled “Run several products together”The licensing example that ships with Registry Stack runs BReg and Casework as a pair. Copy it and work in the copy:
cp -R path/to/registry-stack/products/platform/examples/licensing ./licensingThe directory holds a BReg project (registry/), a Casework project (casework/) and the plan
dev.yaml. Install casework beside breg with rstack install casework, then check and start
the plan as before:
rstack dev check ./licensingrstack dev start ./licensing --ttl 30mThe report names a URL for each product and a scenario result, and lists every test person:
Run 2f17770cb47d4502ad0b809a529f4309 ready breg http://127.0.0.1:64930 casework http://127.0.0.1:64931 Scenario licensing-approval passed Logs STATE_DIRECTORY/2f17770cb47d4502ad0b809a529f4309/logs rstack dev token 2f17770cb47d4502ad0b809a529f4309 --as administrator rstack dev token 2f17770cb47d4502ad0b809a529f4309 --as applicant rstack dev token 2f17770cb47d4502ad0b809a529f4309 --as intake rstack dev token 2f17770cb47d4502ad0b809a529f4309 --as reviewerThe scenario has already created an application in BReg and had a reviewer approve it in Casework. A test person’s header file covers each product the person has a grant for, so ask for the token of the person you want and pass the header line that names the product you call:
RUN=2f17770cb47d4502ad0b809a529f4309HEADERS="$(rstack dev token "$RUN" --as applicant | awk '$1 == "breg" && $2 == "headers" {print $3}')"curl -sS --header @"$HEADERS" \ "http://127.0.0.1:64930/v1/records/applications?accessProfile=applicant"BReg needs the selected profile as the accessProfile query parameter when the project declares
more than one profile. The response lists the application the scenario created:
{"items":[{"domainData":{"profession":"Surveyor","reference":"application-001"},"recordIdentifier":"23257c7f-1acd-4fbf-8a3c-4b253238043c","revisionIdentifier":"1"}],"meta":{"datasetIdentifier":"licensing","recordTypeIdentifier":"application","registryIdentifier":"licensing"},"pageInfo":{"nextCursor":null}}Casework needs no query parameter, because its header file carries the profile. This asks for the reviewer’s open tasks. The queue is empty because the scenario already decided the request:
HEADERS="$(rstack dev token "$RUN" --as reviewer | awk '$1 == "casework" && $2 == "headers" {print $3}')"curl -sS --header @"$HEADERS" "http://127.0.0.1:64931/v1/review-tasks?queue=applications"{"items":[],"status":"complete"}Stop the run with rstack dev stop "$RUN".
Adapt the development plan
Section titled “Adapt the development plan”To adapt a plan to your own project, change these parts and leave the structure alone:
issuernames the identity issuer the local test tokens claim. Use a name that is yours.productslists each product’s project directory and token audience, in any order. Name any non-empty subset ofbreg,casework,evidenceandmessaging. The run starts BReg before Casework. An application needs BReg.peopledeclares synthetic test people, each with a subject and one grant per product. A grant selects an access profile of that product’s project, its scopes, and extra claims. A BReg grant must name a profile the BReg project declares. When several people could fill a BReg schema-test step,schemaTestPeoplenames the one that does.scenarioFilenames the project-relative file (for exampletests/scenarios.yaml) whose scenarios the run makes before it reports ready. The plan must set it; an inlinejourneykey is refused, so move those steps into the file. Each step names a person, a product, a method, a path starting with/v1/, and what it expects back. The file path cannot contain..or backslashes. The start and status reports includescenarioDigestfor the exact file bytes captured at start. When the BReg project is the development project root (project: .), keep the scenario file out oftests/, as the minimal example does withdev/scenarios.yaml:bregctl checkreads every YAML file directly undertests/as a BReg test. A scenario takes its BReg access profile from the test person’s grant, so do not repeat it asaccessProfilein a step path. A path that names a different profile than the grant’s is refused at check time.
Write the development plan describes every key, capture type, and limit.
| Format and files | Check command |
|---|---|
Registry Stack development plan
| rstack dev check <project> |
Registry Stack authored development scenarios
| rstack dev check <project> |
A BReg project with encrypted fields runs without extra setup: each run gets its own development
data key, removed when the run ends, so encrypted data does not outlive its run. A step in the
project’s tests/journeys.yaml that touches an encrypted Record type fails the pre-activation
test, because that test has no key. Exercise those Record types in an authored Stack scenario
file instead.
A plan can also start one already-built local application beside the products (Start a declared application), and can bind an existing Casework producer to the run’s issuer for a BReg and Casework pair (Bind an existing Casework producer to a run). Most projects need neither.
When a run fails
Section titled “When a run fails”A failed scenario is different from a startup failure. start exits 1 but prints the normal run
report, with the failed step and its reason. With the global --format json option, its
schema_version is registry.rstack.dev.v1 and its status is ready. The report has
scenarios[*].result, with at least one failed, and scenarioDigest (sha256:<hex>) identifies
the exact file bytes captured at start. The services keep running, and rstack dev status RUN_ID
repeats the results and digest, so use the run ID to inspect the products and logs before you stop
the run.
Other refusals and failures print rstack dev: MESSAGE on standard error. With --format json, the
report is one object on standard output with schema_version registry.rstack.error.v1 and
status refused. The process exit status and error.class identify the kind of failure:
| Exit | error.class | Meaning |
|---|---|---|
| 1 | domain | The request, the project, the plan or the run’s state was refused. Fix the plan or the command. |
| 2 | usage | The command line is wrong, such as a malformed run ID, --ttl or test person name, or a run ID that is unknown or already cleaned up. |
| 3 | operational | The environment failed: PostgreSQL or Docker is unreachable or refuses the administrator, a product binary cannot start, no loopback port is free, a product or the run does not start in time, or a run needs its resources released. |
For example, rstack dev start ./directory with Docker stopped is an exit 3 failure whose message
names the Docker command that failed and both ways out: start Docker, or supply a server with
RSTACK_DEV_DATABASE_URL. Start Docker and run the command again.
When a start fails before the run becomes available, the run directory and its containers are
removed but its logs are kept at <state>/failed/<run_id>/logs, and the error names the path. A
live run’s logs are in <run>/logs: supervisor.log for the supervisor and one file per product
stage, such as breg-check.log or casework-runtime.log. rstack dev status RUN_ID names the logs
directory. Delete kept logs yourself.
If the supervisor stops while a run is live, rstack dev stop RUN_ID retries cleanup for 60 seconds.
If it still cannot release the run, it says the supervisor was lost and prints the command that
recovers it:
rstack dev stop RUN_ID --recoverIf the supervisor is still running, use plain stop. For a lost supervisor, its process guards
stop the products and any product tools still running. Recovery waits for the guards, drops the
databases and roles, removes the run’s containers, and removes the run directory, including its
development key file. When you supplied the server by address, use the original PostgreSQL cluster
and maintenance database for --recover. If a cleanup step fails, the report explains what to
inspect before retrying. Recover a run lists the manual steps and the recovery
fields.
The managed PostgreSQL server
Section titled “The managed PostgreSQL server”With no --database-url and no RSTACK_DEV_DATABASE_URL, a run that lists breg, casework or messaging starts its own server.
A plan with only evidence starts no database and needs no Docker.
- The server is a
postgres:18.7container, pinned by digest. A BReg project that requires PostGIS getspostgis/postgis:18-3.6instead. That image is published for linux/amd64 only, so on Apple Silicon it runs emulated and a spatial run takes about a minute. - The first run pulls the image, so it needs network access and takes longer.
- The container publishes its port on
127.0.0.1only. The runner draws a CA for the run, and the server uses TLS withverify-full, as the products require. - The container carries the label
org.registrystack.rstack.dev-run=RUN_ID.stop, TTL expiry, a failed start andstop --recoverremove it, and any Mailpit container of the run, by that label. - The administrator is a superuser with a generated password.
Anyone who can run
docker inspecton the container can read that password. Docker access already grants root on the host, so the throwaway server adds no new exposure. The least-privilege administrator described below protects a shared or hosted server. - If Docker is missing or its daemon does not answer,
startfails with an operational error that names both ways out: install Docker, or supply a server by address. - Recovering a managed run needs Docker, not an administrator URL.
RSTACK_DEV_DATABASE_CAwithout a URL is refused.
Use a PostgreSQL server you run
Section titled “Use a PostgreSQL server you run”Use a server you run when you cannot use Docker, or for hosted Studio, CI, or a shared server.
Set RSTACK_DEV_DATABASE_URL to its administrator URL and, if its certificate is not publicly trusted, RSTACK_DEV_DATABASE_CA to the CA file.
Use a least-privilege administrator there.
The server must be PostgreSQL 17 or newer and must serve TLS.
The runner always verifies the server certificate and host name.
It trusts the platform’s roots, or the CA bundle in PEM format named by RSTACK_DEV_DATABASE_CA.
The administrator role named in the URL needs LOGIN CREATEROLE CREATEDB.
Superuser is not needed for a non-spatial run.
The runner sets createrole_self_grant on its own sessions, so you do not configure it.
The administrator also installs btree_gist, which PostgreSQL treats as a trusted extension.
The runner reads pg_catalog.pg_control_system() to identify the cluster for recovery.
PostgreSQL allows this function by default.
The administrator URL always carries a password.
Set it through RSTACK_DEV_DATABASE_URL, because --database-url is visible to other local users in the process list.
The URL must be a postgres:// or postgresql:// URL with one TCP host, a user, a password, and one database name.
Percent-encode special characters in the password.
The URL accepts these query parameters and refuses all others:
sslmode:require,verify-ca, orverify-full. The runner verifies the certificate and host name whichever you choose.connect_timeoutandapplication_name.sslrootcertis refused. SetRSTACK_DEV_DATABASE_CAinstead.
Spatial projects
Section titled “Spatial projects”A spatial BReg project needs PostGIS 3.5 or later installed on the server.
The administrator must be allowed to CREATE EXTENSION postgis, which normally means a superuser or the managed service’s equivalent.
The run checks that the server offers a supported PostGIS before it creates anything.
A local server
Section titled “A local server”This is the one recipe for a local server by address.
It needs PostgreSQL 17 or newer command-line tools (initdb, pg_ctl, psql) and openssl on your PATH.
It makes a private certificate authority, starts the server on 127.0.0.1, and creates a least-privilege administrator.
Keep the working directory outside any repository.
If port 5432 is taken, change PORT.
export DEV="$HOME/rstack-dev-postgres"PORT=5432mkdir -p -m 700 "$DEV"umask 077openssl rand -hex 16 > "$DEV/postgres.pass"openssl rand -hex 16 > "$DEV/devadmin.pass"initdb -D "$DEV/data" -U postgres --auth=scram-sha-256 --pwfile="$DEV/postgres.pass" -E UTF8
openssl req -new -x509 -newkey rsa:2048 -nodes -days 30 -subj /CN=rstack-dev-ca \ -addext basicConstraints=critical,CA:TRUE -keyout "$DEV/ca.key" -out "$DEV/ca.pem"openssl req -new -newkey rsa:2048 -nodes -subj /CN=localhost \ -keyout "$DEV/data/server.key" -out "$DEV/server.csr"printf 'subjectAltName=DNS:localhost,IP:127.0.0.1\nextendedKeyUsage=serverAuth\n' \ > "$DEV/server.ext"openssl x509 -req -in "$DEV/server.csr" -CA "$DEV/ca.pem" -CAkey "$DEV/ca.key" \ -CAcreateserial -days 30 -extfile "$DEV/server.ext" -out "$DEV/data/server.crt"
printf "listen_addresses = '127.0.0.1'\nport = %s\nssl = on\n" "$PORT" \ >> "$DEV/data/postgresql.conf"pg_ctl -D "$DEV/data" -l "$DEV/postgres.log" -w startThe passwords are random and stay in owner-only files, so nothing secret reaches your shell history or a process list. Create the administrator with the password from its file:
CONNECTION="host=127.0.0.1 port=$PORT user=postgres dbname=postgres sslmode=verify-full sslrootcert=$DEV/ca.pem"PGPASSWORD="$(cat "$DEV/postgres.pass")" psql "$CONNECTION" <<'SQL'\set pw `cat "$DEV/devadmin.pass"`CREATE ROLE devadmin LOGIN CREATEROLE CREATEDB PASSWORD :'pw';SQLSuccess is CREATE ROLE.
The server must be running before you start a project.
Point rstack dev at it:
export RSTACK_DEV_DATABASE_CA="$DEV/ca.pem"export RSTACK_DEV_DATABASE_URL="postgresql://devadmin:$(cat "$DEV/devadmin.pass")@127.0.0.1:$PORT/postgres?sslmode=verify-full"For a spatial project, install PostGIS for this server and create the administrator as a superuser instead.
Stop the server when you finish with pg_ctl -D "$DEV/data" stop.
Write the development plan
Section titled “Write the development plan”The plan file starts with the schema modeline that editors read, as the licensing example’s dev.yaml does.
A versioned plan schema, products/platform/generated/dev/dev.v1alpha1.schema.json, validates it: apiVersion is id.registrystack.org/formats/rstack/dev/v1alpha1 and kind is RStackDev.
List the project’s issuer, product directories, and audiences in any order (the run starts BReg before Casework), and the test people with synthetic subjects and exact product grants.
A grant selects the access profile, scopes, and additional claims.
Each selected profile gets the test person’s subject in its principal claim.
The products enforce their ordinary permissions.
If several people match a step in the BReg project’s tests/journeys.yaml, select its alias under schemaTestPeople.<journey-id>.<step-id>.
The run obtains the normal schema-test receipt before packaging.
Every BReg grant must name an access profile the BReg project declares, including a profile that carries only proposal permissions and so belongs to no entity.
rstack dev check refuses a grant that does not, and so does start, before it provisions anything.
The error names the plan pointer, for example /people/NAME/grants/breg/profile.
A Casework grant must name an access profile of the Casework project, reported at /people/NAME/grants/casework/profile.
The run does not compare scopes with the profile: a profile’s required scopes are a per-entity rule, and a mismatch appears as a failed scenario step.
Native review handoff
Section titled “Native review handoff”For a native review handoff, bindings.bregReviewAuthority identifies the Casework producer, and bindings.caseworkContextProvider identifies the BReg context provider and action.
rstack dev check refuses a binding that names a review authority or action the BReg project does not declare, or a producer or context provider the Casework project does not declare.
start refuses it before it provisions anything.
check also writes each binding’s product configuration exactly as start does.
caseworkctl check --runtime-config on the Casework configuration refuses what Casework would refuse at startup, and check reports the refusal, with the rule it broke, at the plan field that produced the value.
BReg checks its review-authority configuration when the run starts it.
check refuses a BReg grant profile that is not the service-status profile the Casework context provider’s policy names.
A binding requests tokens for the other product’s audience as an OAuth resource, so that audience must be an absolute URI, such as urn:example:review.
It requests the scopes of its identity’s grant for that product.
Those scopes must be OAuth scope-tokens (no quotes or backslashes) that fit in 4096 bytes when joined by spaces.
check reports a violation at the audience or the grant’s scopes.
The run pairs the provider on a private copy before packaging.
A reviewer whose Casework context call forwards the bearer to BReg declares both grants, one shared client, and caseworkContext: true.
Both grants declare the same scopes and additional claims.
Casework reads the token subject or the BReg principal claim.
The token carries both audiences and the authority explicitly shared by both grants.
The native review example at products/breg/acceptance/reviewed-evidence-journey/dev.yaml declares one.
Evidence on its own
Section titled “Evidence on its own”An Evidence plan starts no database and needs no Docker.
The run is the issuer: Evidence’s local target accepts only a loopback issuer, so the plan sets issuer: run, and the run signs each test token with a throwaway key it serves as a key set on its own loopback origin.
An Evidence plan may not declare an application, and it may not name another issuer.
To start Evidence, the run copies the project and creates a target with evidencectl target new, from the project’s local-target.yaml when it has one, with development secrets for what that target references.
It points the target at the run’s issuer, listener and package directory, packages the project, activates the compiled authority and runs evidence serve.
All of it lives in the run directory, and the project is never written.
The package directory is made read-only because Evidence refuses a package that is writable.
The run makes it writable again when it removes the run directory.
An Evidence grant’s profile is the requester tag the token carries in evidence_tags.
Use a tag the project’s access profile admits.
A project with a local-target.yaml runs with that target and the authority it names, for example dev-authority.yaml, so use a tag one of its profiles lists in requesterTags.
A project without one gets a target made from its definitions’ ceilings, which admits local-service.
The grant’s claims supply the rest, for example evidence_audience.
Each token also carries registry_actor_kind: service unless the grant’s claims set another kind, and the person’s subject is the token’s sub.
The run does not start the project’s data source.
Start it first, as the project’s README says.
The example at products/evidence/examples/standalone needs python3 serve-source.py --port 8081 running in its directory.
Messaging and its sinks
Section titled “Messaging and its sinks”A Messaging plan runs against a development PostgreSQL server like BReg and Casework.
The run never contacts a real provider.
It starts a sink for each provider the project’s messaging.yaml declares, on loopback and labelled with the run:
- An
smtpprovider sends to Mailpit, amailpitcontainer pinned by digest that publishes its SMTP and web ports on127.0.0.1only. It carries the labelorg.registrystack.rstack.dev-run=RUN_ID, sostop, TTL expiry, a failed start andstop --recoverremove it with the run. A plan with ansmtpprovider needs Docker for Mailpit even whenRSTACK_DEV_DATABASE_URLsupplies the database. The first run pulls the image. - An
httpprovider sends to a mock gateway that runs inside the supervisor on a loopback port. It accepts only the run’s gateway token, answers each send withqueued, and about a quarter of a second later posts a signeddeliveredcallback to the run’s Messaging runtime. A project whose provider declaresreceipts: callbackgets the callback verifier the runtime requires. The token and callback key are files under the run directory. The gateway keeps the last 1000 sends and lists them atGET /senton its origin.
The run report lists each sink under sinks.
A scenario can call the Messaging API as a test person and poll for the delivery report, as the starter example, products/messaging/examples/starter/dev.yaml, does with send-a-reminder-sms.
Authored scenario file
Section titled “Authored scenario file”dev.yaml must set scenarioFile, for example scenarioFile: tests/scenarios.yaml.
A plan without it is refused, and so is a plan with an inline journey key: move its steps into the scenarios file and set scenarioFile.
The path must stay inside the development project.
Absolute paths, parent components, backslashes, and symlinks escaping the project are refused.
When the BReg project is the development project root (project: .), keep the scenario file out of tests/, as the BReg minimal example does with dev/scenarios.yaml.
bregctl check reads every YAML file directly under tests/ as a BReg test and warns about a directory it does not read.
The file follows the Stack scenarios schema, products/platform/generated/dev/scenarios.v1alpha1.schema.json:
apiVersion: id.registrystack.org/formats/rstack/scenarios/v1alpha1kind: RStackScenariosscenarios: - id: read steps: - id: list product: breg as: operator method: GET path: /v1/records/records expect: status: 200The file contains 1 to 16 uniquely named scenarios, each with 1 to 32 steps, and no more than 64 steps in total.
Each scenario follows the step, expectation, and capture rules in Scenario steps.
Captures are available only to later steps in the same scenario.
{{run.issuer}} is the one run value available in strings; it resolves to the effective issuer URL after the runner binds its loopback port.
Other references must name an earlier capture.
The runner reads and validates the file during check and start, then snapshots its content before execution, so edits after start do not alter that run.
Scenarios execute in file order and each gets fresh captures.
The BReg project’s tests/journeys.yaml remains its separate native schema test input.
The Stack scenario file does not replace or change it.
A scenario step takes its BReg access profile from the grant of the test person it runs as.
A step path that names accessProfile itself is accepted only when it names that same profile, and the check refuses any other value with the step, both profiles and the fix.
Scenario steps
Section titled “Scenario steps”A scenario runs 1 to 32 steps in order.
Each step names the test person it runs as (as), the product, the method, and a relative path that starts with /v1/.
A step sends one of two request bodies:
bodyis a JSON body.rawis a non-JSON body for methods other than GET:contentTypeandbase64.
A step can also set the If-Match, Idempotency-Key, and Registry-Source-Profile headers.
Use URI-safe characters for values in a path.
Each step asserts the response with expect:
statusis one accepted HTTP status from 200 to 599, or a list of up to 16.jsonmaps JSON pointers to exact expected values.checkslists up to 32 assertions. Each tests one JSON pointer with exactly one ofequals,length, orcontains.codeis the problem code an error response must carry.
A step remembers values from its response under capture.
Refer to a capture as {{capture-name}} in a later step’s path, request body, header, expected value, or find value.
A step cannot use its own captures.
Capture names are unique across the scenario.
A capture has one type:
pointerremembers the string or number at a JSON pointer in the body.headerremembers a response header.etagis the supported header.findsearches the array at a JSON pointer for the one item whosewherepointer equals a value, and remembers the item’spointervalue. The step fails if no item or more than one item matches.valueremembers the value at a pointer. Withquery, the value must be a URL, and the capture is that query parameter’s value.
Use a bounded GET poll for asynchronous delivery or result retrieval.
Set maximumWaitMilliseconds up to 60 seconds and choose a pollIntervalMilliseconds from 50 to 5000.
A scenario can make at most 512 requests and transfer at most 8 MiB of request and response bodies in total.
Token report
Section titled “Token report”token writes a short-lived bearer header file for each grant.
Its human report prints one PRODUCT headers PATH line per grant.
Its JSON report, with the global --format json option, gives the person’s alias, the expires_at time when the tokens expire (five minutes after issue, or with the run if that is sooner), and a credentials list whose entries carry the product, the selected profile, and the header_file path.
Pass the file to curl with --header @HEADER_FILE.
With BReg, include the selected profile as the accessProfile query parameter.
With Casework, the header file carries the profile.
Start a declared application
Section titled “Start a declared application”An optional application block starts one already-built local Node 24 host beside the products.
Set issuer: run for this mode and pass its built root at start with --application-root DIRECTORY; omit both for the product-only run.
check validates the declaration and deployment file without requiring the built root.
The application block names a browser client, an exact callbackPath, a local healthPath, a built entry, configuration prepare and checker files, and a deployment file relative to the development project.
It also names the configuration command’s configSchema and exact prepareVersion line, and the configEnvironment variable through which the host reads its generated file.
The built files must stay inside the supplied root; the deployment file must stay inside the development project.
The entry is explicit, including when the application uses its own default entry.
Before provisioning, start checks Node 24, the built files, and the configuration command’s --version output.
The runner picks a loopback issuer and application port.
After the product scenarios, it writes an owner-only run input with the declared schema name, real addresses, product audiences, and paths to a fresh browser-client secret and an optional Casework recovery key.
It requests separate resource grants when Casework is present, invokes the declared command with --deployment, --run, and --out, then invokes the checker with the generated configuration path.
The child receives only the declared configuration-file environment variable and runs in the built root.
The ready report adds issuer and application URLs.
status repeats them, and stop, expiry, or a crashed child stops the issuer and app alongside the products.
Configuration commands and built hosts are trusted local code supplied by the operator; the runner does not fetch or build them.
A later start creates a fresh disposable run and databases; it does not restore unfinished application work.
Browser issuer
Section titled “Browser issuer”The browser issuer presents only the plan’s synthetic test people.
It issues one resource-bound token per product after a confidential authorization-code exchange with S256 PKCE.
It grants the intersection of the requested scopes and the selected person’s scopes for that product; a request with no overlap is refused.
Browser tokens carry the same grant in scope and registry_scopes.
In application mode, name is presentation-only and registry_scopes carries the selected person’s narrowed host scopes.
Do not use either as a BReg or Casework principal claim or as an additional authored grant claim; check and start refuse those configurations.
One browser session can obtain a second product grant for the same person, and prompt=login opens the person picker again.
The authored BReg and Casework profiles still decide which client and person can use each operation.
Declare the browser client in the relevant BReg requester profiles; the runner adds it to the runtime’s accepted-client list but does not change the authored package.
Browser tokens last at most 15 minutes and expire with the run; rstack dev token continues to issue five-minute CLI tokens.
Bind an existing Casework producer to a run
Section titled “Bind an existing Casework producer to a run”A plan for a BReg and Casework pair may explicitly bind the existing review producer’s issuer on a private source copy before normal packaging.
Use issuer: run; application is optional for this exact paired binding.
Add exact old-value guards to the existing binding:
bindings: bregReviewAuthority: id: casework producer: registry identity: producer runIssuerBinding: producer: expectedIssuer: https://issuer.example.test expectedProfile: requester expectedSubject: producer initiator: expectedIssuer: https://issuer.example.test trust: run-test-peopleThe selected Casework producer must already have exactly that issuer, profile, and subject.
The existing people.producer subject and Casework grant profile must match it.
No producer, person, profile, client, scope, or grant is created.
initiator is separately optional: omission preserves trustedInitiatorIssuer, including its absence.
Opt-in requires an existing exact issuer pin and replaces it with this run’s issuer.
run-test-people acknowledges issuer-level initiator trust under the admitted producer; it is not a subject allowlist.
Existing initiator profiles, exclusion, and requester-read rules still apply.
check reads the Casework project’s casework.yaml and refuses, at the dev.yaml pointer, a binding that does not match the trusted producer it names: issuer, profile, subject, the profile’s required scopes against the identity’s Casework grant and, when the binding has an initiator, trustedInitiatorIssuer.
It allocates no issuer and provisions no database.
start runs the same check again, copies the project to a private casework-bound directory, and writes the allocated loopback issuer into the selected producer’s issuer (and its trustedInitiatorIssuer when the binding names an initiator) in the copy.
It then runs caseworkctl check on the copy, followed by normal provider pairing, new packaging, apply, and doctor.
The original project is never rewritten.
Each start allocates a reservation and signing key and prepares and packages the source again instead of loading an old bound package.
The kernel may later recycle a port; that does not reuse an old key or run.
Fixed HTTPS product-only plans remain unchanged.
An authored exact Casework policy version or digest selection is never rewritten by source binding. If the newly packaged policy no longer matches that selection, the ordinary product refusal remains authoritative.
Without application, the exact paired binding starts only product APIs.
It requires no application root, Node, or host build and admits no browser client.
The reserved loopback issuer URL is a logical issuer identifier in this mode, not a browser sign-in or discovery endpoint.
Products use the pinned static JWKS; CLI tokens and the separately served run-local machine token endpoint continue to use the same effective issuer.
The worker holds the reservation until cleanup.
issuer: run without application and without this exact paired binding is refused, except for an Evidence plan; fixed HTTP remains refused.
Explicit browser roles with separate human source credentials
Section titled “Explicit browser roles with separate human source credentials”A paired BReg and Casework built application may declare application.caseworkSourceCredentialRoles as 1 through 32 distinct existing role identifiers.
The runner forwards this exact ordered list to casework.sourceCredentialRoles in the application’s normal run input.
It does not pick roles, infer a staff profile, or modify the authored deployment.
The application’s maintained configuration command must verify that each role is served, has its existing explicit BReg mapping, is an eligible non-holder human reviewer, and agrees exactly with its authored declaration.
Missing roles, mismatches, and unsupported native client capability refuse configuration.
Omission preserves the previous run-input bytes and grant mode.
The paired application’s selected Casework provider receives humanSourceAuthentication.audience from the already declared BReg resource.
This enables independent verification of the separate source bearer; it does not change packages, issuer and key trust, principal, scope, or source authorisation.
Browser tokens keep one audience and only that product’s narrowed grant.
The shared-audience CLI caseworkContext compatibility path is unchanged.
Review and save the authored source and declaration through normal tooling before using a new generated host configuration; post-generation JSON injection is unsupported.
Run isolation
Section titled “Run isolation”Each run listens on loopback, creates separate databases and migration and runtime logins, and pins its own public signing key in the runtime files. The local issuer signs under the project’s issuer name with a key unique to the run. Use synthetic test people and keep the issuer’s private directory under your user account.
Stop and TTL expiry terminate the services and remove the databases, roles, keys, containers, and run files.
A spatial BReg run also creates a NOLOGIN role whose name starts with breg_bbox_; cleanup removes it with the others.
Encrypted fields
Section titled “Encrypted fields”A BReg project with encrypted fields runs without extra setup.
start draws a development data key for the run from the operating system’s random source and writes it as field-key in the run directory, readable only by your user.
BReg reads it through its local-file key custody, which it accepts only for a local development database.
The key is never printed, never written to the checkout, and is removed with the run directory on stop, TTL expiry, and a failed start.
When a run needs recovery, the report names the key file under recovery.field_encryption_key until stop --recover removes it.
Every run gets a new key, so encrypted data does not outlive its run.
The schema test that start runs before activation has no field-encryption key.
A step in tests/journeys.yaml that touches a Record type with an encrypted field fails it, and start reports breg test failed (test.step.failed).
Exercise those Record types in a scenario instead.
This key custody is for development only. A deployment supplies its key as Encrypt a field describes.
State directory
Section titled “State directory”The state directory holds one directory per run.
It defaults to rstack-dev-UID in the system temporary directory.
Set RSTACK_DEV_STATE_DIR to use another location.
A run directory is renamed to .<run_id>.removing before it is deleted, and status and stop ignore that name.
If the deletion is interrupted, delete that directory yourself; the run’s field-encryption key is deleted before the rename, so it holds no key material.
Recover a run
Section titled “Recover a run”If cleanup cannot finish, for example because PostgreSQL is unavailable, the supervisor retries for 60 seconds.
It then stops and reports a lost-supervisor recovery that names the stop RUN_ID --recover command.
If the supervisor is lost, the run’s process guards stop the product runtimes and any product tool that was still running.
stop and status report the run directory, the recorded process groups, and the database and role names.
Release a run whose supervisor is gone with:
rstack dev stop RUN_ID --recover [--database-url URL]Use plain stop while the supervisor is still running.
A managed run needs Docker for recovery and no URL: the command removes the run’s container by its label.
For a run on a server by address, use an administrator URL for the same PostgreSQL cluster and maintenance database used at startup, with the same administrator rights.
--database-url defaults to RSTACK_DEV_DATABASE_URL, as for start.
Recovery checks the recorded cluster identifier and maintenance database before dropping any resources.
It waits for the process guards to finish, then drops the databases and roles and removes the run directory.
If any step fails, the report gives the reason and the resources you can check before retrying.
An abrupt machine restart can stop a guard before it writes its completed cleanup receipt.
In that case --recover refuses to claim the guarded workload was reaped, even if the process no longer exists.
Verify ownership and finish cleanup with the manual steps that follow.
The same manual path applies to runs from an older development build without recovery metadata.
Recovery releases the disposable run; it does not resume its application or pending work.
A successful recovery reports status stopped and a recovered object with stopped_process_groups and databases_and_roles.
If you need to finish cleanup by hand, do it in this order:
- Verify which product processes still belong to the run and stop those groups. Use the run’s configuration paths and process details to establish ownership before signalling a group.
- Connect to the original PostgreSQL cluster as the administrator.
Run
DROP DATABASE IF EXISTS "NAME" WITH (FORCE)for each listed database. - Run
DROP ROLE IF EXISTS "NAME"for each listed role, including abreg_bbox_*role from a spatial run. - Remove the run directory.
It holds the run’s development field-encryption key when
field_encryption_keyis listed.
Error report fields
Section titled “Error report fields”With the global --format json option, a refusal or startup failure from rstack dev start, status, token, or stop prints one JSON object on standard output, validated by the rstack-dev-error v1 schema.
The launcher prints the same object for failures before the helper starts, such as a missing component.
An interrupted start is class domain.
Environment failures (class operational) also include a PostgreSQL server that cannot provision a run’s databases and roles, a cleanup that stalled, and an internal failure of the run’s supervisor.
schema_versionisregistry.rstack.error.v1andstatusisrefused.error.classand the exit status are described in When a run fails.error.messageis the human-readable reason.run_idis present when the failure concerns a run that still has resources to release. Trystop --recover; an incomplete guard receipt requires the verified manual cleanup in Recover a run.recoveryaccompaniesrun_idwhen the resources are known. It haskind(lost-supervisor),run_directory,processes,objects(or, for a managed run,container), andfield_encryption_keywhen the run directory still holds the run’s key file (the path, never the key). It carriesreasonwhen--recovercould not finish.
Without --format json, the message goes to standard error as rstack dev: MESSAGE with the same exit code.
The reports of rstack dev check use BRegCtlReport instead.
A helper started without the launcher’s request prints a plain message and exits 2.
- Call an API with rstack to make short requests against the running products.
- Test with journeys to write the BReg project’s own journey tests.
- Encrypt a field for the key custody a deployment uses.
Cookies on Registry Stack
We use optional cookies to understand how you use the main Registry Stack website and this documentation. If you contact us, we may link this activity to your enquiry. You can change your choice at any time. Read the privacy policy.
Your browser asks sites not to track you, so optional tracking stays off.
We could not use or save that choice. Optional tracking remains off.