Skip to content
cmdrvlPublic

About

verify runs deterministic invariant checks against declared rules — key uniqueness, value domains, totals, and relationships — returning PASS/FAIL with violated invariant IDs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

verify

verify: deterministic constraint evaluation. A painterly dashboard with a RULES (constraints.yaml) panel on the left declaring four constraints (not_null, unique, in_range, foreign_key), and a RULE EVALUATION RESULTS table on the right showing per-rule verdicts: two pass, one fail (with the specific violating rows: row 1417 rate=0.42, row 2208 rate=0.38), and one refused (counterparties relation not bound). A VERDICT panel reports outcome FAIL with exit_code 1 and refusal_codes E_UNBOUND_RELATION. A ring-bound Constraint Rules Handbook on the desk has index tabs for each rule; an open page shows the verdicts with a handwritten margin note questioning the rate covenant breach. A legend card pairs the three verdict states with their icons.

Do these constraints hold for this data? If not, here are the rows that broke them.

Deterministic constraint evaluation for the epistemic spine and factory runtime.

verify evaluates declared constraints against one or more named relations and emits a deterministic report of passes, failures, and refusals.

It answers one narrow question:

Do these declared constraints hold for these bound inputs?


Quickstart

Build from source:

cargo build --release -p verify-cli
./target/release/verify --help

Arity-1 shortcut (compile and evaluate in one step):

./target/release/verify fixtures/inputs/arity1/loans.csv \
  --rules fixtures/authoring/arity1/not_null_loans.yaml \
  --json

General batch path:

./target/release/verify run fixtures/constraints/query_rules/orphan_rows.verify.json \
  --bind property=fixtures/inputs/arity_n/property_no_orphans.csv \
  --bind tenants=fixtures/inputs/arity_n/tenants.csv \
  --json

Binding-qualified batch predicate over positionally aligned composite keys:

./target/release/verify run \
  fixtures/constraints/binding_qualified/maturity_date_immutable.verify.json \
  --bind current=fixtures/inputs/binding_qualified/current.csv \
  --bind prior=fixtures/inputs/binding_qualified/prior_matching.csv \
  --json

Preview the first few localized failures directly in human output:

./target/release/verify run fixtures/constraints/query_rules/orphan_rows.verify.json \
  --bind property=fixtures/inputs/arity_n/property.csv \
  --bind tenants=fixtures/inputs/arity_n/tenants.csv \
  --sample-affected 3

Compile authoring to a constraint artifact:

./target/release/verify compile fixtures/authoring/arity1/not_null_loans.yaml \
  --out /tmp/not_null_loans.verify.json

Validate a compiled artifact:

./target/release/verify validate fixtures/constraints/arity1/not_null_loans.verify.json

Inspect the embedded schemas and local witness log:

./target/release/verify --schema > /tmp/verify.report.v1.schema.json
./target/release/verify compile --schema > /tmp/verify.constraint.v1.schema.json
./target/release/verify witness last --json

Inspect the read-only doctor surface for agents and automation:

./target/release/verify doctor triage --json
./target/release/verify capabilities --json
./target/release/verify robot-docs guide
./target/release/verify --describe
./target/release/verify doctor health
./target/release/verify doctor capabilities --json
./target/release/verify doctor robot-docs

verify doctor triage --json is the fastest read-only machine entrypoint for automation. verify capabilities --json prints the operator.v1 contract: the same document as verify --describe (exit codes, witness behavior, formats, side effects, pipeline, CRV1 canonical relation boundary). verify robot-docs guide prints the agent-facing quick guide. Every doctor report is cmdrvl.doctor.v1; the doctor exits 0 when healthy, 1 when unhealthy, and 2 only for usage errors.

Deprecated aliases, still working: verify --robot-triage and verify doctor --robot-triage (both mean doctor triage --json). The old per-tool schema ids (verify.doctor.{health,capabilities,triage}.v1, verify.capabilities.v1) are replaced by cmdrvl.doctor.v1 and operator.v1; key on schema_version.


Why verify exists

The spine and factory both need the same constraint primitive:

  • one canonical compiled constraint artifact
  • one canonical report artifact
  • deterministic evaluation semantics
  • reusable execution across batch and embedded contexts

You provide:

  • one compiled verify.constraint.v1 artifact
  • one or more named bindings
  • optional lockfiles for trusted-input verification

verify returns:

  • one deterministic verify.report.v1 report
  • localized failures by binding, and when available by key and field
  • explicit PASS, FAIL, or REFUSAL outcomes
  • one protocol usable in both CLI and embedded runtime contexts

What makes this different

  • One primitive, not two products. Single-input validation and cross-input validation are the same protocol with different arity.
  • One compiled contract. JSON/YAML authoring and SQL authoring both compile into verify.constraint.v1.
  • Portable and batch-only rules are explicit. Portable rules mean the same thing in batch and embedded execution. Batch-only query rules and binding-qualified predicates never silently downgrade.
  • Failure localization is first-class. Reports identify failing rules, implicated bindings, and when possible keys, rows, and fields.
  • Deterministic reports. Same compiled constraints plus same bound inputs yield the same ordered report bytes.
  • Clean spine boundaries. verify checks declared constraints. It does not score correctness, choose winners, or make proceed/block decisions.

Where verify fits

verify sits in the constraint layer of the spine:

normalize / materialize -> verify -> assess -> pack

It also has a factory role:

twinning / decoding -> embedded verify -> assess / routing

Related tools:

If you need... Use
Structural comparability before comparison shape
Numeric and content deltas between aligned datasets rvl
Gold-set accuracy scoring benchmark
Proceed / escalate / block decisions assess
Evidence sealing pack

verify only answers:

Which declared constraints passed, which failed, and where did they fail?


The three outcomes

verify emits exactly one domain outcome:

Exit Outcome Meaning
0 PASS all rules passed
1 FAIL one or more rules failed
2 REFUSAL the tool could not evaluate safely

Outcome discipline:

  • PASS means every rule result passed and failed_rules = 0
  • FAIL means at least one rule result failed
  • REFUSAL means no partial "best effort" report masquerades as evaluation

Other exit codes, per the family contract (spine-rules/docs/exit-codes.md):

  • verify doctor exits 1 when it finds an unhealthy diagnostic (this was 2 before 0.5.2; 2 now means a usage error only). Under the contract 1 is therefore "FAIL (doctor: unhealthy)".
  • Read commands never exit 1 for an empty result. verify witness query prints [], witness count prints {"count":0} and witness last prints null, all with exit 0 (this was exit 1 before 0.5.2). Narrow a query with --outcome PASS|FAIL|REFUSAL, --command run|compile|... and --limit N.

set -e scripts: a constraint FAIL is exit 1 by design and aborts the script. Guard it when you want to read the report afterwards:

verify run constraints.verify.json --bind input=data.csv --json > report.json || [ $? -eq 1 ]

A witness query on an empty ledger no longer needs that guard. A mistyped subcommand (verify docter) is refused with exit 2 and a "did you mean doctor" hint instead of being parsed as a dataset path.


Commands

verify run <COMPILED_CONSTRAINTS> --bind <NAME=PATH> [--lock <LOCKFILE>] [--json] [--sample-affected <N>] [--explicit] [--no-witness]
verify <DATASET> --rules <AUTHORING> [--key <FIELD>] [--json] [--sample-affected <N>] [--explicit] [--no-witness]
verify ground <CLAIMS_JSONL> --bind <NAME=DOCUMENT> --lock <LOCKFILE> [--json] [--explicit] [--no-witness]
verify compile <AUTHORING> [--out <OUTPUT>] [--check] [--json]
verify compile --schema
verify validate <COMPILED_CONSTRAINTS> [--json]
verify witness <query|last|count> [--outcome <OUTCOME>] [--command <COMMAND>] [--limit <N>] [--json]
verify doctor triage --json
verify capabilities --json
verify robot-docs guide
verify doctor health [--json]
verify doctor capabilities --json
verify doctor robot-docs
verify --robot-triage          # deprecated alias of `doctor triage --json`
verify doctor --robot-triage   # deprecated alias of `doctor triage --json`
verify --schema
verify --describe

The doctor surface is read-only. It does not read bound inputs, execute rules, load DuckDB, write output artifacts, append witness records, create witness directories, or expose doctor --fix.

Configuration footprint:

  • Shared witness ledger fallback: ~/.cmdrvl/state/witness/witness.jsonl
  • Explicit override: EPISTEMIC_WITNESS for an operator-supplied ledger path
  • First use copies legacy ~/.epistemic/witness.jsonl or .epistemic/witness.jsonl into the canonical location, leaves legacy files in place, and writes path-only records to ~/.cmdrvl/migrations/applied.jsonl and ~/.cmdrvl/notices/deprecated-paths.jsonl

Compiled constraint artifact

verify.constraint.v1 is the compiled artifact:

{
  "version": "verify.constraint.v1",
  "constraint_set_id": "example.not_null_loans",
  "bindings": [
    {
      "name": "input",
      "kind": "relation",
      "key_fields": ["loan_id"]
    }
  ],
  "rules": [
    {
      "id": "INPUT_LOAN_ID_PRESENT",
      "severity": "error",
      "portability": "portable",
      "check": {
        "op": "not_null",
        "binding": "input",
        "columns": ["loan_id"]
      }
    }
  ]
}

Portable rule ops:

  • unique
  • not_null
  • predicate
  • row_count
  • aggregate_compare
  • foreign_key

aggregate_compare sum and avg add exactly, so row order cannot change a verdict. A decimal fraction means the number a report prints for it: 0.1 + 0.2 equals 0.3. Until numbers are loaded exactly, a sum or avg refuses when a summed value, a threshold or the tolerance is a fraction-form number of magnitude 2^53 or more, because it may already have been rounded. verify run reports the refusal as E_BAD_CONSTRAINTS, embedded evaluation as E_BAD_EXPR. This does not make loading exact: a decimal already rounded when it was read stays rounded.

Batch-only execution cases:

  • query_zero_rows
  • predicate when any column reference names a binding other than its anchor

A predicate column reference may optionally include binding:

{
  "id": "MATURITY_DATE_IMMUTABLE",
  "severity": "error",
  "portability": "batch_only",
  "check": {
    "op": "predicate",
    "binding": "current",
    "expr": {
      "eq": [
        { "column": "maturity_date" },
        { "binding": "prior", "column": "maturity_date" }
      ]
    }
  }
}

check.binding remains the anchor. Omitted reference bindings resolve to that anchor. Every participating binding must declare a non-empty key_fields tuple of equal arity; physical key names may differ because tuples align by position. The batch executor evaluates each anchor row once, ignores rows found only in non-anchor bindings, and refuses ambiguous or missing counterparts.

Structural and scalar defects use stable refusal codes:

  • E_FIELD_NOT_FOUND for missing key or operand fields
  • E_KEY_INVALID for null, non-scalar, unrepresentable, or type-incompatible keys
  • E_KEY_AMBIGUOUS for duplicate participant keys
  • E_KEY_UNMATCHED for an anchor key without a counterpart
  • E_BAD_EXPR for incomparable predicate operands

Same-family temporal column-to-column predicates over date, timestamp, time, and interval values use DuckDB-native comparison after explicit type checks, without widening verify.report.v1 values. Temporal fields remain invalid as key_fields because join identity and localization keys must be protocol scalars. A failing temporal predicate renders an unambiguous anchor field value through an explicit report-only cast.

SQL authoring compiles into batch-only rules. Embedded execution refuses all batch-only rules with E_BATCH_ONLY_RULE; it does not approximate binding-qualified predicates. Portable cross-binding lowering is deferred.


Report contract

JSON report shape (verify.report.v1):

{
  "tool": "verify",
  "version": "verify.report.v1",
  "execution_mode": "batch",
  "outcome": "FAIL",
  "constraint_set_id": "example.not_null_loans",
  "constraint_hash": "sha256:...",
  "bindings": {
    "input": {
      "kind": "relation",
      "source": "tape.csv",
      "content_hash": "sha256:...",
      "input_verification": null
    }
  },
  "summary": {
    "total_rules": 1,
    "passed_rules": 0,
    "failed_rules": 1,
    "by_severity": { "error": 1, "warn": 0 }
  },
  "policy_signals": {
    "severity_band": "ERROR_PRESENT"
  },
  "results": [
    {
      "rule_id": "INPUT_LOAN_ID_PRESENT",
      "severity": "error",
      "status": "fail",
      "violation_count": 1,
      "affected": [
        {
          "binding": "input",
          "key": { "loan_id": "LN-42" },
          "field": "loan_id",
          "value": null
        }
      ]
    }
  ],
  "refusal": null
}

This shows every field. Default command output omits content_hash, or shows it keyed, and a ground report treats constraint_hash the same way; --explicit prints both as above. See Redaction.

Human output:

VERIFY FAIL
constraint_set: example.not_null_loans
binding: input=tape.csv
passed_rules: 0
failed_rules: 1
severity_band: ERROR_PRESENT

FAIL INPUT_LOAN_ID_PRESENT binding=input key.loan_id=LN-42 field=loan_id value=null

When a failing rule has many localized rows, --sample-affected <N> limits the human output to the first N affected entries per failing rule and adds a preview note when additional entries were omitted. JSON output is unchanged.

Known issue: CSV date columns that load as text

A CSV column the reader cannot type stays text, and text is compared character by character: 01/15/2025 comes before 12/31/2024. One empty cell is enough. Released 0.7.6 and 0.8.0 pass false rules over such columns. On main, many of these passes are now refused with E_UNRELIABLE_COLUMN, but some false rules still PASS: see CSV columns held as text under the changes since 0.8.0.

Excel inputs (.xlsx, .xlsm, .xls)

--bind tape=report.xlsx#loans binds one worksheet, by name or 0-based index (digits select an index unless a sheet has that exact name). The worksheet is read by the shared cmdrvl-tabular reader and loaded exactly like a CSV of the same data, so identical rules give identical results over CSV, Parquet and XLSX (golden tests in tests/xlsx_bindings.rs). A workbook with more than one sheet and no #Sheet refuses with E_FORMAT_DETECT (the detail names E_AMBIGUOUS_SHEET and lists the sheet names); an unknown sheet refuses the same way (E_SHEET_NOT_FOUND). Cells are rendered as canonical text (numbers 2000.0 and 2000 both become 2000; date cells render as YYYY-MM-DD or a datetime); duration cells, error cells and some out-of-range values refuse. The exact rules are in the tabular README. The sheet selector works with --bind only: the verify DATASET --rules shortcut can open a one-sheet workbook but cannot select a sheet. Locks hash the .xlsx file bytes, not the worksheet. Not covered: the temporal and decimal behaviour of the tabular v1 reader beyond what its own tests prove, and workbooks whose values depend on volatile formulas.

Input locks (--lock)

--lock <LOCKFILE> (repeatable) checks each bound input against a lockfile before any rule runs. It reads the canonical lock.v0 manifest that vacuum | hashbytes | lock writes: each members[].bytes_hash is sha256:<hex> or blake3:<hex> of the raw file bytes, and verify hashes the bound file with the member's own algorithm. Different bytes refuse with E_INPUT_DRIFT, a bound input with no member refuses with E_INPUT_NOT_LOCKED, and an unknown hash algorithm, a member with no bytes_hash, or an unknown lock version refuses with E_IO (exit 2). The old verify-private lock.input.v1 format (content_hash, sha256 only) is still read and is deprecated. Not checked: the lock's own lock_hash self-hash.

Which members speak for an input is the same rule in verify run and verify ground:

  1. Every leading ./ is dropped from the bound path as typed and from member paths. Nothing else is rewritten: no trimming, and no removing of trailing /. A \ is an ordinary character. On Windows only, \ in the typed path is read as /; member paths are never converted.
  2. The candidates are the members whose path equals the typed path. If there are none, they are the members whose file name (the part after the last /) equals the input's file name, provided they all have one path (real locks store paths relative to the vacuum root). Candidates are taken across all the --lock files. No candidate, or one file name on two or more different member paths, is E_INPUT_NOT_LOCKED.
  3. Every candidate must agree with the input. One that differs is E_INPUT_DRIFT, even when another matches; expected_hash is the first differing candidate in --lock order. A passing report lists every lock with a candidate.

Changed after 0.7.6. Release 0.7.6 passed an input that matched any one candidate, so with two locks that each listed loans.csv, current=dec/loans.csv and prior=nov/loans.csv passed with the files exchanged. It also trimmed member paths, dropped their trailing separators and split them on \. Some inputs it passed are now refused, and a few it refused as not locked now pass.

To lock two periods whose files share a name, make one lock over the folder that holds both, so the member paths are dec/loans.csv and nov/loans.csv, and bind those paths as written in the lock. Each input then has exactly one candidate, and exchanged files are refused. Two per-period locks that both list loans.csv with different hashes, passed together, refuse every input, including correct ones.

Document grounding (ground)

verify ground checks citations against raw source-document bytes that are pinned by a required, repeatable --lock (lock.v0) argument. The claims input is JSONL; each line requires claim_id, source, and quote, with an optional half-open raw byte span and optional numeric value, unit, and scale:

{"claim_id":"loan-amount","source":"filing","quote":"95000000.00000000","byte_span":{"start":123,"end":140},"value":95,"scale":"millions"}

The binary describes its own inputs, with no other arguments needed: verify ground --schema (or --describe, --input-schema) prints the JSON Schema of one claims line (verify.claims.v1), verify compile --input-schema the schema of YAML or JSON rule authoring (verify.authoring.v1), and verify compile --schema the compiled artifact's schema. verify ground --help and verify robot-docs guide show the fields with copy-paste examples.

The rules below are stricter than released 0.7.6, which passes many unsupported claims, including a quote that cuts a word or number and a unit the document never states. They apply from the first release that includes them.

Text. The pure-Rust engine drops HTML tags and comments and the contents of script and style, decodes common named entities and numeric character references, removes soft hyphens and zero-width characters, and collapses whitespace to one space. Styling tags (span, b, i, font, a, inline XBRL and the like) join the text around them; every other tag, including table cells, br, sup and XML elements, separates it. A < that does not start a tag name is ordinary text.

Quotes. A quote must stand on its own: it may not start or end inside a word (including hyphenated words and contractions) or inside a number, and may not leave out a sign, parenthesis, scale word or percent sign that belongs to a number it quotes. It also may not start or end inside a currency marker: letters joined to a currency sign (C$, US$, CN¥, E£, Cdn.$, U.S.$; up to three letters per part) or a currency name written after a number (Canadian dollars). US, U.S., CA, Cdn, Cdn., CDN, HK, NZ and AU, written in exactly those letters one space before a $ (including a line break, a non-breaking space, a tag or a table cell), are part of the marker too. A sentence that ends in U.S. right before an amount cannot be told apart from that prefix, so it is treated as one. A quote may still leave out a currency altogether. Other prefixes typed apart from the sign, including single letters (C $, A $), are not recognised: they read as a bare $. Without byte_span, exactly one such match is required. Zero is E_QUOTE_NOT_FOUND; several refuse with E_BAD_AUTHORING and detail code E_QUOTE_AMBIGUOUS plus match_count. A byte_span is held to the same rules, and the bytes in it must read on their own as they do in the document.

Numbers. A numeric claim passes only when all of these hold:

  • The quote contains exactly one number. Digits that are part of a name (Q3, 10-K, 10-year, 3.5x) do not count. No number is E_NUMBER_NOT_IN_SPAN; several, including a date beside an amount, is E_NUMBER_UNBOUND. Quote less text.
  • Its value, sign and scale can be read from the document around it, not just from the quote. Otherwise it is E_NUMBER_UNBOUND. This covers, among others: parentheses; a spaced or ambiguous dash; MM, mil, hundred and other magnitudes that no claim scale expresses; a lone M ($8M: thousands to some writers, millions to others), B or T, or k without a currency; tn without a currency (it may be tonnes); billions and trillions in a document that also uses a long-scale word (milliard, which covers Milliarde and Milliarden, or Billionen, billones or billón); ranges, lists that share a scale, dates, ratios and fractions; unusual digit grouping; a footnote or exponent beside the digits; a scale in another HTML element; and, for a number with no scale of its own, any document that declares one ("in thousands", "US$'000").
  • The value matches in exact decimal arithmetic, and a percentage or basis-point figure is claimed as percent or bps (a plain quantity is not). Otherwise E_SCALE_MISMATCH. The claim's scale is units, thousands, millions, billions, trillions, percent or bps, and any equivalent one matches: $1.3 billion passes as 1300 millions. The document's billion, billions, bn, trillion, trillions and trn are read as the English short scale, and tn only next to a currency.
  • If the claim has a unit, the document states that unit on the number itself: otherwise E_UNIT_NOT_ESTABLISHED. A currency code or US$ establishes USD; €, £, ₹ and the currency names next to a number establish theirs. A bare $ does not establish USD (or any other dollar): claim "unit":"$" for it. ¥ works the same way. A sign with other letters joined to it (E£, CN¥, Cdn.$, U.S.$) is not the plain currency and establishes none of these. A spaced prefix (US $, CA $) establishes no unit by itself, neither a bare $ nor a code, because the words in front of a $ may be prose; with a matching code on the same number (CA $41.2 million CAD) that code is established. Besides currencies, only percent/% and bps can be established; other units, such as shares, do not pass.

Where these rules differ from released 0.7.6 is listed under Behaviour changes from released 0.7.6.

Known limits

A PASS does not show any of the following.

Currency:

  • A single letter before a spaced $ can be cut off. From C $41.2 million (or A $, S $), the quote $41.2 million passes, even with unit $. These are left alone because Class A $5 million would otherwise be refused.
  • A quote may leave the currency out when the claim states no unit. 41.2 million quoted from C$41.2 million passes. A claimed unit is still checked against the document.
  • Other spellings of a spaced prefix are not recognised and can be cut off the same way: for example U.S without its last dot, A.U., (US), US:, US-, Can, NT, or a footnote marker between the prefix and the $.
  • A quote with no digits may end just after the $ in $US or $CAD.
  • Rs. is not recognised as a currency, so 41.2 million can be quoted from Rs.41.2 million.
  • A currency name that does not follow a number can be cut: Amounts are in Canadian passes against Amounts are in Canadian dollars.

Words and meaning:

  • A scale phrase can be cut in a quote with no digits, such as cent applied from per cent applied. No numeric claim can bind to such a quote.
  • Meaning outside the quote is not read: "not", "up to" or "more than" left outside the quote are not checked, so quote enough text to carry them.
  • Text hidden by CSS is still searched. A quote may run across adjacent table cells or blocks. In a plain-text file, anything shaped like a tag is removed.
  • Scale words assume the English short scale. billion is read as a thousand million and trillion as a million millions, in any letter case (Billion too, as English headings write it). In a long-scale language Billion means a million millions. Only a document that also uses milliard (which covers Milliarde and Milliarden), Billionen, billones or billón is refused. verify does not detect the language, so a German text whose only such word is 1 Billion passes a claim of 1 billions, a thousand times less than it says.
  • Scale words are recognised in English and a few other forms only. Text written without spaces between words, such as Chinese or Japanese, can only be quoted in whole runs.
  • A second magnitude word is recognised in English only. 5 thousand millones passes a claim of 5 thousands, as do the same words with MILLONES, milliards or Millionen; 0.7.6 passes these too. The English 5 thousand millions now fails that claim (E_NUMBER_UNBOUND), where 0.7.6 passed it. 5 mil millones fails in both, with E_SCALE_MISMATCH on 0.7.6 and E_NUMBER_UNBOUND now.

The command reuses verify.report.v1 and the existing redaction: failing quote and value details are ordinal refs by default and raw only with --explicit.

Behaviour changes from released 0.7.6

Call these out in the release notes.

ground: claims that no longer pass

Released 0.7.6 passes each of these examples; they no longer pass:

  • A quote that cuts a number or a word, such as $41 from $41.2 million, or convertible from nonconvertible.
  • A quote that cuts a currency marker, such as $41.2 million from C$41.2 million or from US $41.2 million.
  • A bare $ claimed as USD. Claim "unit":"$", or use a document that states USD or US$.
  • A unit the document does not state on the number, such as shares for $41.2 million. Besides currencies, only percent and bps can be established.
  • A lone M. $8M claimed as 8 millions is now E_NUMBER_UNBOUND, because some writers use M for thousands. $8K is still thousands.
  • A quote with more than one number, such as a date beside the amount. Quote only the text around the amount.
  • A figure in parentheses claimed as positive, such as (412) in a table cell claimed as 412, or 5.0 quoted from inside (5.0) million claimed as 5 units. Its sign is not established. 0.7.6 already failed some other such claims.
  • A number without its own scale word in a document that declares a scale, such as (in thousands).
  • Two magnitude words read as the first, such as 5 thousand millions claimed as 5 thousands.
  • A number before Milliarde, millón, milhão, milhao or thousandth, claimed without that magnitude, such as 1 Milliarde as 1 units.
  • A number before an accented scale word in capitals (MILLÓN, MILHÃO, BILLÓN, MILHÕES), claimed without that magnitude.

The rules for ground refuse more than these.

ground: billions and trillions

ground now accepts claims in billions and trillions: 0.7.6 refused the scale billions as E_BAD_AUTHORING, and failed $1.3 billion claimed as 1300 millions. Both now pass. bn is read the same way, and tn only next to a currency. A lone B and the claim scale b are still not accepted.

These scale words assume the English short scale. billion is a thousand million and trillion a million millions, in any letter case, including title case ($1.3 Billion). A document that also uses milliard, Milliarde, Milliarden, Billionen, billones or billón cannot pass a billion claim. Without such a word the English reading applies whatever the language: German 1 Billion, which means a million millions, is read as a thousand million, so a claim of 1 billions passes.

Input locks, in run and ground

Every candidate lock member must now agree with its input; see Input locks. 0.7.6 passed an input that matched any one candidate. Two per-period locks that list the same file name with different hashes, passed together, now refuse even correct files: use one lock over the parent folder. Member paths with a backslash, surrounding spaces or a trailing / are no longer rewritten, so loans.csv no longer matches them.

Keys in rules that compare two bindings

Keys are matched exactly instead of through a floating-point cast. 0.7.6 joined the integer key 9007199254740993 to 9007199254740992; it is now E_KEY_UNMATCHED. A FLOAT or DOUBLE key of 2^53 or more now matches only another float, never an integer or decimal key (0.7.6 joined them), because such a float may already be rounded. Smaller keys such as 1.0 and 1 still join.

Authoring and the one-step command

  • A rule file with a repeated key can now be refused, even though it compiled before. 0.7.6 accepted a dataset name declared twice under bindings (in YAML or JSON), an operator written twice in one expr test, or column written twice in one reference. It silently kept the last value, so {gt: [..., 0], gt: [..., 100]} compiled as only the > 100 test. compile and the one-step command now refuse these with E_BAD_AUTHORING, naming the repeated key with its line and column. To fix such a file, remove the repeated key, keeping the value you meant: to keep what 0.7.6 compiled, keep the last one. A repeated key in compare or a repeated rule field was already refused by 0.7.6.
  • compile and the one-step command refuse .nan and .inf with E_BAD_AUTHORING. 0.7.6 compiled them to null, and a rule could then pass. An artifact compiled by 0.7.6 still holds the null: recompile it from its source.
  • A one-step --key that disagrees with the authored key_fields is E_KEY_CONFLICT. 0.7.6 silently used the --key, even when it named a missing column.

Large decimals

A DECIMAL with more digits or a larger scale than 0.7.6 could convert made it abort with no report. It now answers with a report: for example, a rule reading a Parquet column that holds 9999999999999999999999999999.5 refuses with E_SQL_ERROR.

Self-description

ground --schema (or --describe, --input-schema) and compile --input-schema now print the schemas of what you write, with no other arguments. compile --schema now prints the compiled artifact's schema; 0.7.6 printed the report schema there. --schema and --describe also work before ground and compile. verify --schema is unchanged.

Behaviour changes since 0.8.0

These are on main and not in a release yet. Call them out in the next release notes.

Hashes of content leave default output

  • content_hash is gone from default output of run, the one-step command and ground. With VERIFY_REDACTION_KEY set it is shown as redacted:hmac-sha256:<32 hex>. --explicit prints the plain hash, as 0.8.0 did.
  • So is the constraint_hash of a ground report, which is the hash of the claims file. The constraint_hash of a run or one-step report names the compiled constraints and is unchanged.
  • An E_INPUT_DRIFT refusal follows the same rule for the expected and observed hashes. Without a key they are left out of detail, and a run message reads binding <name> content hash drifted.
  • Anything that reads these fields must change. It can pass --explicit, which also prints the raw values of failing rows, or set a key and compare markers. A consumer that requires a plain ground constraint_hash rejects default reports, keyed or not.
  • pack 0.7.2 is such a consumer. Checked with the released macOS x86_64 pack binaries on PASS and FAIL ground reports: 0.7.2 seal accepts a default report and exits 0, but pack verify then finds the pack INVALID (SCHEMA_VIOLATION on constraint_hash), with or without a key. It finds packs of --explicit ground reports and of run reports OK. pack 0.8.0 finds all of these OK. Upgrade pack to 0.8.0 or later before this version of verify.
  • Code that uses the library must change where it touches these two fields: VerifyReport.constraint_hash and BindingReport.content_hash are now Option<String>. Code that reads one must handle None, which is what a report without the field deserializes to. Code that builds either struct field by field must wrap the value in Some(...). VerifyReport::new and VerifyReport::refusal take the same arguments as before, and the embedded executor still reports the hashes its caller supplies.

sum and avg in aggregate_compare

  • Verdicts can change, in both directions. 0.8.0 added floating-point numbers in row order and rounded as it went, so the same rows could pass in one order and fail in another, 0.1 + 0.2 counted as greater than 0.3, and 100.10 + 200.20 + 300.30 did not equal 600.6. The sum is now exact, reading a decimal fraction as the number a report prints for it, and an average is compared without a rounded division.
  • Some reported values change. A sum of integers too large for a floating-point number to hold is now reported exactly, where it fits in an integer: for example 9007199254741001 where 0.8.0 reported 9007199254741000.0. With a redaction key set, the marker for such a value changes too.
  • Some rules that 0.8.0 answered are now refused. A sum or avg refuses when a summed value, a threshold or the tolerance is a fraction-form number of magnitude 2^53 (9007199254740992) or more, because it may already have been rounded. This includes a value loaded from a DECIMAL or CSV column as such a number. verify run reports E_BAD_CONSTRAINTS; embedded evaluation reports E_BAD_EXPR. This is an interim rule until numbers are loaded exactly.

Numbers are compared exactly

  • Verdicts can change. 0.8.0 compared numbers as floating point, so 9007199254740993 equalled 9007199254740992, and a rule that should fail could pass. Predicates, row_count and aggregate_compare thresholds, and tolerances now compare the numbers as received.
  • Wide JSON integers load. JSON and JSON Lines integers above 9223372036854775807, up to 18446744073709551615, were refused with E_IO.
  • One new refusal. An integer is not compared with a fraction-form number of magnitude 2^53 or more that it rounds to, for example 9007199254740993 against 9007199254740992.0, because that number may already have been rounded. Predicates report E_BAD_EXPR; verify run reports E_BAD_CONSTRAINTS for an aggregate threshold.
  • Still passes, although the rule is false: two decimals that were already rounded to one value when they were read, such as DECIMAL values with more digits than a floating-point number holds, and a foreign_key between two such columns.

One-step --key must name a column

  • Where the rules declare no key_fields, a --key that names no column of the data now refuses with E_FIELD_NOT_FOUND, and an empty --key= with E_BAD_CONSTRAINTS. 0.8.0 could pass both.
  • Not covered: key_fields written in the rules themselves that name no column can still pass when no rule needs a key.

JSON and JSON Lines text is compared as written

verify 0.8.0 reads some JSON and JSON Lines strings as dates, times or UUIDs, so two different strings can compare equal. Its eq passes between Infinity in one file and infinity in another, between 2024-1-5 and 2024-01-05, and between 10:00:00 and 10:00:00.000. Now eq, ne, in, unique and foreign_key compare the text of such strings, except in the cases under "Still passes" below. CSV values are not changed by this.

Some runs that 0.8.0 passed now fail or are refused
  • eq, in and foreign_key over two spellings fail, for example one UUID in two letter cases.
  • A query_zero_rows rule now has to pass twice: with the values read as 0.8.0 reads them, and with the values as text, where the text reading must find no violating row. This applies to every query rule in a run in which any file has such a column. As text, dates compare character by character: a rule listing rows with d > '2024-01-31' passes on 0.8.0 over 2024-1-5 and now fails, while over 2024-01-05 it still passes. Queries also read UUID keys as text, so two files no longer match on a UUID written in two letter cases. Predicate rules still match keys as 0.8.0 does.
  • A new E_FORMAT_DETECT refusal: a rule that needs the text reading is refused where the reader has to rename a key, for example keys that differ only in letter case (v and V). A file that changes between the two readings is refused with E_IO.
Some runs that 0.8.0 failed or refused now pass

Different text is now different:

Rule 0.8.0
ne between two spellings of a date in two files FAIL
ne against a date written differently in the rule E_SQL_ERROR
ne against the same UUID in another letter case FAIL
unique over 10:00:00 and 10:00:00.000 E_SQL_ERROR
two rules, gte and ne, over two spellings in two files FAIL
one rule with ne on a date string and a test on a number E_SQL_ERROR
not in with another spelling E_SQL_ERROR
unique over one UUID in two letter cases FAIL

And identical text is now equal: Infinity eq its own text, in with a value's own spelling and foreign_key to the same string (each E_SQL_ERROR on 0.8.0), and, in a file with UUID ids, a UUID value eq its own text (FAIL on 0.8.0). If you meant such values as dates or UUIDs, these passes are not what you want: write each value one way.

Check this case in particular. Two files both say 01-02-2024, and the second also holds 02-13-2024. 0.8.0 reads one file day first and the other month first, so the two identical values are unequal and eq fails. It now passes, because the text is identical. If your two files really use different day and month orders, the same text means two different days, and this PASS is wrong. verify does not warn you. Write dates as YYYY-MM-DD.

Still passes, although the text differs

0.8.0 passes these too. This lists the cases we found, not every variant.

  • A predicate or aggregate rule that mixes the comparison with another kind of test can keep 0.8.0's reading: for example eq together with v >= v across two files, or v < other or eq; in one file, a UUID eq in another letter case together with not is_null; and max equal to a UUID in another letter case.
  • A foreign_key into a UUID key column written in another letter case: keys are still matched as 0.8.0 matches them.
  • A JSON date compared for equality with a CSV date column keeps 0.8.0's reading for the whole rule, whatever else it compares. With d = 2024-1-5 in JSON, d eq the CSV date 2024-01-05 and Infinity eq infinity passes, and so does d eq the CSV date 2024-01-06 or Infinity eq infinity. This keeps same-day comparisons between JSON and CSV working. Workbook and Parquet date columns follow the same rule; we ran the cases here with CSV.
  • A query that cannot run on the text has only 0.8.0's answer: for example a.v <> b.v OR date_part('year', a.v) < 0 over Infinity and infinity.

CSV columns verify will not rely on

CSV carries no types, so verify guesses each column's type from its contents, and some guesses lose what the file says. Where a run would pass and a rule depends on such a column, verify now refuses with E_UNRELIABLE_COLUMN. Some runs that 0.8.0 passed are now refused. The refusal names each column, says why and says what to change. Examples, each of which passes on 0.8.0:

  • Dates that can be read as more than one day: a rule that no date is after 31 March 2024 passes over 10/01/2024 and 11/01/2024.
  • Dates read as no day and month order would read them: 15/01/24 is read as 24 January 2015, and infinity beside 13/01/2024 as 1900-01-01.
  • Numbers with more digits than can be kept: two different 20-digit numbers compare equal.
  • NaN and Infinity: columns holding only Infinity and infinity compare equal, and a query finds no difference between NaN and nan.
  • Times finer than a microsecond: two times that differ only past the sixth decimal place compare equal.

The same applies to the number, date and time columns of a file with no header row, because they cannot be checked. A query rule depends on every loaded column, including ones it does not name. A FAIL is never changed.

Known limits: dates that can still be misread

The text of a column does not always show what its author meant. These four cases can still pass although a date was read wrongly. 0.8.0 passes them too.

  1. One stray value turns a day/month column into month/day. If a day/month/year column holds a value that only month/day/year can read, such as 03/15/2024, and every other value can be read either way, the whole column is read as month/day.
  2. And the reverse. A value that only day/month/year can read, such as 15/03/2024, turns such a month/day/year column into day/month.
  3. Two-digit years get a century by a fixed rule. 00 to 68 become 2000 to 2068 and 69 to 99 become 1969 to 1999. A maturity written 06/30/69 and meaning 2069 is read as 1969.
  4. The same text can mean two days in two files. Each file is read by its own values. When two files settle on different orders, 01/02/2024 is 2 January in one and 1 February in the other. If one file got its order from a stray value, comparing the two can pass when the dates meant are different.

CSV columns held as text

A column the reader cannot type stays text, and text is compared character by character: 01/15/2025 comes before 12/31/2024, so on 0.8.0 a rule that every date is on or before 12/31/2024 passes over 15 January 2025. The most ordinary cause is one empty cell, for example a loan with no maturity date: it keeps even a YYYY-MM-DD column as text. Other causes include slash timestamps with seconds (01/15/2025 10:00:00), timestamps without seconds, AM and PM times, a second date format in the same file, N/A, an impossible date and month names.

Where a run would pass, verify now refuses with E_UNRELIABLE_COLUMN in two cases. Some runs that 0.8.0 passed are now refused.

  • A text column that looks like dates or times cannot be relied on by any rule that reads it, and, because a query can read any loaded column, by any query rule in the run (text_date). "Looks like" means that some cell is written as a date in a layout verify knows: numbers in a date order, a month name with a day or a year, a quarter or fiscal period, a week, a range of two dates, or a time of day with AM or PM or an offset. A cell that is mostly other text, or a date inside a code such as LOAN-2025-01-15, does not count. A column of version numbers or model numbers is refused too if one cell is written like a date.
  • A predicate lt, lte, gt or gte, or an aggregate min or max, over any other text column is refused as well (text_order), whether or not it looks like dates. That includes codes such as A010, and number columns that stay text because of an empty cell. eq, ne, in and unique over such a column are not affected, and neither are query rules.

The exception: a column whose non-empty cells all have the one same fixed-width year-first shape, such as YYYY-MM-DD, YYYY-MM-DD hh:mm:ss, YYYY/MM/DD, YYYYMMDD or YYYY-MM, is refused by neither, because values of that one shape sort as text in date order. The same rules apply to Excel worksheets, which are loaded the same way.

For ordering, the exception holds only against the column's own shape. In a predicate lt, lte, gt or gte, the other side must be a value written in that shape, or another such column of the same shape, in the same file or another. With min or max, every value in compare must be written in that shape, whatever its operator, eq and ne included. Otherwise a run that would pass is refused (text_order). Over an ISO column with an empty cell that holds 2025-01-15, "on or before 31/12/2024" and "on or before Dec 31 2024" pass on 0.8.0 and are now refused. Some correct comparisons are refused too, for example a YYYY-MM-DD column against 2030-01-01 00:00:00, against 2030/01/01 or against an empty string. This covers predicate and aggregate rules only, not query rules.

Still passes, although the rule is false

0.8.0 passes these too.

  • A query rule that compares an excepted column with a date written another way. Query rules are not covered. Over that ISO column, a query listing dates after '31/12/2024' finds none, so the rule passes.
  • The same day spelled another way: over that ISO column, ne, not in or a query for d = '01/15/2025' finds no match for 2025-01-15.
  • A date layout verify does not recognise. It cannot know every one. Left out on purpose, because ordinary data looks the same: bare years, serial and epoch numbers, six-digit dates such as 150125, 2024-064 (day of the year), 2024.03, compact times, and 24-hour times. Over such a column, query rules, ne, in, unique, eq, foreign_key and not_null are not refused: with an empty cell, a query listing six-digit dates after '311224' finds none over 15 January 2025. Only predicate ordering, min and max are refused whatever the layout.
  • A query rule over a text column that is not refused compares characters. How a query orders text is not examined.
What to do

Write every date as YYYY-MM-DD (timestamps as YYYY-MM-DD hh:mm:ss), with four digits for the year and two each for month and day, one shape through the column, and leave a missing date empty rather than writing N/A. Write times of day as 24-hour HH:MM:SS. What a rule can then do depends on whether the column has an empty cell:

  • With no empty cell the column is read as dates, and query rules and comparisons between files compare dates. A predicate or aggregate rule cannot compare it with a fixed value, including through min or max: in a run on one file, 0.8.0 and this version refuse that with E_SQL_ERROR. Use a query rule, for example SELECT id AS key__id FROM input WHERE d > DATE '2024-12-31'. A column read as a time of day is more limited still: query rules and not_null work on it, while predicate, unique and max rules are refused with E_SQL_ERROR, in 0.8.0 and this version.
  • With an empty cell the column stays text, and a value compared with it must be written in the same shape. Query rules work that way, for example SELECT id AS key__id FROM input WHERE d > '2024-12-31'; the DATE '...' form is refused with E_SQL_ERROR. So do upper bounds in predicates and through max. A lower bound fails on the empty cell, which is an empty string, not null, and sorts before every date; d IS NULL does not find it. Skip it in a query (d <> '' AND d < '2020-01-01') or in a predicate (is_blank or the bound). min selects the empty cell and cannot skip it.

To order other text, such as zero-padded codes, use a query rule.

CSV columns that cannot be relied on (E_UNRELIABLE_COLUMN)

CSV carries no types, and some typed values lose what a cell says: dates that can be read as more than one day or in no one order, numbers with more digits than can be kept exactly, NaN and Infinity, and times finer than a microsecond. A column left as text loses the order of what it says: it is refused where it looks like dates, and wherever a predicate, min or max orders it, unless every cell has one fixed-width year-first shape. Where a run would PASS and a rule depends on such a column (a query rule depends on every loaded column), verify refuses instead. The message names each column, says why and says what to do, for example writing dates as YYYY-MM-DD. A FAIL is never changed. docs/plan.md has the exact rule, and CSV columns held as text lists false rules that still pass.

Redaction (--explicit)

Default verify run output is redacted: the raw key values and cell values of failing rows are replaced by deterministic ordinal refs, so a failing rule cannot print bound data into a log or a model's context. Keys become redacted:ref:k1, redacted:ref:k2, ... and cell values redacted:ref:v1, redacted:ref:v2, ... in two separate namespaces (a key and a cell holding equal bytes do not share a ref). Numbers follow first appearance over the entries that are actually printed, so --sample-affected cannot leak anything about unprinted rows, and rerunning the same input with the same flags gives byte-identical output. No hash of any value appears anywhere. Rule ids, severities, counts, binding names, key column names, field names, and the JSON shape are unchanged. DuckDB error text on a SQL_ERROR refusal (which can quote the offending cell) is withheld too. Pass --explicit to get the raw values back, for example verify run c.verify.json --bind input=data.csv --json --explicit.

What a ref reveals: which printed entries share a value and how many distinct values there are, never the content. Refs are not comparable across runs on different inputs or with different sampling.

Hashes of content. A hash of a bound file, of the version a lock expects, or of a ground claims file lets anyone who holds the report try likely contents until one matches. Default output therefore omits each of them: bindings.<name>.content_hash, the constraint_hash of a ground report, and the hashes in an E_INPUT_DRIFT refusal. No ordinal ref stands in for them. With a key set, each is shown as the marker of its text, algorithm prefix included, so someone with the key and a file can check a report: HMAC-SHA256 over the JSON string "sha256:<hex>", cut to 32 hex digits. --explicit prints the plain hashes. The constraint_hash of a run or one-step report is the hash of the compiled constraints and is always plain. The local witness ledger records each input's path and byte count, not a hash of it.

Stable markers (opt-in). Set VERIFY_REDACTION_KEY to a secret of at least 16 bytes and every key and cell value becomes redacted:hmac-sha256:<32 hex>: HMAC-SHA256 (RustCrypto hmac 0.12 with sha2 0.10) over the canonical JSON of the value, truncated to 128 bits. Markers are stable across runs and inputs for whoever holds the key and cannot be guessed without it. A set-but-empty or shorter key refuses with E_REDACTION_KEY (exit 2) before any input is read; it never falls back to ordinal refs. The key is never printed, logged or written to the witness ledger. --explicit ignores the key but a bad key is still refused. There is deliberately no random per-run salt: it would make default output non-reproducible.

What is not redacted, with or without --explicit: column and binding names, rule ids, the rule's own SQL or predicate text, file paths, and counts. Equality between values is visible inside one output (and, in keyed mode, across outputs for the key holder). Treat redaction as "no raw values in the output", not as anonymization.

Changed in this release: outputs that used to show raw key and value fields now show refs unless --explicit is passed, and the short-lived redacted:sha256:<16 hex> token is gone (its only consumers were verify's own docs and tests). Exit codes and the report shape are unchanged; E_REDACTION_KEY is a new refusal.


Execution contexts

One primitive with two execution contexts:

Batch / CLI

  • reads bound inputs from disk (CSV, row-oriented JSON, JSONL, Parquet, and Excel worksheets; see below)
  • evaluates portable and batch-only rules
  • loads every named relation once into one in-memory BatchContext
  • materializes only the columns portable rules read, so a column no rule references cannot fail the load
  • evaluates binding-qualified predicates through deterministic keyed joins
  • can verify bound inputs against lockfiles
  • is the reference executor

Embedded / runtime

  • receives already-materialized named relations
  • evaluates portable rules only
  • refuses batch-only rules with explicit refusal semantics
  • exists to support factory-time constraint enforcement

The report contract stays the same across both.


Repository layout

verify/
├── .github/workflows/
│   ├── ci.yml
│   └── release.yml
├── crates/
│   ├── verify-core/        # domain types: constraint, report, refusal, ordering
│   ├── verify-engine/      # portable rule evaluation + embedded executor
│   ├── verify-duckdb/      # batch bindings, keyed predicates, query rules, locks
│   └── verify-cli/         # CLI surface: run, compile, validate, witness, doctor, render
├── fixtures/
│   ├── authoring/          # YAML and SQL authoring fixtures
│   ├── constraints/        # compiled constraint artifacts
│   ├── inputs/             # CSV test datasets
│   ├── locks/              # lock file fixtures
│   └── reports/            # reference report fixtures
├── schemas/
│   ├── verify.constraint.v1.schema.json
│   └── verify.report.v1.schema.json
├── scripts/
│   └── ubs_gate.sh
├── tests/
│   ├── cli.rs              # CLI exit/output integration tests
│   ├── binding_qualified_predicates.rs  # cross-binding PASS/FAIL conformance
│   ├── binding_qualified_refusals.rs    # keyed predicate refusal contract
│   ├── binding_qualified_determinism.rs # row-order and byte determinism
│   ├── determinism.rs      # byte-identical report determinism proof
│   ├── embedding_equivalence.rs  # batch/embedded parity
│   ├── lock_integration.rs # lock verification tests
│   ├── portable_rules.rs   # full compile→bind→evaluate pipeline
│   ├── query_rules.rs      # query_zero_rows localization tests
│   ├── refusals.rs         # refusal path coverage
│   ├── schema_contract.rs  # fixture/schema round-trip validation
│   ├── gen_fixtures.rs     # deterministic fixture generators
│   └── perf_smoke.rs       # performance guardrail tests
├── Cargo.toml
└── LICENSE

What verify is not

verify is not:

  • a benchmark scorer
  • a policy engine
  • a canonicalization system
  • an extraction pipeline
  • a storage/orchestration layer

Fresh-eyes boundary:

  • verify enforces constraints
  • benchmark scores correctness against ground truth
  • assess decides proceed / escalate / block

Quality gates

cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
ubs .

Contributing

AI coding agents should read AGENTS.md before making changes. Claude Code users should also read CLAUDE.md for the machine-local permission and MCP availability boundary; shared project policy remains in AGENTS.md.

cd verify
br ready                          # find available work
bv -robot-alerts -alert-type stale_issue
bv -robot-alerts -alert-type blocking_cascade
br show <bead-id>                 # read the spec
br update <id> --status in_progress
# reserve only exact files, implement, and run the relevant gate
br close <id> --reason "Completed"
br sync --flush-only              # non-invasive; stage .beads/ in normal git workflow

For the full toolchain guide, see the Agent Operator Guide. Run verify --describe for this tool's machine-readable contract.


verify is part of the open-source toolchain from the CMD+RVL lineage and AI enablement practice. MIT-licensed. Contributions welcome from any practice or stack.

About

verify runs deterministic invariant checks against declared rules — key uniqueness, value domains, totals, and relationships — returning PASS/FAIL with violated invariant IDs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages