Docs / Configuration
Configuration reference
One installation, one file: instance.toml holds everything an
installation connects to, compares, tolerates, classifies and repairs.
Format version. This page describes the single-file configuration format adopted in November 2026: one self-contained instance file, secrets as plain values, no environment variables. Parts of it arrive with the next release and are marked Next release; today, every rule kind runs: tolerance, classifier, check, policy, condition, guard and settlement rules. If your version still reads a separate schema profile or environment variables, follow the documentation shipped with it.
Contents
- The file
- Changing it
- A minimal example
[instance][databases][access][lanes][auto_apply][releases]- The schema
- Rules
- Tolerance rules
- Classifier rules
- Causes
- Evidence rules ask for
- Check, policy, condition, guard and settlement rules
- What reports record
- Trying a rule
The file
- One file is the whole configuration. There is no shared profile, no include and no environment variable: what is not in the file is a built-in default.
-
Where it is. Sentinel reads
/var/lib/parity-sentinel/instance.toml, or the file named by--config <path>. The state directory is[instance] state_dir, by default the file’s own directory. - TOML 1.0, UTF-8. Unknown keys are refused, and every error names its key, file and line.
-
Secrets are plain values: SQL passwords, Git and GitHub tokens,
Azure DevOps personal access tokens, registry credentials, the initial
administrator’s password. The file is trusted, so keep it mode
0600, owned by the service user. A file that holds a secret and that its group or others can read is a configuration problem that blocks every lane; the dashboard still starts and shows it. Secret fields are redacted wherever the configuration is shown: the dashboard, version diffs,config export(unless--with-secrets), the API, MCP and logs.
Changing it
| Command | What it does |
|---|---|
manage.py config validate FILE | Checks a file without applying it |
manage.py config apply FILE --by NAME --reason … | Applies a file as a new configuration version |
manage.py config diff A B | Shows what differs between two files or versions |
manage.py config export [--version N] | Writes a version exactly as it was applied, secrets redacted |
Every version records who applied it, when, why and which keys changed; the dashboard’s configuration page shows them with their diffs. Most settings take effect at each lane’s next cycle; the others are listed as waiting for that lane’s restart. An invalid or missing setting does not stop Sentinel: it shows as a configuration problem on every page and holds only the lanes that need it.
With [instance] editable = false the configuration is managed outside
Sentinel. The dashboard shows it read-only and config apply refuses. On
Azure the file lives in Key Vault: edit the secret there, then run
sudo systemctl start parity-sentinel-config on the virtual machine to
place the new version.
Changes to tolerances, scope, exclusions, classification rules or policies are gated Next release: they apply only with a justification and after the regression check regenerates the recorded reports and plans.
A minimal example
# /var/lib/parity-sentinel/instance.toml (mode 0600)
[instance]
name = "orders-acme"
project = "Orders Platform"
tenant = "Acme"
public_url = "https://sentinel.capsulecorp.example"
time_zone = "Europe/Berlin"
[databases.baseline]
server = "capsulecorp-orders.database.windows.net"
database = "orders_v1"
auth.mode = "managed_identity"
[databases.candidate]
server = "capsulecorp-orders.database.windows.net"
database = "orders_v2"
auth.mode = "managed_identity"
[access.initial_admin]
username = "root"
password = "change-me-on-first-sign-in"
[tables."dbo.Warehouse"]
role = "input"
natural_key = ["Code"]
[tables."dbo.PricingRule"]
role = "input"
natural_key = ["WarehouseId", "Sku"]
[roles]
context = ["dbo.Region"]
ignored = ["dbo.AuditLog"]
A real installation also declares its output tables, identity kinds and rules, described under the schema.
[instance]
| Key | Default | Meaning |
|---|---|---|
name | — | A short name for this installation |
project | required | The project this installation serves, shown on every page and report |
tenant | — | The tenant it belongs to, shown first in titles |
public_url | http://localhost:8765 | The dashboard’s public HTTPS address, for links and as the trusted origin |
time_zone | UTC | IANA time zone for dates on the dashboard |
state_dir | the file’s directory | Where the database, job evidence and keys are kept |
editable | true | false: managed outside Sentinel; shown read-only, never applied from the dashboard |
[databases]
[databases.baseline] is the database the old version writes; Sentinel
never writes it. [databases.candidate] is the one the new version writes;
Sentinel measures it and repairs its configuration tables. Both take the same keys.
| Key | Default | Meaning |
|---|---|---|
engine | sqlserver | SQL Server or Azure SQL |
server | required | Host name, such as capsulecorp-orders.database.windows.net |
database | required | Database name |
auth.mode | azure_cli | managed_identity (an Azure virtual machine), sql_password, or azure_cli (a developer machine) |
auth.client_id | — | A user-assigned managed identity’s client ID |
auth.user, auth.password | — | For sql_password; the password is a plain value |
auth.trust_server_certificate | false | Only for a test server with a self-signed certificate |
[databases] odbc_driver names the ODBC driver, by default ODBC Driver 18 for SQL Server.
[databases.candidate]
server = "capsulecorp-orders-next.database.windows.net"
database = "orders_v2"
[databases.candidate.auth]
mode = "sql_password"
user = "sentinel"
password = "a-long-generated-password"
[access]
Sentinel has its own sign-in (mode = "django", the default): every page,
the API and MCP need a signed-in user or a user’s API token.
[access.initial_admin] creates the first administrator. While no active
administrator exists, Sentinel creates this user, at start or on the next request, so
a corrected file needs no restart. Once any administrator exists the block is ignored:
it never creates a second administrator and never changes or resets anyone. The
password must have at least 12 characters, must not be a common password or only
digits, and must not resemble the username; a block that fails is refused without
repeating the password.
With no administrator and no usable block, Sentinel has a configuration problem:
every page answers 503 with it, the API answers 503 in
JSON, and MCP refuses.
[access]
mode = "django"
[access.initial_admin]
username = "root"
password = "change-me-on-first-sign-in"
[lanes]
Intervals are in seconds. Each lane is one process with its own lock.
| Key | Default | Meaning |
|---|---|---|
repair.interval | 300 | Time between scheduled configuration scans |
derived.interval | 300 | The derived-configuration lane, which owns its tables while above 0; 0 hands them back to the full scan |
catchup.interval | 60 | Catch-up probes |
catchup.probe_rows | 50000 | Rows read per probe |
parity.interval | 60 | How often the parity lane looks for a new window |
parity.window_minutes | 60 | The length of each measured window |
identity.interval | 900 | Identity map refreshes |
timeline.interval | 60 | Release timeline polls |
timeline.github_interval | 300 | GitHub polls of the timeline |
[auto_apply]
Off by default. With enabled = true, the scheduled scan applies its plan
without review, except when an operation needs inspection, the capture has gaps, or a
policy has more actions than its limit. Over a limit, that policy’s actions are set
aside as a surge for review and the rest of the plan still applies. Each
policy’s limit is the auto_apply_limit of its
[policies.<name>] table in the schema.
Scoped plans are never applied automatically. Turn it on only when no other
installation applies to the same candidate.
[auto_apply]
enabled = true
[releases]
Optional. The release timeline links each release of the new version to the rollouts
that ran it. It reads three sources, each chosen in [releases]:
| Key | Values | Meaning |
|---|---|---|
code_source | github, git | Where commits come from |
deployment_records | github, azure_devops, none | Where deployments are recorded |
rollout_evidence | kubernetes, none | Where running workloads are observed |
grace_seconds | 3300 | How long a release may take to settle |
config_path | path | The new version’s cache settings file in the code source |
mutable_tag | tag | A tag that deployments retag and restart, such as dev |
[releases.github]:repository,environment,token, andstatus_writesandissue_writes, both off by default.[releases.git]:url,subdirectory,username,token,token_scheme(basic,bearer,managed_identity),ssh_key,known_hosts,commit_url.[releases.azure_devops]:organization,project,environment,pipeline,stage,auth(auto,managed_identity,pat),pat,client_id,digest_tag,url.[releases.kubernetes]:namespace,deployment,container,context,auth(kubeconfig,managed_identity),kubeconfig,server,certificate_authority_data,cluster_id,client_id. For several clusters, add[[releases.rollouts]]tables, each with a uniqueclusterand the keys it changes.[releases.registry]: reads the image digest of a run that names none from its immutable tag:host,repository,tag({run_id},{commit},{short_commit},{build_number},{branch}),auth(azure,bearer,basic,anonymous), andusernameandpassword.
[releases]
code_source = "git"
deployment_records = "azure_devops"
rollout_evidence = "kubernetes"
[releases.git]
url = "https://dev.azure.com/capsulecorp/Orders/_git/orders-processor"
token_scheme = "managed_identity"
[releases.azure_devops]
organization = "capsulecorp"
project = "Orders"
environment = "production"
auth = "managed_identity"
[releases.kubernetes]
namespace = "orders"
deployment = "orders-processor"
auth = "managed_identity"
cluster_id = "/subscriptions/…/resourceGroups/orders/providers/Microsoft.ContainerService/managedClusters/orders-aks"
[releases.registry]
host = "capsulecorp.azurecr.io"
repository = "orders-processor"
tag = "{run_id}"
auth = "azure"
The schema
The rest of the file describes the two databases: what each table is for, how a record in one is paired with the same record in the other, and how results are compared. Sentinel itself knows no table names; everything about your application is here.
Tables and roles
Every table has exactly one role:
| Role | Meaning |
|---|---|
input | Configuration both versions read. Captured from both databases, compared, and copied baseline → candidate by repair plans |
output | What each version produces. Read from both and compared within tolerances; never written by a scan |
context | Read only, to attribute and explain rows; never captured or written |
ignored | Never read, compared or written |
A table is declared once, as [tables."<name>"] with a
role, or in a [roles] list when it needs nothing else. An
input table can set natural_key, match_key,
changes (insert, update, replace),
runtime_columns (written by the running system, never compared),
protected_columns (only fingerprints leave the database) and
sensitive (protected values are copied, encrypted). A table found in
the databases but not in the file is reported on every scan and holds automatic apply
until it is given a role.
Identity
Both databases allocate IDs independently, so [identity.<kind>]
says how a resource is recognised in each: its table,
id_column, natural key, references to parent
kinds and definition columns. A resource that can’t be paired is reported
as a finding, never guessed.
[identity.warehouse]
table = "dbo.Warehouse"
id_column = "WarehouseId"
key = ["Code"]
definition = ["Name", "RegionId"]
[identity.pricing_rule]
table = "dbo.PricingRule"
id_column = "PricingRuleId"
key = ["WarehouseId", "Sku"]
references = { WarehouseId = "warehouse" }
Output tables and tolerances
An output table names its time_column, an increasing
insert_order_column, its comparison key, its
categories and compared columns
(numeric or exact), its scope (rows left out of
a window and counted separately) and how rows are read without blocking production.
Its tolerances are tolerance rules, which name the table.
[tables."dbo.OrderTotal"]
role = "output"
time_column = "ComputedAt"
insert_order_column = "OrderTotalId"
key = ["OrderNumber"]
[tables."dbo.OrderTotal".columns]
Net = { compare = "numeric", noise = true }
Tax = { compare = "numeric", noise = true }
Currency = { compare = "exact" }
Rows known to be wrong in the stored data are not configuration: they are recorded in the installation’s database, each with its evidence and history Next release.
Scoping
[scoping] says which unit (such as a site or a region) a row belongs to,
through a chain of lookups between tables. Scoped scans, case attribution and
per-unit verification use it.
Rules
Everything Sentinel decides about your data is a rule in the file. [[rules]]
holds every rule, in file order. Each has a stable id (letters, digits,
., _ and -), written to reports and never
renamed or reused, and a kind. Its logic is either a declarative
form that Sentinel implements, or embedded Python in code.
| Key | Meaning |
|---|---|
id | Required. The stable ID |
kind | Required. One of the kinds below |
form | A declarative form of the kind; instead of code |
code | Python defining the kind’s function; instead of form |
time_limit_seconds | With code: the limit of one call, above 0 and at most 60; default 1 |
name, description | How reports and the explorer name the rule |
reason | The evidence text recorded with each row the rule decides |
Kinds
Each kind has one function, which code must define at the top level with
exactly two parameters: the data, and ctx (the rule’s id and
what the caller adds). Data arrive as read-only dictionaries and tuples, so a field is
row["column"].
| Kind and function | Receives | Returns |
|---|---|---|
tolerancetolerate(pair, ctx) | The two values, the column, the row’s category and magnitude | True if covered |
classifierclassify(row, ctx) | One comparison row at the rule’s stage | {id, class, evidence}, optionally noncomparable; {id, unresolved: True, evidence}; an evidence request; or None |
checkcheck(run, ctx) | The report’s moment (now), the catch-up lag and the sites the comparison left out | A record {summary, findings, …}, or an evidence request |
policyreview(plan, ctx) | A scan’s planned actions; both catalogs, the scan’s sites, the policy’s options and the capture time | A list of decisions: keep, set, follow, exclude, hold or block an action, block a row for review, or add an update or a delete |
conditionholds(pair, ctx) | An exception and the two values it compares, each with its side | True or False |
guardguard(action, ctx) | One planned action | None to allow, or the refusal: its reason, or {reason, code, detail} |
settlementsettle(release, ctx) | The release timeline’s deployments, ReplicaSets and pods, and the deployment each ReplicaSet was matched to | {verdict, statuses}: the GitHub deployment statuses to post |
Every kind runs today: tolerance, classifier,
check, policy, condition, guard and
settlement.
Embedded code and helpers
code may import only math, datetime,
decimal, re, sentinel.rules (generic helpers:
ULP distance, single-precision rounding, numbers, time parsing, formulas, a per-run
memo, and ask, ask_all and request for evidence) and the file’s own helpers. It never gets a
database connection, a file or the network.
- Checked at validation. A syntax error, a missing or wrongly
shaped function, or a refused import is a located error of the file, such as
rules[3].code: line 2 of the code: …, soconfig validateandconfig applyrefuse it; it never fails a run. - Strict at run time. A call that raises, returns something its kind doesn’t allow, or runs past its time limit fails the run and names the rule and the line. Nothing is decided by default.
- Trusted, not sandboxed. The file is as trusted as the code it replaces; changing a rule is a configuration change, versioned like any other.
[helpers.<name>] blocks hold shared code, which rules
import as sentinel.helpers.<name>. Helpers pass the same import
check and may import each other, without cycles.
[helpers.money]
code = '''
from decimal import Decimal
def cents(value):
return Decimal(str(value)).quantize(Decimal("0.01"))
'''
Tolerance rules
A tolerance rule names its output table and may limit itself to
categories and columns. A table’s rules apply in file order:
the first must be form = "ulp" without categories (the
base), and a base of ulps = 0 turns every rule of the table off. A
tolerated difference counts as a match but is never silent: it is listed under its
rule’s ID, and the rule recorded for a row is the first, in file order, whose bound
covers it. The older [[tables."…".tolerances]] entries with
rule and type are refused, with a pointer to
[[rules]].
| Form | Keys | Covers |
|---|---|---|
ulp | ulps | The two doubles are at most ulps representable values apart. For one row, the bound is the largest ulps among the ulp rules that apply to it |
magnitude | ulps_of_magnitude, magnitude_floor, relative | With M the largest absolute value of the row’s noise columns on both sides, |a − b| ≤ max(relative × M, ulps_of_magnitude × ulp(max(M, magnitude_floor))). Noise columns only; relative defaults to 0 |
absolute | absolute | |a − b| ≤ absolute. Required; numeric columns only |
relative | relative | |a − b| ≤ relative × max(|a|, |b|). Required; numeric columns only |
The absolute, relative and code rules are
asked, in file order, about each numeric difference the ulp and
magnitude rules leave; the first that covers it is recorded. A tolerance
with code may only cover numeric columns. Its
pair holds column, category,
baseline and candidate (the two values, as finite numbers;
releases before the rename call them upstream and
downstream) and magnitude.
[[rules]]
id = "float-rounding"
kind = "tolerance"
table = "dbo.OrderTotal"
form = "ulp"
ulps = 4
[[rules]]
id = "net-magnitude"
kind = "tolerance"
table = "dbo.OrderTotal"
form = "magnitude"
columns = ["Net"]
ulps_of_magnitude = 16
magnitude_floor = 1.0
[[rules]]
id = "amount-cent"
kind = "tolerance"
table = "dbo.OrderTotal"
form = "absolute"
columns = ["Amount"]
absolute = 0.01
[[rules]]
id = "tax-cents"
kind = "tolerance"
table = "dbo.OrderTotal"
columns = ["Tax"]
reason = "tax within one cent, rounded per line in the new version"
code = '''
def tolerate(pair, ctx):
return abs(pair["baseline"] - pair["candidate"]) <= 0.01
'''
Classifier rules
A classifier explains a difference no tolerance covers. It declares its
stage, the classes it may return and whether they are
noncomparable (left out of the parity figure). Within a stage the first
rule, in file order, that returns a classification decides the row; a class outside
the declaration fails the run, naming the rule.
| Stage | The rows it sees |
|---|---|
unmatched | Every row that is not an exact match, before presence evidence (not reached, comparison window) is asked |
settled | Rows that presence, an exact match and configuration evidence leave unresolved |
unresolved | Rows still unexplained once every row has a class, with their classification and different_columns; rules may ask for evidence here |
fixpoint | Rows still unexplained after that, classified again with every row’s latest outcome until nothing changes, for a class one row takes from another |
At the unresolved and fixpoint stages,
ctx["rows"] shows every row’s current outcome
(keys(*columns), value(place, column)), and a rule may answer
{"id", "unresolved": True, "evidence"}: the row stays unexplained, with
that evidence. [comparison] fixpoint_passes caps the fixpoint stage; one
that has not settled by then fails the run.
[[rules]]
id = "late-exchange-rate"
kind = "classifier"
stage = "settled"
classes = ["late_rate"]
noncomparable = true
description = "Totals computed before the day's exchange rate arrived"
code = '''
def classify(row, ctx):
if row["status"] == "value_diff" and row["category"] == "foreign-currency":
return {
"id": ctx["rule_id"],
"class": "late_rate",
"noncomparable": True,
"evidence": "foreign-currency totals use the day's rate, published later",
}
return None
'''
Causes
[causes.<id>] declares what may explain a difference no classifier
explains. People and agents attribute a report’s unresolved rows to a cause, with
evidence, on the report’s page or with the MCP tool set_cause; whoever sets
it is recorded, and there is no approval step. A row no cause explains is
not triaged. A report shows its measured parity and, beside it, the
same figure counting rows whose cause is explained or
accepted; the measured figure never changes. A file that declares no
causes gets a generic catalogue: baseline_behaviour,
candidate_defect, environment and
configuration.
| Key | Value | Meaning |
|---|---|---|
<id> | lower-case letters, digits and _ | Permanent: never renamed or reused. untriaged is built in and refused |
title | text, required | What the cause is |
side | baseline, candidate, environment or config, required | Whose behaviour it is |
effect | explained, defect or accepted, required | A defect stays a difference in the figure with attributions |
issue | "#123" or an http(s) link | Where it is tracked |
description | text | More detail |
[causes.rounding_per_line]
title = "The new version rounds tax per line"
side = "candidate"
effect = "accepted"
issue = "#42"
Evidence rules ask for
A rule never connects to a database. When it needs to read one, it asks for a query
declared in [comparison.evidence.<name>] with
form = "query": sentinel.rules.ask(ctx, name, side,
**parameters) returns the query’s rows, and when the run has none yet it ends
the call with a request. Sentinel runs every waiting row’s distinct requests once,
then calls the rules again, in passes capped by
[comparison] evidence_passes. Answers, failures included, are kept beside
the run, so a replay or revision sees exactly what the live run saw and sends no SQL.
| Key | Meaning |
|---|---|
sides | baseline, candidate or both (a request names one) |
sql | A read-only statement starting with SELECT, WITH or DECLARE; :name marks a parameter, a list or an inlined function |
columns | The result’s column names, in order |
parameters, lists | Scalar parameters, and list parameters with the most items each may hold |
max_rows | The most rows an answer may hold; a larger one is unavailable |
file | The .jsonl file beside the run that keeps the answers |
inline | A table-valued function the login may read but not call, inlined with its table parameter given as VALUES |
timeout_seconds | How long a statement may run (default 120) |
[comparison.evidence.order_lines]
form = "query"
sides = ["baseline", "candidate"]
parameters = ["order_id"]
columns = ["line_id", "amount"]
max_rows = 1000
file = "order_evidence.jsonl"
sql = "SELECT LineId, Amount FROM dbo.OrderLine WHERE OrderId = :order_id"
Check, policy, condition, guard and settlement rules
- Checks run after each live report and never fail it. A check
declares its
scope(the key of its summary in the report), itsartifact(the file beside the report) and thefindingsit may open; it returns{summary, findings, …}, each finding{finding, resource, subject, detail}, closed by the first report that no longer lists it. One that fails recordsunknown, naming the rule. - Policies change a scan’s plan. A policy names one with
rule = "<rule id>"in its[policies.<name>], and its step applies the decisionsreview(plan, ctx)returns, each a dict whosedecisioniskeep(record its evidence on an action),set(desired values),follow(an action applies only after others, and is skipped with them),exclude,holdorblock(with a reason and code), ablockof a row for review, or anupdateordeletethe rule proved, guarded at apply like the engine’s own writes. A removed action stays visible as an excluded or blocked row, and the actions that depend on it are blocked too. Its actions count toward the policy’sauto_apply_limit. - Conditions are what an operator’s
event_maintainedexception may require: itsconditionis a condition rule’s id.ctx["catalogs"].rows(side, table, **where)reads either captured catalog. A condition the file doesn’t declare never holds. - Guards refuse planned actions. A policy names one with
guard = "<rule id>"in its[policies.<name>]; a refused action becomes a blocked row with the rule’s reason, and the actions that depend on it wait too.ctx["identity"]gives each identity kind’s table and key, and the resources the identity map could not pair. - Settlement decides the release timeline’s GitHub deployment
statuses (at most one rule). It reads the deployments, ReplicaSets and pods, and
the deployment each ReplicaSet was matched to by release window and image digest;
it never matches anything itself. It returns its verdict and the statuses to post,
each
{deployment, rule, state, evidence, description}, whose description starts withSentinel:. Nothing is decided while a release is being run.
What reports record
Beside every report, two files show which rules decided what:
rules.json: the configuration version the run used, the SHA-256 digest of the configuration file’s text, and every rule in order, with its kind and its form or the digest of its code, plus the helpers’ digests;row_rules.csv: each row a rule decided, with that rule’s ID.
Neither changes a report’s figures.
Trying a rule
manage.py rules try <rule-id> --report N runs a classifier rule over
a stored report’s rows and the evidence it holds, and prints each verdict with its
evidence and how many agree with the report (--all for every row,
--json for JSON). It writes nothing and sends no SQL: a request for
evidence the report doesn’t hold is counted, not asked.