Core

Matcher operators

Every matcher/v1 operator, its operand, and when it passes, fails or cannot decide.

"Unknown" below means the result is unknown (undecidable) because the value has the wrong JSON type. Any operator applied to a missing value fails, except exists, not, any_of and all_of, which decide for themselves.

A field pattern needs its parent to exist: { args: { options: { confirm: { exists: false } } } } fails when options itself is missing, and is unknown when options is null, because the inner pattern only runs on an object. To say "no confirm, wherever options is", write { any_of: [{ args: { options: { exists: false } } }, { args: { options: { confirm: { exists: false } } } }] }.

OperatorOperandPasses whenUnknown when
equalsany JSONdeep equal (exact, not partial)never
fieldsobject of matchersthe value is an object and each listed field matchesnot an object
isstring number integer boolean object array nullthe JSON type matches; integer is finite with no fractionnever
existsbooleantrue: present (null counts as present). false: missingnever
lenRangecode points of a string, items of an array or keys of an object are in rangenot a string, array or object
gt gte lt ltenumberthe comparison holdsnot a number (booleans are not numbers)
containsmatcherstring: the operand is a substring. Array: some element matchesnot a string or array, or a non-string operand on a string
not_containsmatcherthe negation of containsas contains
icontainsstringsubstring under Unicode 16 simple case foldingnot a string
starts_with, ends_withstringprefix or suffixnot a string
regexpattern, or { pattern, flags } with flags from i, m, sRE2 search, unanchorednot a string
globstringanchored: * any run, ? one code point, [a-z], [!a-z], \ escapes. A pattern with a / is a path glob (below)not a string, a string with NUL, or a path that climbs above its root
json_schemaJSON Schema 2020-12 (core's interpreter)the value validates; a string is parsed as JSON first (unless compiled with parseJsonStrings: false)a string that is not JSON
jsonpath{ "<path>": matcher }every selected node matches; nothing selected counts as missinga string that is not JSON
any_ofnon-empty listsome matcher passesnone passes and some is unknown
all_ofnon-empty listevery matcher passesnone fails and some is unknown
notmatcherthe matcher failsthe matcher is unknown
judge{ rubric, threshold?, judge?, options? }the judge passes it (score >= threshold when both exist)never

Path globs. When the pattern contains /, the value is treated as a path and normalized lexically before matching, with no filesystem access and no symlink resolution: repeated / collapse, . segments drop, .. removes the segment before it, and a trailing / drops (the pattern is normalized the same way). So { glob: "/tmp/**" } fails on /tmp/../etc/passwd, which is /etc/passwd, and { glob: "/etc/**" } passes on it. In a path glob *, ? and negated classes stay inside one segment, ** crosses segments, and a segment that is only ** also matches no segment: /home/*/public/** does not match /home/a/private/x/public/y, and /a/**/b matches /a/b. /etc/** does not match /etc itself.

The glob fails closed: the result is unknown (a deny rule treats it as a match; an allow rule, an eval and not do not) when a .. would climb above the root (/../etc) or above the start of a relative path (a/../..), when an absolute pattern meets a value that is not absolute (etc/passwd, ~/.ssh/id_rsa, the empty string), and for any glob value containing NUL. Pass policies absolute, resolved paths. Only / separates segments: a backslash, %2e%2e or any other encoding is literal text. Matching is case-sensitive, so on a case-insensitive filesystem /Users/*/.ssh/** does not match /Users/a/.SSH/id_rsa; normalize case before matching there. A path glob with a .. segment is a load error. A pattern without / matches the raw string, and its * crosses /.

JSONPath is a subset of RFC 9535: $, .name, ['name'], [n], [-n], [*], .*. Filters, slices, unions and .. are load errors. Regex is RE2 in both languages: linear time, no lookaround, no backreferences, \d and \w are ASCII. String operators never stringify: the number 42 does not contain "4".

Load-time checks: unknown or mixed operator keys (with did-you-mean), keys one edit away from an operator, the pre-v1 names type, path, length and schema when their value looks like that operator, operand types, invalid regex, glob, JSONPath and JSON Schema, integers beyond +/-(2^53 - 1), empty any_of / all_of, Range min <= max, judge.threshold in [0, 1], and the operator allowlist.