pyric/rules compatibility matrix
This is a Pyric-native API with no Firebase counterpart, so coverage is measured against its own public exports rather than a Firebase surface.
Status legend
Conforming — the simulator matches the production verdict, locked by a replayed observation
Diverged (documented) — a known simulator divergence from production with a written reason
Unverified — a claim we haven't yet observed against the production engine
Firestore rules engine — production simulator conformance (rules-firestore corpus)
Rules simulatorCEL builtins math./timestamp./duration.* (FM3) — arithmetic, date, and duration comparisons in rules
oracle:rules-firestore-builtins-time-and-math — production Firestore Rules Test API verdicts for corpus scenario "builtins-time-and-math", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production.Rules simulatorBytes, the bytes literal b'...', String.toUtf8(), and hashing.{md5,sha256,crc32,crc32c}() (Item 5.3) in rules
oracle:rules-firestore-bytes-toutf8-and-hashing: a 2026-09-26 production Firestore Rules Test API capture supplies 29 verdicts, including paired negative and positive witnesses for padded base64url, the URL-safe alphabet, uppercase hexadecimal MD5/SHA-256, and production's little-endian CRC32/CRC32C byte serialization. Nine of them pin MD5 and SHA-256 digests past a single block: the RFC 1321 80-byte message, 55-, 56-, and 64-byte inputs at the padding boundaries, the FIPS 180-4 448-bit and 896-bit messages, a 120-byte Bytes input, and a non-ASCII string hashed as its UTF-8 bytes. unit:rules/oracle-conformance.test.ts replays all verdicts against the local simulator; unit:rules/simulator/hashing-builtins.test.ts checks the built-in MD5 and SHA-256 against the RFC 1321 suite, the FIPS 180-4 examples including one million a characters, and node:crypto for every input length from 0 to 300 bytes as Bytes, hexadecimal, base64url, and strings; unit:rules/simulator/wrappers/bytes.test.ts pins the exact representations and reference digests. ROW EXTENDED, 2026-09-27: the same capture adds 22 production verdicts for the bytes literal, 51 in all. The prefix is b or B directly before a single- or double-quoted body. A plain character contributes its UTF-8 encoding. A backslash escapes a backslash, either quote, n, r, t, b, or f; x with exactly two hexadecimal digits of either case, or three octal digits up to 377, is one byte, so a literal holding the single byte E9 differs from 'é'.toUtf8(). A bytes literal equals only bytes, orders lexicographically, is in a list by value, and hashes like the string it encodes; + on two bytes values and [] on bytes are error values that || true absorbs. Production rejects the ruleset for a u escape ("Invalid bytes literal"), for U, /, a, v, ?, and X escapes, a hex escape with one digit, an octal escape with fewer than three digits or above 377, a raw line break, whitespace after the prefix, and the prefixes rb, br, and bb; the shared grammar rejects the same forms, pinned by unit:rules/grammar/bytes-literal.test.ts. The grammar previously had no bytes literal, so a ruleset that used one failed to parse. The literal now evaluates to the Bytes value toUtf8() produces; unit:rules/oracle-conformance.test.ts replays all 51 verdicts and unit:rules/simulator/bytes-literal.test.ts pins the bytes literal cases.Rules simulatorTyped cross-type operator overloads for Timestamp/Duration (Item 2) in rules — no silent numeric coercion / type-identity loss. + accepts int + int, float + float, string + string, and the duration and timestamp pairs; list + list, list + string, string + list, string + int, int + string, map + map, string + timestamp, timestamp + string, string + duration, duration + string, timestamp + timestamp, string + bytes, bytes + string, bytes + bytes, duration + int, and int + duration are error values that deny and that || true absorbs. list.concat(list) joins lists.
oracle:rules-firestore-cross-type-operator-overloads — production Firestore Rules Test API verdicts for corpus scenario "cross-type-operator-overloads", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production. The 2026-09-27 recapture adds 26 plusOperand cases: production reports "Unsupported operation error. Received: list + list. Expected: int + int, float + float, string + string, duration + duration, duration + timestamp, timestamp + duration." for [1] + [2] and for two request-data lists, and the same error for list + string, string + list, string + int (literal and data), int + string, and map + map. Each pair denies as a bare == or != comparison and allows under || true; string + string, int + float, and list.concat(list) evaluate. A further 34 plusOperand cases put a timestamp, duration, or bytes operand beside a string, an int, or its own type: 'at ' + timestamp.value(0) and 'at ' + request.time report "Received: string + timestamp", and timestamp + string, string + duration, duration + string, timestamp + timestamp, string + bytes, bytes + string, bytes + bytes, duration + int, and int + duration report the same error with their own pair. Each denies as a bare condition and as a != witness and allows under || true; 'ab'.toUtf8() + 'cd'.toUtf8() == 'abcd'.toUtf8() denies, so bytes do not concatenate. unit:rules/simulator/evaluator.test.ts pins the simulator's error values for these pairs and for list + list, and their &&/|| absorption. RECAPTURED, 2026-09-28: 23 equalityIdentity cases (90 in all) pin == over numbers inside Lists and Maps. 1 == 1.0 and 0 == -0.0 allow, while [1] == [1.0], [1.0] == [1], [1, 2] == [1, 2.0], [[1]] == [[1.0]], {'a': 1} == {'a': 1.0} and [request.resource.data.n] == [1.0] for an int field deny, and the != forms allow: a List or Map equals another only when each element has the same numeric type. Inside a List or Map [0.0] == [-0.0] and {'a': -0.0} == {'a': 0.0} deny and [NaN] == [NaN] denies. An element read out of a List or Map ([1][0] == 1.0) compares by value. The simulator compared List and Map elements by numeric value, so each int-and-float shape and each 0.0 and -0.0 shape allowed; ==, List membership and Set comparison now share rules/simulator/value-equality.ts with the Storage evaluator, and the simulator matches all 90 verdicts (unit:rules/simulator/collection-identity.test.ts).Rules simulatorCEL tri-state error absorption in ||/&& (RULES-B3) — error || true → ALLOW, error && false → DENY, commutative absorption (not JS left-to-right short-circuit)
oracle:rules-firestore-error-absorption-and-or — production Firestore Rules Test API verdicts for corpus scenario "error-absorption-and-or", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production. The 2026-09-27 recapture adds allow rules after an error ([1] + [2] == [1, 2]): a later allow rule for the method, in the same match block or in a second block that matches the path, is still evaluated and grants when true, in either order; an error then a true rule past the 1000-expression limit denies with the earlier error as production's note, where a false rule then the same rule denies with the limit message. unit:rules/simulator/expression-budget.test.ts pins the count across the error and the reported error. A second 2026-09-27 recapture adds 19 cases (36 in all) on errors as values: an argument or let whose value errors (1 / request.resource.data.zero, "Divide by zero error." for / and %) is bound and the function body runs, so a function that never reads it allows, also through two calls, and one that reads it denies; with two erroring operands production reports the left one of == and +, the first list element, map value and method argument, the receiver before an argument, and the collection of in before its element; and an operand past the 1000-expression limit after an error in the same expression denies with the limit message. The simulator binds the error value and evaluates every operand after one errors; unit:rules/simulator/error-values.test.ts pins each verdict and the error production named.Rules simulatorgetAfter()/existsAfter() expose the projected post-write target and cross-document atomic batch state; create exists, delete does not, and an unrelated unchanged document falls back to its committed existence
oracle:rules-firestore-get-after-and-exists-after records authenticated Web SDK verdicts against temporarily deployed production rules, including target create/delete and unrelated-path semantics. Its lifecycle proves exact rules release restoration; retained diagnostics document why the hosted Rules Test API was not sufficient. Replayed verdict-for-verdict by unit:rules/oracle-conformance.test.ts; get-after.test.ts and get-after-batch.test.ts cover target, sibling-write, solo-write denial, delete, and atomicity locally.Rules simulatorget() of a missing document (RULES-B8) in rules — resource identity (id/__name__) exposure on a mocked/missing get() result
oracle:rules-firestore-get-missing-doc — production Firestore Rules Test API verdicts for corpus scenario "get-missing-doc", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts. Serializable functionMocks now retain their production data-only shape, so mocked get() results leave id/__name__ absent and both identity reads error to DENY; real DocStore lookups retain their separate identity-bearing path. All 8 cases match production.Rules simulatorrequest.path/request.query/resource.id/resource.__name__ globals (Item 6) in rules
oracle:rules-firestore-globals-request-path-and-resource-id — production Firestore Rules Test API verdicts for corpus scenario "globals-request-path-and-resource-id", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts. request.query is now absent on non-list operations, so reading it on create errors to DENY instead of false-ALLOWing through an invented empty map. request.path and the create-time absent-resource controls remain unchanged; all 6 cases match production. Resource identity on an EXISTING document is scoped to firestore-rules#183.Rules simulatorint/float division and type distinction (RULES-B5) in rules — truncating int÷int, float division stays float, div-by-zero denies, is int/is float distinct, is number true for both, and > ordering an int and a float by value
oracle:rules-firestore-int-float-and-division — production Firestore Rules Test API verdicts for all ten corpus cases, replayed verdict-for-verdict by unit:rules/oracle-conformance.test.ts. The simulator now revives non-integral JSON wire numbers as RulesFloat values, preserving production's float payload type while retaining bare integral numbers as ints; unit:rules/simulator/handler.test.ts pins both literal and payload distinctions. RECAPTURED, 2026-09-28: the scenario adds 8 production cases (18 in all). is number allows an int and a float payload and denies a string and a null payload. > between a stored and an incoming value orders an int and a float by value in both directions (10.5 > 10 and 10 > 9.5 allow, 9.5 > 10 denies), and a string beside an int is "Unsupported operation error. Received: string > int.", which denies. The simulator matches all 18 verdicts, and the counters module's improvedBy relies on both shapes.Rules simulatorList.concat()/removeAll()/toSet() (Item 5.2) in rules
oracle:rules-firestore-list-methods-concat-removeall-toset — production Firestore Rules Test API verdicts for all nine cases, replayed verdict-for-verdict by unit:rules/oracle-conformance.test.ts. The seven positive List witnesses and the concat DENY witness match; the historical toSet().difference(list) case remains DENY because production requires a Set argument. RECAPTURED, 2026-09-28: 63 listMethod cases (72 in all). List membership and removeAll() compare an element's numeric type: 1.0 in [1], 1 in [1.0], [1].hasAny([1.0]), [1].hasAll([1.0]), [1].hasOnly([1.0]) and [1] in [[1.0]] deny, [1, 2].removeAll([1.0]) is [1, 2], -0.0 in [0.0] allows, and NaN is in no List. join(separator) requires one string separator: join() is "Incorrect number of arguments. Received: 0. Expected: list.join(string)." and join(1) an unsupported operation; each element converts as string() does, so ['a', null].join(',') is 'a,null', [2.0].join(',') is '2.0', [path('/a/b')].join(',') is '/a/b', and a List, Map, bytes or duration element is string()'s unsupported-operation error. concat(), removeAll(), join(), toSet(), hasAny(), hasAll() and hasOnly() on a string or Map, and concat(), removeAll() and join() on a Set, are "Function not found error: Name: [<method>]."; || true absorbs each error. The simulator matched List elements by numeric value, joined with no separator (defaulting to ','), printed a null element as the empty string, accepted an int separator, a second separator and List, Map, bytes and duration elements, and reported "Unknown method" for a List method on another receiver. It now calls rules/simulator/list-methods.ts for join(), hasAll(), hasAny() and hasOnly() as the Storage evaluator does, reports production's text for each receiver, and matches all 72 verdicts (unit:rules/simulator/collection-identity.test.ts). RECAPTURED, 2026-09-30: 13 listMethod cases (85 in all) pin the argument of a List receiver's hasAll(), hasAny() and hasOnly(). The argument is one List: ['a', 'b'].hasAll(['b', 'a']) allows and hasAll() with a missing element is false. A Set argument is "Unsupported operation error. Received: list.hasAll(set). Expected: list.hasAll(list).", and a string, Map or null argument is the same error naming its type; no argument or two arguments is "Incorrect number of arguments. Received: 0. Expected: list.hasAny(list)."; || true absorbs each error. The simulator passed the argument to the element test unchecked, so a Set, string, Map or null argument failed with a host type error and an extra argument was ignored. The membership tests now go through listMembership in rules/simulator/list-methods.ts, which checks the argument as the Storage evaluator does, and the simulator matches all 85 verdicts and production's text (unit:rules/simulator/collection-identity.test.ts, unit:rules/simulator/list-methods.test.ts).Rules simulatorMap.get(key, default), including list-form nested-path traversal (Item 3), in rules
oracle:rules-firestore-map-get-string-and-list-form — production Firestore Rules Test API verdicts for corpus scenario "map-get-string-and-list-form", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production.Rules simulatormatches() as an anchored full-string RE2 match (RULES-B4) in rules — a pattern matching only a substring is false
oracle:rules-firestore-matches-full-string-regex — production Firestore Rules Test API verdicts for corpus scenario "matches-full-string-regex", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production.Rules simulatorPath wrapper, path() constructor, and Path.bind() (Item 5.4) in rules
oracle:rules-firestore-path-constructor-and-bind — production Firestore Rules Test API verdicts for all nine corpus cases in "path-constructor-and-bind", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts, including production's rejection of a Path argument to path().Rules simulatorOwn-keys-only map membership and constructor-access denial (RULES-B7) in rules — 'toString' in map is false, .constructor access errors (no JS prototype-chain leakage)
oracle:rules-firestore-prototype-chain-keys — production Firestore Rules Test API verdicts for corpus scenario "prototype-chain-keys", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production. RECAPTURED, 2026-09-27: the scenario adds 6 production cases (11 in all) for in over a value that is not a collection. Each is an evaluation error that denies, so its negation denies too: !('a' in null) is "Null value error.", !('a' in 'abc'), !('a' in 5), !('a' in 1.5) and !('a' in true) are "Function not found error: Name: [in].", and !(1 in {'a': 1}) is "Unsupported operation error. Received: map.in(int). Expected: map.in(string).". The simulator returned false for each, so each negation allowed; it now raises production's error text and matches production on all 11 cases. unit:rules/simulator/in-operand-errors.test.ts pins the verdicts and the text. RECAPTURED, 2026-09-28: the scenario adds 5 production cases (16 in all). 'a' in a set built by toSet() allows and !('items' in that set) allows: set membership tests elements. in over request.time, request.path or a map diff is "Function not found error: Name: [in].", so each negation denies. The simulator returned false for a timestamp, path or map diff, so those negations allowed. The simulator and the Storage evaluator now share one in implementation (rules/simulator/membership.ts), which matches production on all 16 cases; unit:rules/membership.test.ts runs every shape through both engines.Rules simulatorRange-slice [i:j] syntax for List and String (Item 4) in rules
oracle:rules-firestore-range-slice-list-and-string — production Firestore Rules Test API verdicts for all ten corpus cases in "range-slice-list-and-string", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts, including out-of-bounds slice-end rejection for both lists and strings. RECAPTURED, 2026-09-27: 13 bounds cases (23 in all) show production checks, in order, that start is an index, that end - 1 is an index, and that start does not exceed end. [0:0], [n:n], [1:0], and a slice of an empty list or string are Index out of bound error. Index: [i] , size: [n]., a start after the end is Illegal range error. From index: [i] , To index: [j]., and [i:i] for 0 < i < n is empty. The simulator evaluated [0:0], [n:n], a start after the end, and empty-value slices as empty values; it now raises the same errors and matches all 23 verdicts.Rules simulatorSet.difference()/union()/intersection() (Item 5.1) in rules
oracle:rules-firestore-set-algebra-difference-union-intersection captures the receiver and argument boundary in twelve production cases: Map.keys() is a List and rejects Set-only algebra, explicit toSet() receivers ALLOW difference/union/intersection with Set arguments, and a wrong-result control DENIES. The local simulator replays every verdict and the per-construct acceptance probes use the same positive toSet() shapes. RECAPTURED, 2026-09-27: 14 membership cases (26 in all) show x in <set> compares elements by value for Sets from toSet(), union(), and the MapDiff affectedKeys(), changedKeys(), addedKeys(), removedKeys(), and unchangedKeys() accessors: a held element ALLOWs, an absent element DENIES, and the negated forms invert both. The simulator looked the element up as a property name of the Set object, so every membership test was false and every negated test was true; it now searches the Set by value equality and matches all 26 verdicts. RECAPTURED, 2026-09-28: 27 setIdentity cases (53 in all). A Set compares elements by numeric value at every depth: [1].toSet() == [1.0].toSet(), [1, 1.0].toSet().size() == 1, 1 in [1.0].toSet(), [1].toSet().hasAll([1.0]), [[1]].toSet() == [[1.0]].toSet() and [1] in [[1.0]].toSet() allow, and difference(), intersection() and union() treat an int and the equal float as one element. 0.0 and -0.0 are one element, and two NaN are one element that is in its own Set. The simulator kept two NaN as two elements and found no NaN in a Set of NaN; Sets now compare under setElementsEqual in rules/simulator/value-equality.ts, shared with the Storage evaluator, and the simulator matches all 53 verdicts (unit:rules/simulator/collection-identity.test.ts). RECAPTURED, 2026-09-30: 35 setMethod cases (88 in all). A Set has size(), hasAll(), hasAny(), hasOnly(), difference(), union() and intersection() and no Map method: keys(), values(), get() and diff() on a Set, and keys(), values(), get() and size() on a MapDiff, are "Function not found error: Name: [<method>].". size() takes no argument ("Incorrect number of arguments. Received: 1. Expected: set.size()."). The membership methods take one List or Set: a string or Map argument is "Unsupported operation error. Received: set.hasAny(string). Expected: set.hasAny(set), set.hasAny(list)." and another count "Incorrect number of arguments. Received: 2. Expected: set.hasAll(set), set.hasAll(list).". The algebra methods take one Set: a List, string or Map argument is "Unsupported operation error. Received: set.difference(list). Expected: set.difference(set)." and another count "Incorrect number of arguments. Received: 0. Expected: set.intersection(set).". difference(), union() and intersection() on a List, string or Map are "Function not found error: Name: [<method>].". || true absorbs each error. The simulator answered keys(), values(), get() and size() on a Set or MapDiff from the JavaScript object's own fields and diff() on a Set as a Map diff, so 9 negated error cases allowed; it ignored extra arguments, failed a string or Map membership argument with a host type error, and reported "Function not found on List receiver" or "Unknown method" for Set algebra on another receiver. Set methods now dispatch through setMethod in rules/simulator/firestore-set.ts, shared with the Storage evaluator, a MapDiff answers only its key-set accessors, and the simulator matches all 88 verdicts and production's text (unit:rules/simulator/collection-identity.test.ts, unit:rules/simulator/set-algebra-abstain.test.ts). (Structured evidence: oracle-conformance.test.ts)Rules simulatorString-literal escapes in rules: \\, \', \", \n, \r, \t, \b, and \f; \x with two hexadecimal digits and \ with three octal digits as code points; and \u with four hexadecimal digits as one UTF-16 code unit. Any other escape, including \/, and a raw line break are parse errors. The escapes feed matches() (Class B): \\. is unescaped before RE2 compilation, not forwarded raw to a JS RegExp
oracle:rules-firestore-string-literals-and-regex: production Firestore Rules Test API verdicts for corpus scenario "string-literals-and-regex", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production. ROW EXTENDED, 2026-09-27: the same capture adds 18 production verdicts for string literal escapes, 22 in all. A backslash escapes a backslash, either quote, n, r, t, b, or f. \x takes exactly two hexadecimal digits of either case and \ takes three octal digits up to 377; each is the code point of that value, not a byte, so '\xe9' equals 'é' and '\xc3\xa9' is two characters. \u takes exactly four hexadecimal digits of either case and is one UTF-16 code unit: two \u escapes form a surrogate pair, and size() counts code units. A raw tab is a plain character. Production rejects the ruleset for \/ ("Missing 'match' keyword before path"), \a, \v, \?, \d, \., a backslash before a backtick, \0, \12, \400, \x4, \x4g, \X41, \u with fewer than four hexadecimal digits or none, \u{41}, \U escapes, and a raw line feed or carriage return inside the quotes. The shared grammar rejects the same forms, pinned by unit:rules/grammar/string-escape-strict.test.ts, and rejects a raw carriage return in a bytes literal as production does. The grammar previously accepted only \\, \', \", \n, \r, \t, \/, and a raw line break, so a ruleset that used \x, \u, an octal escape, \b, or \f failed to parse and one that used \/ parsed. unit:rules/oracle-conformance.test.ts replays all 22 verdicts and unit:rules/simulator/string-escapes.test.ts pins the string escape cases. The rules assembler, which prints module resolver output, simulator trace text, and query-proof predicates, prints each string and bytes literal as its source text, so the printed rules parse back to the same value. It previously printed a double-quoted string in single quotes without escaping an inner ', so "it's" printed as 'it's', which does not parse. unit:rules/grammar/assembler-literal-roundtrip.test.ts parses, prints, and reparses string literals with each escape in both quote styles, bytes literals, and a 2+modules ruleset resolved by resolveModulesWithFiles.Rules simulatorMissing-field access as a runtime error (RULES-B2) in rules, by dot (data.typo) or by index (data['typo'], data[field]) — typo == null denies (missing access is not null), a list index out of bounds errors, and !(key in map) is the real absence check
oracle:rules-firestore-undefined-field-access — production Firestore Rules Test API verdicts for corpus scenario "undefined-field-access", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production. RECAPTURED, 2026-09-28: the scenario adds 35 production cases (41 in all) for index access. A key the map does not own is an error under index access as under dot access, with the same text ("Property missing is undefined on object."), on resource.data, request.resource.data and request.auth.token, for a literal, computed or path variable key and a nested map; the error survives !, is and in, || true and && false absorb it, and a let bound to it denies only when used. A list index past either end is "Index out of bound error." and a string key on a list is "Unsupported operation error. Received: list[string]. Expected: list[int]." The simulator returned null for a missing index key and disagreed on 16 cases; index access now goes through rules/simulator/index-access.ts, shared with the Storage evaluator. RECAPTURED, 2026-09-30: the scenario adds 12 production cases (89 in all). Dot access on a path reads an unbound name with the error the bracket form gives: request.path.segments == null and request.path.segments != 'zz' deny with "Property segments is undefined on object.", the error survives !, and || true absorbs it. The simulator read an unbound path name by dot access as null and allowed those 2 cases; dot access on a path now goes through readMember in rules/simulator/index-access.ts, shared with the Storage evaluator (unit:rules/simulator/wrappers/path.test.ts). An int index on a timestamp (timestamp.value(0)[0]) or a latlng (latlng.value(1.0, 2.0)[0]) is "Function not found error: Name: [[]].", the text an index on a duration gives, and the simulator matched those 8 cases already.Rules simulatorExplicit UNSUPPORTED reporting for unimplemented built-ins (Item 0.A) in rules — an unimplemented built-in abstains rather than silently DENYing
oracle:rules-firestore-unsupported-feature-witness — production Firestore Rules Test API verdicts for corpus scenario "unsupported-feature-witness", replayed verdict-for-verdict against the local rules simulator by unit:rules/oracle-conformance.test.ts; all cases match production.Rules simulatorRequired-fields validation idiom in rules — request.resource.data.keys().hasAll()/hasOnly() and the diff().addedKeys()/removedKeys()/changedKeys()/affectedKeys()/unchangedKeys() MapDiff family gating field-level mutations
NEW ROW, 2026-07-12: production capture proves the simulator matches the production Firestore Rules Test API verdict-for-verdict on all 7 cases (exact required-field set on create, field-scoped update via MapDiff).
oracle:rules-firestore-required-fields-and-mapdiff — replayed by unit:rules/oracle-conformance.test.ts. RECAPTURED, 2026-09-28: the scenario adds 11 production cases (18 in all) that show Map.keys() returns a List: keys() is list allows, keys() is set is false (its negation allows), and toSet(), hasAll(), hasAny(), hasOnly(), size(), [0] and join(',') evaluate on it. The 2+modules resolver typed keys() as a Set, so a module function that called toSet(), join() or concat() on it was rejected; it now types keys() as a List, and unit:rules/modules/service-compatibility.test.ts pins the admitted shapes and the rejection of Set algebra on keys(). The shared grammar did not accept set as an is type name; it now does, and the simulator matches production on all 18 cases (unit:rules/map-keys-list.test.ts). RECAPTURED, 2026-09-28: 9 production cases (27 in all) compare the MapDiff affectedKeys() Set with a key set. == against a Set ignores order and denies when a key is missing or extra; == against a List of the same keys is false; hasAll() with hasOnly() against a List or a Set allows the same keys and denies when a listed key is unchanged or another key changed. The simulator matches all 27 verdicts, and the lifecycle module's exactlyChanged is hasAll() with hasOnly() on affectedKeys(). RECAPTURED, 2026-09-28: 21 keyOrder cases (48 in all). keys() lists a Map's keys in ascending Unicode code point order, for a literal and for request data written {b, a, n}: {'b': 1, 'a': 2}.keys() == ['a', 'b'] and keys()[0] == 'a' allow and the written order denies; digits sort before upper case, _ and lower case, '10' before '9', a key after its own prefix, and 'z' (U+FF5A) before '😀' (U+1F600), where UTF-16 code unit order denies. values() keeps the order the literal wrote. diff() compares values by numeric value at every depth, so an int and the equal float, an int List and the equal float List, 0.0 and -0.0, and two NaN are unchanged. The simulator returned keys in JavaScript property order (integer-like keys first, then insertion order) and reported two NaN as changed; keys() now comes from rules/simulator/map-keys.ts and MapDiff compares under setElementsEqual, both shared with the Storage evaluator, and the simulator matches all 48 verdicts (unit:rules/simulator/collection-identity.test.ts). RECAPTURED, 2026-09-30: 20 keyOrder cases (68 in all). values() lists a Map literal's values in the order the literal wrote its keys, integer-like keys included: {'b': 1, '1': 2}.values() == [1, 2] allows, == [2, 1] and != [1, 2] deny, and '10' stays before '9'. A repeated key keeps its first position and its last value ({'a': 1, 'b': 2, 'a': 3}.values() == [3, 2]), a nested literal keeps its own order, {}.values() is [], and request data lists its values in the order the request sent them. keys() and values() take no argument ("Incorrect number of arguments. Received: 1. Expected: map.values()."), and keys(), values() or get() on a List or string is "Function not found error: Name: [<method>].". The simulator listed values in JavaScript property order, integer-like keys first, so 6 cases disagreed, and ignored an argument to keys() or values(). A Map literal now records its written order and values() comes from rules/simulator/map-keys.ts, shared with the Storage evaluator; the simulator matches all 68 verdicts (unit:rules/simulator/collection-identity.test.ts).Rules simulatorString.split()/lower()/upper()/trim()/replace()/size(), List.hasAll()/hasAny()/hasOnly()/join(), and Map.values() in rules
NEW ROW, 2026-07-12: production capture proves the simulator matches the production Firestore Rules Test API verdict-for-verdict on all 4 cases (CSV-split membership, slug/title/code normalization).
oracle:rules-firestore-list-and-string-methods — replayed by unit:rules/oracle-conformance.test.ts.Rules simulatorrequest.time Timestamp accessors (year/month/day/hours/minutes/seconds/nanos/dayOfWeek/dayOfYear/toMillis/date/time), math.abs/ceil/floor/round/sqrt/pow/isNaN with production's result types and argument errors, int()/float()/string() casts, request.method, and >= / * operators in rules
NEW ROW, 2026-07-12: production capture proves the simulator matches the production Firestore Rules Test API verdict-for-verdict on all 3 cases (request.time pinned via requestTime for determinism).
oracle:rules-firestore-time-math-and-casts — replayed by unit:rules/oracle-conformance.test.ts. RECAPTURED, 2026-09-27: the scenario adds 34 production cases for int(), float(), and string() (37 in all). int(string) parses a whole signed int64 decimal string; surrounding spaces, a fraction, an exponent, hex, and out-of-range text are "Type conversion error". int(float) truncates toward zero, saturates at the int64 bounds, and maps NaN to 0. float(string) accepts Java double syntax: exponent and hex forms, surrounding whitespace, an f or d suffix, NaN, and Infinity, and rejects inf and nan. string() accepts int, float, null, string, bool, and path, and prints a float as Java Double.toString does, with 4.9E-324 for the smallest subnormal. A bool or null argument to int() or float(), a list, map, bytes, or duration argument to string(), and a second argument are error values that || true absorbs. The simulator previously converted int(true) to 1, accepted an out-of-range int string, rejected exponent, hex, suffix, NaN, and Infinity float text, stringified any value, and printed 1.0E7 as 10000000.0, diverging on 13 of the 34 cases; it now shares the Storage conversion functions and matches production on all 37. RECAPTURED, 2026-09-27: the scenario adds 22 production cases for the math namespace (59 in all), the same cases the Storage scenario math-namespace sends. math.abs() keeps an int an int and a float a float; math.ceil() and math.floor() return a float, for an int argument too; math.round() rounds half up (math.round(-2.5) == -2) and returns an int, with NaN as 0; math.sqrt() and math.pow() return a float and accept ints. A string, bool, or null argument is "Unsupported operation error" naming the overloads, a wrong argument count is "Incorrect number of arguments", and math.isInfinite() is "Function not found error"; each is an error value that denies through ! and that || true absorbs. The simulator returned a JavaScript number for every math result, so math.ceil(1.5) is int allowed and math.sqrt(4) is float denied, and computed math.abs('a') as NaN, so !(math.abs('a') == 1) allowed; it diverged on 12 of the 22 cases. It now calls the math module it shares with the Storage evaluator and matches production on all 59. A 2026-09-27 recapture adds one case (60 in all): math.abs() of the int64 minimum returns it unchanged, so it stays negative, as the shared math module now does.Rules simulatorlatlng.value().latitude()/longitude()/distance() and duration.value()/time()/abs() in rules
Production captures from 2026-07-12 and the 2026-07-21 recapture prove the simulator matches the Firestore Rules Test API verdict-for-verdict on all 3 cases: coordinate and duration bounds plus exact
duration.value(1500, 'ms').seconds() / .nanos() components. oracle:rules-firestore-duration-and-latlng — replayed by unit:rules/oracle-conformance.test.ts.Rules simulatorUser-defined function/let, granular allow get/list/update/write verbs, the ternary operator, and a recursive {document=**} match in rules. A function may call a method on a parameter, on a field of a get() result, on a let bound to request data, or on a ternary whose branches have different types; the receiver's runtime type decides at evaluation, and a method the runtime value does not support denies. 2+modules module functions resolve the same shapes
NEW ROW, 2026-07-12: production capture proves the simulator matches the production Firestore Rules Test API verdict-for-verdict on all 7 cases (role-gated docs + public recursive subtree).
oracle:rules-firestore-functions-verbs-and-recursive — replayed by unit:rules/oracle-conformance.test.ts. Extended 2026-09-26: the recapture adds 13 production verdicts (8 ALLOW, 5 DENY) proving production compiles method calls on receivers it cannot type at compile time: a get() result passed as a parameter, a method on a get() field, a map field passed as a parameter, a parameter passed from one function to another, a let bound to request.resource.data, and a ternary whose branches are a map and a string. A runtime value without the method denies with Function not found error: Name: [size]. or Name: [keys].. The original 7 verdicts are unchanged, and the local simulator replays all 20. The module resolver tests prove 2+modules admits the same shapes for cloud.firestore and firebase.storage, and still rejects a method on a receiver of known type that does not support it and a method name no receiver type defines. The same capture shows production evaluates let values: let doc = request.resource.data; decides ALLOW or DENY by the field type read through doc, and let base = isSignedIn() ? 1 : 0; reaches request.auth only through a function called from a let value. The validator follows calls into each function's let values as well as its return expression, so SEC-3 and SEC-6 count request.auth and request.resource.data read through a let, and QUA-4 counts a function called only from a let value as called; unit:rules/grammar/validator-bugbash.test.ts pins all three. RECAPTURED, 2026-09-27: the scenario adds 5 production verdicts (25 in all, 16 ALLOW and 9 DENY) for values computed from request data: x in the affectedKeys() of a diff of two request maps, a method on an element of request.resource.data.at.split('_'), and a method on an element of a literal split by a request string. Production compiles and evaluates each. The 2+modules resolver rejected all three in a module function as an unsupported derived binding; it now treats a value computed only from user-defined data or scalar bindings as data, keeps the check for a value that may be a binding with a fixed field set (such as Storage's request.resource routed through a list literal or a ternary), and unit:rules/modules/service-compatibility.test.ts pins both sides. The same day the Rules Test API rejected a ruleset that defines one function name twice in one match block or in service scope with "Function f is already defined." (a rejected ruleset returns no verdicts, so this is not a replayable case). The compile-limit module (rules/grammar/compile-limits.ts) reports it with that text, so firestoreRules(), the simulator and the sandbox refuse the ruleset at load, and the validator's QUA-3 finding carries the same text; unit:rules/simulator/compile-limits.test.ts and unit:rules/grammar/validator.test.ts pin both, and a nested match block function that shadows an outer one still compiles. UPDATED, 2026-10-06: the resolved ruleset's source map names the file each generated line was authored in. The service line and the let bindings of the root file's functions named firestore.rules, for a Storage root file too, in place of the root file's name; unit:rules/modules/source-map-files.test.ts pins both root file names. (Structured evidence: resolver-call-sites.test.ts)Rules simulatorResource identity (resource.id/resource.__name__/request.resource.id) on an EXISTING document (RULES-B12) — production leaves the identity keys ABSENT, so reading one errors → DENY, the error survives negation, and only a determining || operand absorbs it
NEW ROW, 2026-07-12: production capture proves the simulator matches the production Firestore Rules Test API verdict-for-verdict on all 13 cases. Production builds
resource (and request.resource) from the supplied document alone and derives NO identity from the request path, so resource.id/resource.__name__/request.resource.id read as absent properties — verbatim Property id is undefined on object. / Property __name__ is undefined on object. — which absorb to DENY. The simulator previously SYNTHESIZED id/__name__ from the request path on get/list/update/delete, so resource.id == id ALLOWed where production DENIES: an over-permissive divergence, now removed. The negation cases (resource.id != 'zzz', !(resource.id == 'zzz')) pin that the absent read is a propagating error rather than a false, which an absent-as-undefined model would false-ALLOW. oracle:rules-firestore-resource-document-identity — replayed by unit:rules/oracle-conformance.test.ts.Rules simulatorRequest-target resource on a missing document (RULES-B13) — get/update/delete existence guards, null comparison, and data access all error to DENY
NEW ROW, 2026-07-12: production capture proves the simulator matches the Firestore Rules Test API verdict-for-verdict on all 9 cases. A missing request target makes the
resource global an error value: resource != null, resource == null, and resource.data.value all DENY. The simulator previously constructed { data: {} } for missing get/update/delete requests, so the ordinary resource != null existence guard false-ALLOWed all three operations. Modeling the target as raw null fixes that guard but makes resource == null false-ALLOW, so the evaluator now raises Null value error. when the absent resource identifier itself is evaluated. Existing-document get/update/delete and data-access controls still ALLOW. oracle:rules-firestore-resource-missing-document — replayed by packages/pyric/test/rules/oracle-conformance.test.ts.Rules simulatorA ruleset with NO rules_version declaration — production accepts it and defaults to v1
NEW ROW, 2026-07-17: production capture proves a version-less ruleset deploys and evaluates (production defaults
rules_version to v1; the shared grammar previously rejected the file at parse — PR #333 grammar fix, the same evidence that reclassified corpus file 001-missing-version.rules from invalid to edge-cases). oracle:rules-firestore-optional-rules-version matches the local simulator verdict-for-verdict on all 3 cases. (Structured evidence: oracle-conformance.test.ts)Rules simulatorFunction declarations at GLOBAL and SERVICE scope in a Firestore ruleset, with match-scope shadowing, including a flat && or || chain of up to 98 operands in a function at either scope. The linter and validator check functions at every scope, and the NESTING_DEPTH error fires above 98 operands
RECAPTURED, 2026-09-26:
oracle:rules-firestore-global-and-service-scope-functions records 9 production Firestore Rules Test API verdicts: the 5 scope and shadowing cases, plus a 98-operand && chain declared at global scope and a 98-operand || chain declared at service scope, each compiling and evaluating to ALLOW and DENY. The simulator seeds each match walk with global, then service, then match functions, so an inner declaration shadows an outer one, and unit:rules/oracle-conformance.test.ts replays all 9 verdicts. The same day, the Rules Test API rejected a 99-operand && or || chain in a function at global, service, or match scope with "Expression is too complex to evaluate safely." and compiled the 98-operand chain at each scope. A rejected ruleset returns no verdicts, so the 99-operand bound is not a replayable case. unit:rules/linter/linter.test.ts pins the lint side: functions at all three scopes count toward functionCount and maxEstimatedExpressions, NESTING_DEPTH counts each operator on the left-associative spine as one level, 99 operands raise the limit error at every scope, 98 raise none, and a match-scope function shadows a service-scope one. unit:rules/grammar/validator.test.ts pins that a call to a global-scope or service-scope function is not reported as undefined and that SEC-3 follows the call into it. Extended 2026-09-27: the Rules Test API compile-limit capture in packages/pyric/test/rules/linter/fixtures/compile-limits/captures.json records the other structural limits for Firestore and Storage rulesets. A call chain of 21 functions compiles and 22 is rejected with "Maximum allowed call depth of 20 is reached", also when no rule calls the chain; 11 let bindings compile and 12 are rejected with "Maximum allowed variable count of 10 for a given function has been reached."; a right-nested && chain of 49 terms and 97 parentheses around one comparison compile, and 50 terms or 98 parentheses are rejected with "Expression is too complex to evaluate safely.". unit:rules/linter/linter.test.ts reads that fixture and pins the CALL_DEPTH error above 21 functions, for a chain no rule calls as well, and the LET_LIMIT boundary. The runtime limit of 1000 evaluated expressions per request, measured by padding in packages/pyric/test/rules/linter/fixtures/expression-cost/captures.json, is enforced by simulate and by Storage rules evaluation: each request counts its expressions in production's unit across every allow rule and match block it reaches, and a request past the limit is DENY with production's message "Unable to evaluate the expression as the maximum of 1000 expressions to evaluate has been reached.". unit:rules/simulator/expression-budget-fixture.test.ts replays production's padding thresholds through the simulator: the count lies inside production's window on 33 of the 34 captured requests, and the chess queen move production stopped at the limit is denied at the limit. unit:rules/simulator/expression-budget.test.ts and unit:storage/sandbox/rules-expression-budget.test.ts pin the unit and the limit boundary in each service. Extended 2026-09-27: the Rules Test API name-resolution capture in packages/pyric/test/rules/grammar/fixtures/name-resolution/captures.json records that production resolves function and variable names by declaration scope. A call to a function declared only in a sibling match, or from a service or global function to a function in an inner scope, compiles with "Invalid function name: s."; an identifier that is no let binding, parameter, enclosing path capture, or global compiles with "Invalid variable name: d."; both deny the request that evaluates them; and a function no resolved call reaches, at global, service, or match scope, draws "Unused function: f.". unit:rules/grammar/validator-name-resolution.test.ts replays each captured ruleset through the validator: SEM-4 reports each unresolved call, SEM-5 each unbound variable, and QUA-4 each unused function, in rule conditions and function bodies at every scope. The Firestore simulator and the Storage evaluator enforce all three limits when a ruleset loads (packages/pyric/src/rules/grammar/compile-limits.ts) and refuse a ruleset over one with production's messages: unit:rules/grammar/compile-limits.test.ts matches the reported messages to every probe in the fixture; unit:rules/simulator/compile-limits.test.ts pins that firestoreRules, simulate and the sandbox's deployed rules refuse each rejected Firestore probe and evaluate each compiling one, including the 21-function chain, to production's verdicts; and unit:rules/linter/linter.test.ts pins the NESTING_DEPTH error at the same boundary. Extended 2026-09-28: the compile-limit capture adds two member-chain probes, a member chain request.auth.token.m.m... behind a comparison that grants uid a. A 100-term chain compiles; a ruleset holding a 4,900-term chain drew 500 INTERNAL: Internal error encountered. from the Rules Test API on every attempt instead of a compile result, recorded as the probe's apiError; the length between them is not measured. unit:rules/linter/linter.test.ts pins that the linter reports MEMBER_CHAIN_LENGTH as an error for the 4,900-term probe and nothing for the 100-term one, that a chain deeper through the functions it calls than the linter's recursive checks can walk is reported as EXPRESSION_TOO_DEEP rather than thrown, and that the linter reports SLASH_STARTS_PATH with production's message "Missing 'match' keyword before path." for the rejected slash-divisor probe and nothing for the compiling one. Extended 2026-10-07: the compile-limit capture adds the glob-in-path and glob-nested probes. A match declaration path holds at most one recursive wildcard, counted across the block's path and the paths of the blocks it is nested in: match /{g1=}/p/{g2=}, and match /{rest=} nested in match /{g=}/p/{gid}, are rejected with "Invalid glob match expression. Only one glob match is permitted in a match declaration path." on the line of the declaration that holds the second one, while match /{g1=}/p/{d}, and match /{rest=} nested in match /p/{gid}, compile. The compile-limit module reports it with that text, so firestoreRules(), simulate, the sandbox's deployed rules and the served rules loader refuse the ruleset; unit:rules/grammar/compile-limits.test.ts pins the message and line, unit:rules/simulator/compile-limits.test.ts the refusal and the compiling probes' verdicts, and cli:serve/rules.test.ts the served refusal. The compiling glob-nested probe also showed production matching a nested match /{rest=**} with zero segments after a block that consumed the whole path, which the Firestore matcher now does; unit:rules/simulator/match-resolution.test.ts pins it. Extended 2026-10-27: the compile-limit capture adds the and-chain and and-chain-calls probes, flat chains with no parentheses. 98 comparisons compile and 99 are rejected, while 99 zero-argument function calls compile and 100 are rejected, each with "Expression is too complex to evaluate safely."; unit:rules/linter/linter.test.ts and unit:rules/simulator/compile-limits.test.ts replay all six probes.Rules simulatorHierarchical nested match composition. A child match resolves relative to its parent and grants only the exact nested document path. A recursive wildcard matches zero or more segments: followed by further segments, as in the collection-group shape match /{path=}/items/{id}, it governs every document in a collection with that id at any depth and nothing else, and a match nested in that block matches no request; in the last position, as in match /{document=}, a nested match resolves at any depth below it with the recursive wildcard bound to the longest prefix that lets it match
oracle:rules-firestore-hierarchical-match-cascade captures the exact nested child ALLOW plus parent, sibling, and over-deep DENY controls from the production Firestore Rules Test API, replayed verdict-for-verdict by packages/pyric/test/rules/oracle-conformance.test.ts. RECAPTURED, 2026-10-07: the scenario adds 21 production verdicts (11 ALLOW, 10 DENY; 25 in all) for recursive wildcard placement. Under match /{path=}/items/{id}, get and list allow in items/i1, users/u1/items/i1, a/b/c/d/items/i1, items/i1/items/i2, and items/items/items/i3, and deny in a sibling collection, under an items document, and on the parent document. The trailing document wildcard binds the last segment. A match nested in match /{group=}/groups/{groupId} denies at the root and at depth. A match nested in match /{document=**} allows at the root and at depth, and in notes/n1/notes/n2 its document wildcard binds n2. unit:rules/simulator/match-resolution.test.ts pins the bindings for each placement, and unit:firestore/collection-group-rules.test.ts pins direct reads, collection-group queries, and query proof under the collection-group shape through the public SDK.Rules simulatorStrict boolean operands for &&, ||, and ternary control flow, plus create-time resource / request.resource semantics. A rules case is one request in simulate(), the MCP firestore_simulate_rules tool and the Rules Test API wire: a create case that names an existing resource, a case with an unknown method or field or no path, and a requestTime that is not ISO-8601 with an offset are refused with the reason; value helpers reach the wire in the form production reads as their type, and a plain map with a __type key is a map in both engines
oracle:rules-firestore-strict-boolean-control-flow captures three direct non-boolean DENYs, three tautological error discriminators that still DENY, a boolean ALLOW control, create-time resource == null DENY, and incoming request.resource.data ALLOW; replayed verdict-for-verdict by packages/pyric/test/rules/oracle-conformance.test.ts. RECAPTURED, 2026-09-27: 9 allow-condition cases (18 in all) show the allow condition itself must be a bool. Production compiles allow create: if 'ab'; and the conditions 1, 0, 1.0, null, [], request.resource.data (a map), and a string field, then denies each with Type error. Received: [<type>] Expected: [bool].; if true allows. The simulator decided an allow by JavaScript truthiness, so a non-empty string, a nonzero number, a list, or a map allowed; it now raises the same type error as an ERROR verdict for that rule and matches all 18 verdicts. Extended 2026-10-28 (#1338): the Rules Test API capture in packages/pyric/test/rules/test/fixtures/case-wire/captures.json (packages/conformance/src/capture-rules-case-wire.ts, 4 calls, no deploy) records production binding a create case's resource, which no real create has (resource.data.x == 1 and resource != null ALLOW, FS2-CON-12), and reading {__type: 'timestamp', seconds, nanos} as a map (FS2-CON-5). It also records the JSON forms production reads as typed values, each keeping its value: an ISO-8601 string with an offset as a timestamp, {latitude, longitude} as a latlng, -1.500000000s as a duration, and a /databases/(default)/documents/... string as a path, while a base64 string stays a string. unit:rules/test/case-wire-capture.test.ts replays it: simulate() and buildApiTestCase refuse each create case with a resource, a create without one gets production's verdicts, simulate() reads the __type map as a map, and buildApiTestCase sends each value helper in the captured form, which simulate() reads as production does for timestamp, latlng and duration. unit:rules/api/case-shape.test.ts pins the refusals through simulate() and the MCP tool and the value helpers' range checks, and unit:rules/test/api-wire.test.ts pins the built request for a merge set, a replacing set, a dotted update, a full-form path and each value helper, and that TestFirestoreRulesHandler refuses a malformed case before calling the API.Rules simulatorThe exact six shared auth and membership function bodies preserve signed-in, owner, custom-claim, explicit membership-map, and role semantics under Firestore Rules
NEW ROW, 2026-07-21: one bounded, read-only Firestore Rules Test API request captured 12 verdicts for the exact bodies shipped from
auth and membership; oracle:rules-firestore-common-auth-membership-firestore matches the local Firestore rules simulator verdict-for-verdict (6 ALLOW, 6 DENY). The cross-service source-lock test requires these six Firestore corpus bodies, the previously captured Storage corpus bodies, and the shipped modules to remain normalized-AST-identical. (Structured evidence: oracle-conformance.test.ts)Rules simulatorIn multi-document batched writes and transactions, getAfter() on a document the batch updates returns the stored document with the update's field mask applied: fields the update does not name keep their stored values, and a nested map the update names is replaced, not merged.
Unverified, 2026-11-01 (#1322): no capture with this probe's controls backs this row yet. The Rules Test API cannot evaluate
getAfter(). The committed rules-firestore-atomic-batch-sibling-merge observation is a real-database capture from before firestore-real-sibling-merge.ts, with no two-field ALLOW control, and its hostedTestApiLimitation diagnostic records Function not found error: Name: [getAfter]. The weekly re-capture on the oracle project answers DENY for the same case, and that DENY is the same Test API error (Function not found error: Name: [getAfter]), not an answer from a database. The corpus case it replays is also not a batch: it is a single create with a get mock that already holds both fields. The real-database rig's cross-document batch probe (crossDocumentBatch in rules-firestore-get-after-and-exists-after) updates a companion document whose only field is the one the batch changes, so it does not test a field the batch leaves alone. run-firestore-real.ts now adds that case from the plan in firestore-real-sibling-merge.ts: it seeds a companion with role: 'admin' and modified: false, commits a batch that updates only modified beside a create whose rule reads both fields through getAfter(), makes the same create alone as a DENY control, and commits a batch that updates both fields of a second companion as an ALLOW control. The writer refuses to record a capture unless both solo controls answer DENY and the two-field batch answers ALLOW. Its next run writes the batch verdict into the observation's behavior under the corpus case key, and all three verdicts into diagnostics.productionDatabase, which also makes run-rules.ts leave the observation alone. packages/conformance/test/src/firestore-real-sibling-merge.test.ts runs the same plan through LocalEnvironment and compares it with those recorded verdicts. Until the capture lands, the unit-backed assertion in unit:rules/oracle-conformance.test.ts pins the local behavior: a batch update keeps the companion's other fields in getAfter(). (Structured evidence: get-after-batch.test.ts)Rules simulatorCompile-time AST verification rejects non-conforming casts (bool()), unsupported helper methods (math.isInfinite()), and bare Map membership assertions (map.hasAll).
Captured production behavior via rules-firestore-ast-strictness-and-unsupported-casts proves compile-time AST verification and execution rejection of bool(), math.isInfinite(), and bare Map membership assertions (map.hasAll). (Structured evidence:
rules-firestore-ast-strictness-and-unsupported-casts, oracle-conformance.test.ts, hallucinations.test.ts)Rules simulatorTimestamp seconds() and nanos() are time-of-day components like hours() and minutes(): the seconds of the minute and the nanoseconds of the second. toMillis() is the epoch accessor, and timestamp.value(-1500) reads year 1969, seconds 58, and nanos 500000000
CONFORMS, 2026-09-24:
oracle:rules-firestore-timestamp-component-accessors captures production reading request.time.seconds() as 30 at 13:45:30.250 and denying the epoch-seconds reading, nanos() as 250000000, and the components of a pre-epoch timestamp. The Storage capture rules-storage-stdlib-timestamp-duration records the same values under firebase.storage (row storage-rules#storage.stdlib.timestamp-duration). The shared Timestamp wrapper reads seconds() as the seconds of the minute; unit:rules/oracle-conformance.test.ts replays all 5 verdicts and unit:rules/simulator/wrappers/timestamp.test.ts pins the components, including a pre-epoch timestamp.Rules simulatorRuntime operand types for -, *, /, %, and unary -; user-defined functions shadowing global built-ins and enforcing parameter arity; Java Matcher replacement escapes (\$, $1) and string/list/map method arity and argument types; request.resource omitted on get, list, and delete without a test payload (and populated on delete when the Rules Test API case supplies data); timestamp.date(y, m, d) calendar bounds; runtime string-key enforcement on map literals; and document-level Path requirement on exists()/get()/existsAfter()/getAfter()
NEW ROW, 2026-10-17:
oracle:rules-firestore-simulator-language-semantics captures 18 production verdicts (4 ALLOW, 14 DENY) across FS-SIM-2, FS-SIM-4, FS-SIM-5, FS-SIM-6, FS-SIM-9, FS-SIM-10, FS-SIM-11, and FS-SIM-12. Production denies non-numeric arithmetic ('abc' - 'a', -'5'), wrong user-function arity, extra arguments to string.lower(), list.toSet(), map.get(), and map.diff(), non-map arguments to map.diff(), out-of-range calendar dates in timestamp.date() (month: 13, Feb 30), non-string dynamic map literal keys, and string or odd-segment collection-path arguments to exists(); allows a user function named int shadowing the built-in cast and string.replace with \$; and omits request.resource on get and delete without a test payload while honoring a test-supplied data payload on delete. unit:rules/oracle-conformance.test.ts replays all 18 verdicts and unit:rules/simulator/evaluation-builtins.test.ts pins the full simulator semantics suite. (Structured evidence: document-lookups.test.ts, latlng.test.ts)Rules simulatorRules Test API functionMocks: get and exists are separate service functions, so an exists mock never supplies a get() document, mock order does not matter, and a mock path is normalized like a lookup path (leading slash). Also, a sibling {document=**} read deny does not revoke a match /menuItems/{id} list grant (OR across matching blocks)
NEW ROW, 2026-10-17:
oracle:rules-firestore-simcase-mock-and-path-fidelity captures 6 production verdicts (5 ALLOW, 1 DENY) for FS-CON-6 / FS-COV-6a / FS-MET-6b / FS-COV-6b. An exists-only mock plus get() DENIES ("Function not found error: Name: [get]."), exists: false next to a get mock makes !exists() ALLOW, [exists, get] and [get, exists] both ALLOW, a '/other/x' mock path ALLOWS, and a doc-path list beside a {document=**} read deny ALLOWS. unit:rules/oracle-conformance.test.ts replays all 6, and unit:rules/simulator/simcase-fidelity.test.ts pins the simulator's functionMocks handling and the collection-path list form.Rules simulatorIntegers are 64-bit: values above 2^53 keep every bit, overflow is an evaluation error except MIN / -1, which is MIN, unary minus negates a duration, and a timestamp or duration result past its range is an error (FS2-SIM-1, FS2-SIM-2, FS2-SIM-3, FS2-SIM-9)
oracle:rules-firestore-int64-and-duration-range (captured 2026-10-27, 22 cases) records production ALLOWING neg duration equals duration.value(-1, 's'), int64 max is greater than max minus one, 2^53 plus one differs from 2^53, string() of 2^53 plus one and min divided by minus one is min, and DENYING max plus one is positive, max timestamp plus 1 ms is later and duration past the protobuf bound is positive. The simulator agrees on all 22: rules ints are int64 values held as bigints, so literals and int arithmetic keep every bit above 2^53, a result past the range is production's Integer value is out of the [-9223372036854775808, 9223372036854775807] range. error value except MIN / -1, and unary minus negates a duration (rules/simulator/rules-int.ts, #1335). A timestamp or duration past its range is production's Timestamp is not valid or Duration is not valid error (#1336). unit:rules/oracle-conformance.test.ts replays them with no pin, unit:rules/simulator/int64.test.ts covers each operator's overflow, its absorption by || true and && false, and the Invalid number literal compile refusal, and unit:rules/simulator/time-range.test.ts covers the time ranges.Rules simulatormatches(), split() and replace() use RE2: \s is [\t\n\f\r ], . matches \r, \pL, [[:alpha:]] and \Q..\E are a class, a POSIX class and literal quoting, split() does not return capture-group text, and (?i) applies in split() and replace() (FS2-SIM-4, FS2-SIM-5a, FS2-SIM-5a2, FS2-SIM-5b, FS2-SIM-5c, FS2-SIM-5d, FS2-SIM-6)
oracle:rules-firestore-re2-pattern-semantics (captured 2026-10-27, recaptured 2026-10-28 with 6 more cases, 34 in all, every earlier verdict unchanged) records production ALLOWING NBSP is not \s, em space is not \s, vertical tab is not \s, real nbsp from data is not \s, dot matches carriage return, a is \pL, a is [[:alpha:]], quoted a.b matches a.b, split on a capturing group returns two pieces, split with (?i) splits both cases, replace \s leaves NBSP, split dot matches carriage return, replace dot matches carriage return, replace (?s) dot matches newline, split (?i)k splits on the Kelvin sign and replace (?i)k replaces the Kelvin sign. The simulator agrees on all 34 cases. (Structured evidence: oracle-conformance.test.ts, re2-space-and-trim.test.ts, re2-dot-property-and-flags.test.ts, split-and-replace.test.ts)Rules simulatorWithout rules_version = '2', a recursive wildcard does not match an empty path: /cities/{city}/{document=**} does not match cities/SF (FS2-SIM-12)
oracle:rules-firestore-rules-version-1-recursive-glob (captured 2026-10-27, 3 cases) records production DENYING get on cities/SF under a version-1 match /cities/{city}/{document=} and ALLOWING cities/SF/landmarks/x and top/a under /top/{document=}. unit:rules/oracle-conformance.test.ts replays all 3 cases against the local simulator, whose match resolver reads the ruleset's version and needs one or more segments for a recursive wildcard under version 1 (#1337). unit:rules/simulator/rules-version-1-glob.test.ts denies get and list of the city document with no rules_version and with rules_version = '1', through simulate() and the in-page sandbox's getDoc, covers a nested block under a final glob and a root ending in a glob, and keeps version 2 and 2+modules matching zero segments. The in-page sandbox's getDocs of the bare collection still lists through a widened document path (#1428).Rules simulatorThe literal segments of the service's root match path are compared with the request path: a ruleset rooted at another collection grants nothing outside it (FS2-ENF-1)
oracle:rules-firestore-service-root-match-path (captured 2026-10-27, 3 cases) records production DENYING get and create outside the root collection and ALLOWING the control inside it, under the root /databases/{database}/documents/z. unit:rules/oracle-conformance.test.ts replays all 3 cases against the local simulator, which matches the root against /databases/(default)/documents/<path> before resolving its children (#1327). unit:rules/simulator/root-match-path.test.ts denies get, create, list and a collection-group query of c/1 under the roots /databases/other/documents, /databases/{db}/documents/z, /databases/{db}/documentz and /b/{bucket}/o, through simulate() and the in-page sandbox, and keeps the standard root, a root ending in a collection and a root ending in a recursive wildcard granting.Rules simulatorsplit() drops trailing empty pieces, and trim() strips only code units at or below U+0020, keeping NBSP, U+3000 and the byte-order mark (FS2-SIM-7, FS2-SIM-8)
oracle:rules-firestore-split-and-trim-edges (captured 2026-10-27, recaptured 2026-10-28 with 7 more cases, 18 in all, every earlier verdict unchanged) records production ALLOWING 'a,b,'.split(',') == ['a', 'b'], 'a,b,,'.split(',').size() == 2, ',a,'.split(',') == ['', 'a'] and 'a1b2'.split('([0-9])') == ['a', 'b'], ALLOWING 'a.b.c'.split('.') == [''], ','.split(',') == [''] and ',,'.split(',') == [''] while DENYING ','.split(',').size() == 0 and 'a.b.c'.split('.').size() == 0 (trailing empty pieces are dropped, but one piece always remains), DENYING 'a,b,'.split(',') == ['a', 'b', ''], and ALLOWING trim keeps NBSP, trim keeps ideographic space, trim keeps BOM and trim strips C0 controls. unit:rules/oracle-conformance.test.ts replays all 18 cases against the local simulator. split() goes through the shared splitRe2 (#1333), which Storage also calls, and unit:rules/simulator/split-and-replace.test.ts replays the split cases from this observation on Firestore and Storage. trim() strips code units at or below U+0020 through the shared trimRulesString (#1295), and unit:rules/simulator/re2-space-and-trim.test.ts replays the 4 FS2-SIM-8 cases.Rules simulatordebug(), map.hasAny(), map.hasOnly(), an unknown method and an unknown global compile, and calling one is a "Function not found" runtime error that || true absorbs
oracle:rules-firestore-unknown-function-names-runtime-error (captured 2026-10-27, 9 cases) records production compiling each name, DENYING the bare debug(), map.hasAny and map.hasOnly calls, and ALLOWING each under || true and !(map.hasOnly && false), so production does not reject them at compile. unit:rules/oracle-conformance.test.ts replays all 9 verdicts with no pin.Rules simulatorThe allow statements written on a root match /{path=**} block apply, as on any other block: the root matches every document's full resource name (FS3-ROOT-1)
oracle:rules-firestore-root-recursive-with-own-allow (captured 2026-11-04, 2 cases) records production ALLOWING get c/1 and list c under match /{path=**} { allow read: if true; }. collectRootMatches in rules/simulator/root-match.ts includes the root block when its path covers the request's full resource name (#1894), and unit:rules/oracle-conformance.test.ts replays both verdicts with no pin. unit:rules/simulator/root-own-allow.test.ts replays them through simulate() and the in-page sandbox.Rules simulatorThe allow statements written on a root match /databases/{database}/documents block grant no document: that root does not match a document's full resource name, only its children do
oracle:rules-firestore-root-documents-own-allow (captured 2026-11-04, 1 case) records production DENYING get c/1 under an allow read: if true written on the root /databases/{database}/documents. unit:rules/oracle-conformance.test.ts replays the verdict with no pin.Rules simulatorA root match /{path=**} binds its wildcard to the request's full resource name as a path, so path == path('databases/(default)/documents/c/1') holds for get c/1 (FS3-ROOT-1)
oracle:rules-firestore-root-recursive-path-value (captured 2026-11-04, 1 case) records production ALLOWING get c/1 under allow get: if path == path('databases/(default)/documents/c/1') on the root /{path=**}. The simulator binds recursive wildcards as rules.Path and agrees. (Structured evidence: oracle-conformance.test.ts)Rules simulatorThe write rules written on a root match /{path=**} block apply: allow write: if request.auth != null on the root allows a signed-in create and denies a signed-out one (FS3-ROOT-1)
oracle:rules-firestore-root-recursive-own-allow-write (captured 2026-11-04, 2 cases) records production ALLOWING a signed-in create of c/1 and DENYING a signed-out one, whose diagnostic reads "Property auth is undefined on object.". The simulator evaluates the root's own rules (#1894), and unit:rules/oracle-conformance.test.ts replays both verdicts with no pin. unit:rules/simulator/root-own-allow.test.ts replays them through simulate() and the in-page sandbox.Rules simulatorA $(value) in a get() or exists() path is one segment, whatever it holds: a value holding / names no document, so the lookup errors, while a literal deeper path and path() of a concatenated string read the deeper document (FS3-SIM-1)
oracle:rules-firestore-interpolated-lookup-path-segments (hunt capture c7a-interp-lookups, 2026-11-04, 8 cases) records production DENYING exists() with k: 'x/sub/y' (ex1), !exists() with the same value (ex2) and get() with owner: 'u1/keys/k1' (ge0), each a service call error whose argument keeps the value as one segment, and ALLOWING the plain-id controls ex0 and ge1, || true (ex3), a literal deeper path (ex4) and path() of a concatenated string (ex5), even with the deeper document mocked as existing. unit:rules/oracle-conformance.test.ts replays all 8 verdicts. Fixed in #2177 (#1888): the simulator used to read ex1 and ge0 as the deeper document; unit:sandbox/rules-lookup-path.test.ts checks the same lookups through setDoc and uploadBytes on Firestore and Storage.Rules simulatorint64 conversions and limits (int() of strings and floats, math.abs, math.round, math.floor, math.ceil, overflow, float division and modulo, durations at int64), and an int and a float past 2^53 compared under ==, in a List, a Map, a Set and a map diff
oracle:rules-firestore-int64-conversions-and-mixed-equality (captured 2026-11-04 by the rules engine defect hunt as c2-numbers, 56 cases) records production failing int() of a string past int64, with a space, a fraction, hex or an exponent as a type conversion error, saturating int(float('1e19')) and mapping int(float('NaN')) to 0, returning MIN from math.abs(MIN), failing MIN * -1 and -MIN as out of range, and ALLOWING 9007199254740993 == 9007199254740992.0 while DENYING the same pair in a List, a Map, in, hasAll(), a Set (eq7) and a map diff (eq8). The simulator compared an int and a float past 2^53 through a double in a Set and a map diff, so eq7 and eq8 allowed (#1893); setElementsEqual in rules/simulator/value-equality.ts now compares an int against a float's exact value, and unit:rules/oracle-conformance.test.ts replays all 56 verdicts with no pin (unit:sandbox/rules-int-float-sets.test.ts through setDoc and uploadBytes).Rules simulatorAn int and a float in collections: one value under ==, distinct elements in a List or Map, one element in a Set, and distinct Set elements past 2^53
oracle:rules-firestore-mixed-number-collections (captured 2026-11-04 by the rules engine defect hunt as c3-mixed-number-collections, 17 cases) records production ALLOWING 1 == 1.0, 9007199254740993 == 9007199254740992.0 and [1.0].toSet().hasOnly([1]), and DENYING [1] == [1.0], 1 in [1.0], [1].hasAll([1.0]), [1.0].hasAny([1]), removeAll() across the two types, nested Lists and Maps of them, and [9007199254740993].toSet() == [9007199254740992.0].toSet() (b6). The simulator compared an int and a float past 2^53 through a double in a Set, so b6 allowed (#1893); setElementsEqual now compares an int against a float's exact value, and unit:rules/oracle-conformance.test.ts replays all 17 verdicts with no pin (unit:sandbox/rules-int-float-sets.test.ts).Rules simulatormatches() reads \p{Cyrillic}, \p{Han}, \p{Latin} and \P{Greek} as RE2 script classes, inside a class and through a deny-list guard on request data, and a nested repeat (a+)+b in split() and replace() on a 27-character subject returns production's result (FS3-RE2-1)
oracle:rules-firestore-script-classes-and-nested-repeats (found by the 2026-11-03 rules engine defect hunt and captured on 2026-11-04 as c10-script-classes-and-redos, 8 cases) records production DENYING a create of the name Пётр under !request.resource.data.name.matches('.\\p{Cyrillic}.') (sg0) while ALLOWING Peter, ALLOWING '中'.matches('\\p{Han}') (sg3), 'a'.matches('[\\p{Latin}]') and !'α'.matches('\\P{Greek}'), ALLOWING !'p{Greek}'.matches('\\p{Greek}') (a script class does not match its own name's letters), and ALLOWING the (a+)+b split() and replace() cases. compileCharMatcher in rules/simulator/rules-type.ts spells RE2's script names as \p{Script=Name} for the matcher (#1889), so pyric agrees on all 8 verdicts; unit:rules/oracle-conformance.test.ts replays every verdict with no pin, and unit:sandbox/rules-re2-script-classes.test.ts replays them through setDoc and uploadBytes.Rules simulatormatches(), split() and replace() read RE2's Unicode classes (\pN, \p{Greek}), POSIX classes, \Q..\E, (?i), \x61, \b, \d, . against U+2028 and a class range over emoji as production does (FS3-RE2-1, FS3-RE2-2)
oracle:rules-firestore-re2-more-classes-and-escapes (captured 2026-11-04 by the rules engine defect hunt as c9-re2-more, 15 cases) records production ALLOWING every case: 'α'.matches('\\p{Greek}') (pg1), '😀'.replace('[😀-😂]', 'x') == 'x' (ar0) and 'a😀'.split('[😀-😂]') == ['a'] (ar1), 'a1'.replace('\\pN', 'x') == 'ax' (pn0), 'α'.replace('\\p{Greek}', 'x') == 'x' (pg0), 'a.b'.split('[[:punct:]]') == ['a', 'b'] (px2), 'a.b'.split('\\Q.\\E') == ['a', 'b'] (qs0), and the (?i), [[:^alpha:]], U+2028, \\x61, \\b and \\d cases. The simulator agrees on all 15. In matches(), compileCharMatcher in rules/simulator/rules-type.ts spells RE2's script names for the u flag, so pg1 agrees (#1889). split() and replace() run on the linear matcher matches() uses and read code points, so ar1 and ar0 agree (#1890), and replace() reads \\pN and \\p{Greek} as classes (pn0, pg0, #2211). parseRe2Pattern reads [[:punct:]] as RE2's ASCII POSIX class and \\Q..\\E as literal text, so px2 and qs0 agree (#2211). unit:rules/oracle-conformance.test.ts replays every verdict with no pin, and unit:rules/simulator/split-linear-re2.test.ts replays ar1 through a sandbox setDoc.Rules simulatorlower() and upper() map the ASCII letters only and leave every other letter as it is (FS3-STR-1)
oracle:rules-firestore-string-case-mapping (captured 2026-11-04 by the rules engine defect hunt as c11-case-mapping, 17 cases) records production ALLOWING 'aB'.upper() == 'AB' (cm0), 'é'.upper() == 'é' (cm2), 'Ä'.lower() == 'Ä' (cm4), 'ΑΣ'.lower() == 'ΑΣ' (cm6), 'ж'.upper() == 'ж' (cm8), 'aé'.upper() == 'Aé' (cm9), 'ÉVE@X.COM'.lower() == 'Éve@x.com' (cmb) and 'ß'.upper() == 'ß' (cmd), and DENYING the full Unicode answers: 'é'.upper() == 'É', 'Ä'.lower() == 'ä', 'ΑΣ'.lower() == 'ασ', 'ж'.upper() == 'Ж', 'ÉVE@X.COM'.lower() == 'éve@x.com' (cma), 'ß'.upper() == 'SS', 'İ'.lower().size() == 2, 'a'.upper() == 'A', and a create whose request.resource.data.email is ÉVE@X.COM against email.lower() == 'éve@x.com' (cmg). The simulator mapped every Unicode letter with JavaScript's case mapping, so 15 cases differed (#1896); rules/simulator/string-case.ts now maps the ASCII letters only, and unit:rules/oracle-conformance.test.ts replays all 17 verdicts with no pin (unit:sandbox/rules-ascii-case.test.ts through setDoc).Rules simulatormatches() compiles a class range over characters outside the Basic Multilingual Plane, such as [😀-😂], and matches it by code point (FS3-VAL-5)
oracle:rules-firestore-astral-range-matches (found by the 2026-11-03 rules engine defect hunt and captured on 2026-11-04 as c9b-astral-range-matches, 1 case) records production compiling '😀'.matches('[😀-😂]') and ALLOWING get ar2/1 (ar2). re2PatternProblem in rules/simulator/re2-pattern-check.ts accepts a pattern that compiles as code points when it does not compile as code units (#1901), so pyric loads the ruleset and agrees; unit:rules/oracle-conformance.test.ts replays the verdict with no pin, and unit:sandbox/rules-re2-script-classes.test.ts replays it through setDoc and uploadBytes.Rules simulatorA rules file with a service firebase.storage block before its service cloud.firestore block compiles, and the Firestore block decides; two cloud.firestore blocks are refused with "Duplicate service name declaration." (FS3-VAL-4)
oracle:rules-firestore-two-services-storage-first (found by the 2026-11-03 rules engine defect hunt and captured on 2026-11-04 as c5a-two-services-storage-first, 1 case) records production compiling the file and DENYING get c/1, which only the Firestore block's allow get: if false decides. The same capture's c5b-two-firestore-services records production refusing two cloud.firestore blocks with "Duplicate service name declaration.". The grammar took one service block, so pyric refused c5a at load (#1900); RulesFile now takes ServiceBlock+, the parser reads the cloud.firestore block as the ruleset's service, and checkRulesSource refuses a second block for one service with production's reason. unit:rules/oracle-conformance.test.ts replays the verdict with no pin, and unit:sandbox/rules-multiple-services.test.ts checks both captures through setRules and firestoreRules().Rules simulatorreplace() and split() read RE2's scoped and inline flags, (?U), \pL, [[:alpha:]], \Q..\E, an astral character as one code point, and \z and \A under (?m) as production does, and replace() fills $n and ${name} from RE2's capture groups (FS3-RE2-2, FS3-RE2-3, FS3-RE2-4, known #1332 flags)
oracle:rules-firestore-re2-replace-and-split-dialect (captured 2026-11-04 by the rules engine defect hunt as c1-re2-replace-split, 32 cases) records production's verdict on each, and the simulator agrees on all 32. The 4 split() cases agree since split() moved onto the linear matcher matches() uses and reads code points (#1895, #1890): 'Ab'.split('a(?i:b)') == ['Ab'] (sf4), '1a2'.split('\\pL') == ['1', '2'] (pl2), 'a😀b'.split('[^ab]') == ['a', 'b'] (as2), and 'a😀b'.split('').size() == 3 DENIED (as7). The 23 replace() cases agree since replaceRe2 in rules/simulator/rules-type.ts searches with the same matcher and reads capture groups from it: scoped and inline flags (sf0 to sf6, #1332), (?U) (ug0, ug1, #1891), \\p{L}, \\pL, [[:alpha:]] and \\Q..\\E (pl0, pl1, px0, qe0, qe1, #2211), an emoji as one code point (as0, as1, as3, #1890), \\z and \\A under (?m) (za0, za1, #1892), empty matches (em0 to em2: 'abc'.replace('b*', '-') == '-a--c-') and replacement templates (tp0 to tp2). The matches() and size() twins agree. unit:rules/oracle-conformance.test.ts replays every verdict with no pin; unit:rules/simulator/replace-linear-re2.test.ts replays each replace() case through a sandbox setDoc against this observation, and unit:rules/simulator/split-linear-re2.test.ts the split() cases.Storage rules engine — parseStorageRules / evaluateStorageRules (rules-storage corpus)
RulesparseStorageRules(source) returns an opaque handle
unit:storage/sandbox/rules.test.ts ("parses the canonical session-archive ruleset")RulesparseStorageRules rejects non-firebase.storage service headers
unit:storage/sandbox/rules.test.ts ("rejects unknown service header")RulesevaluateStorageRules supports granular verbs (get/list/create/update/delete) alongside read/write umbrella expansion, comma-separated verb lists, and per-verb default-deny
STALE ROW, corrected 2026-07-10: production capture proves the evaluator already supports the full six-verb grant surface (umbrella read→{get,list}, write→{create,update,delete}, single granular grants, comma-separated grants, per-verb deny-by-default), matching production verdict-for-verdict on 12 of the scenario's 13 non-existence cases.
oracle:rules-storage-verbs-umbrella-granular (all read/write/get/comma-verb cases). One related existence-semantics case in the same scenario diverges over-permissively and is carried by #118 Rules (the resource == null create-if-absent guard), not by this granular-verb row. (Structured evidence: rules-oracle-conformance.test.ts)RulesparseStorageRules rejects unterminated string literals with SyntaxError
unit:storage/sandbox/rules.test.ts ("rejects unterminated strings")RulesevaluateStorageRules matches match /sessions/{id} { allow read: if request.auth != null; } for an authed read
unit:storage/sandbox/rules-evaluator.test.ts ("allows authenticated reads of /sessions/{id}")RulesevaluateStorageRules denies anonymous reads when the rule requires request.auth != null
unit:storage/sandbox/rules-evaluator.test.ts ("denies anonymous reads")RulesevaluateStorageRules supports request.resource.size < N constraints (with arithmetic literals like 10 1024 1024)
unit:storage/sandbox/rules-evaluator.test.ts ("allows JSON writes under 10MB")RulesevaluateStorageRules supports request.resource.contentType == '<mime>' constraints
unit:storage/sandbox/rules-evaluator.test.ts (mime constraint inside the session-archive ruleset)RulesMulti-segment wildcard {allPaths=**} matches zero-or-more remaining segments
unit:storage/sandbox/rules-evaluator.test.ts (parser + evaluator both honor the ** form)RulesPath-parameter binding ({sessionId}) accessible inside the if expression
RulesUser-defined function definitions — let bindings, functions calling functions, and match-block-scoped helper functions (lexical scoping)
STALE ROW, corrected 2026-07-10: production capture proves the evaluator supports user-defined functions with
let bindings, nested function calls, and block-scoped helpers. oracle:rules-storage-functions-let-scope matches production verdict-for-verdict on all 5 cases. CORRECTED, 2026-09-27: a call to an undefined function is not a compile-time rejection. Production compiles the ruleset with the warning Invalid function name: notDeclared. and reports Function not found error: Name: [notDeclared]. at evaluation; the recapture adds 2 cases (7 in all) in which request.auth.uid == 'a' || notDeclared() inside a function allows uid a and denies uid b, and the evaluator matches both. A match-block function with the same name as a service-level function compiles with the warning Unused function: f. for the outer one and shadows it (oracle:rules-storage-function-scopes-and-shadowing pins the same resolution for a global function). Only a second definition of one name in the same scope is a compile-time rejection: Function f is already defined. Extended 2026-09-27: the Rules Test API compile-limit capture in packages/pyric/test/rules/linter/fixtures/compile-limits/captures.json records production's structural limits for Storage rulesets: 21 functions on one call stack compile and 22 are rejected, also when no rule calls the chain; 11 let bindings compile and 12 are rejected; and nesting past 99 levels is rejected with "Expression is too complex to evaluate safely.". The Storage evaluator enforces them when parseStorageRules loads a ruleset and has no runtime call depth cap, so a 21-function chain evaluates as production does. unit:storage/sandbox/compile-limits.test.ts pins that each rejected Storage probe is refused with production's messages and each compiling one, including the 21-function chain, evaluates to production's verdicts. parseStorageRules rejects a second definition of one function name in one scope through the same module with Function f is already defined., pinned by unit:storage/sandbox/rules.test.ts. A second 2026-09-27 recapture adds 7 cases (14 in all): an argument or let whose value errors (1 / request.resource.size of 0, or a method an int does not define) is bound and the function body runs, so a function that never reads it allows, also through two calls, and one that reads it denies; unit:storage/sandbox/rules-error-values.test.ts pins each verdict. The compile-limit capture adds the slash-divisor probe: (4/2) is rejected with "Missing 'match' keyword before path.", production reading a slash directly followed by a path segment as the start of a path, and (4/ 2) compiles. Extended 2026-10-07: the glob-in-path and glob-nested probes show Storage rejecting a second recursive wildcard in one match declaration path, counted across nested blocks, with "Invalid glob match expression. Only one glob match is permitted in a match declaration path.", as Firestore does; parseStorageRules refuses both rejected probes through the same module and evaluates both compiling ones to production's verdicts, pinned by unit:storage/sandbox/compile-limits.test.ts. (Structured evidence: rules-oracle-conformance.test.ts)Rulesrequest.time compared against timestamp.date(y,m,d) and timestamp.value(ms) constructors
NEW ROW, 2026-07-10: production capture proves the evaluator supports
request.time comparisons against both timestamp constructors. oracle:rules-storage-request-time-timestamp matches production verdict-for-verdict on all 4 cases (deadline-before/after via timestamp.date(), epoch-bound before/after via timestamp.value()). (Structured evidence: rules-oracle-conformance.test.ts)Rulesstring.matches(regex) with whole-string anchoring (a partial match denies)
NEW ROW, 2026-07-10: production capture proves
matches() is whole-string anchored, matching a RE2 pattern only when it covers the entire string. oracle:rules-storage-matches-regex matches production verdict-for-verdict on all 3 cases. RE2-inexpressible patterns are rejected at ruleset compile time by production and are covered by evaluator unit tests instead. (Structured evidence: rules-oracle-conformance.test.ts)Rulesresource.metadata.<key> custom-metadata access in dotted (resource.metadata.owner) and bracket (resource.metadata['owner']) form, including missing-key deny
NEW ROW, 2026-07-10: production capture proves dotted and bracket metadata access resolve identically, and a missing key denies.
oracle:rules-storage-metadata-access matches production verdict-for-verdict on all 5 cases. RECAPTURED, 2026-09-28: the scenario adds 6 production cases (11 in all) for a missing key under bracket access on resource.metadata and request.resource.metadata: != 'x', == null and !(... == 'x') deny and || true allows, as for a missing key under dot access. The evaluator already matched all 11. (Structured evidence: rules-oracle-conformance.test.ts)RulesCross-service firestore.get() / firestore.exists() lookups from a Storage ruleset, with $(expr) path interpolation and qualified function-mock names
NEW ROW, 2026-07-10: production capture proves the evaluator resolves cross-service Firestore lookups from Storage rules, including interpolated document paths and both the map-returning
get() and bool-returning exists() forms. oracle:rules-storage-firestore-lookup matches production verdict-for-verdict on all 4 cases. (Structured evidence: rules-oracle-conformance.test.ts)Rulesresource.name (full object path), resource.timeCreated, resource.updated, resource.bucket — the object-identity and time fields of the existing-object binding, plus duration.value(n, unit), and request.resource.name, the incoming object's full path in the same form
ROW CORRECTED, 2026-07-12: the fields are now modeled, sourced from the persisted object record.
oracle:rules-storage-resource-object-identity matches production verdict-for-verdict on all 9 cases — an extension guard (resource.name.matches), a freshness window (resource.timeCreated + duration.value(1, 'h')), an immutability check (resource.timeCreated == resource.updated), and an absent-property negation. Production semantics pinned by the capture: resource.name is the object's FULL path within the bucket (GCS object-name convention, sourced from the persisted record's fullPath, not the client SDK's last-segment name); timeCreated/updated are timestamps (production rejects an int with "Unsupported operation error. Received: int < timestamp"); the update-time field is updated — there is NO resource.timeUpdated. An absent property is an evaluation error that absorbs to DENY and SURVIVES negation, so resource.name != 'x' on an object with no name denies rather than false-allowing. The prior row recorded these fields as an unsupported gap; that gap is closed. RECAPTURED, 2026-09-28: the scenario adds 5 production cases (14 in all). request.resource.name on a create is the incoming object's full path, so split('/')[1] is the file segment of named/a.png; a delete carries no request.resource, so reading its name is "Property resource is undefined on object." and the != comparison still denies; resource.name.split('/')[1] on a get is the file segment; and a segment index past the end is "Index out of bound error. Index: [2] , size: [2].", which survives negation. The evaluator matches production on all 14 cases. (Structured evidence: rules-oracle-conformance.test.ts)Rulesrequest.resource.size arithmetic bounds (+/-///, >=/<=), request/existing content-type and custom metadata checks, request.method/request.path, a request.auth.token custom-claim branch, granular allow list, and a recursive {allPaths=*} public read tree
NEW ROW, 2026-07-12: production capture proves the evaluator matches the production Storage Rules Test API verdict-for-verdict on all 8 cases (owner-scoped size-bounded upload, immutable-content-type update, list grant, public recursive read).
oracle:rules-storage-metadata-verbs-and-arithmetic — replayed by packages/pyric/test/storage/rules-oracle-conformance.test.ts.Rulesresource on a create where no object exists: the create-if-absent guard allow create: if resource == null
GAP CLOSED, 2026-07-21: production raises a null-value error when
resource is referenced on a create where no object exists, including resource == null, so the expression denies. The evaluator now represents the missing binding as a Rules error rather than a usable null. oracle:rules-storage-verbs-umbrella-granular replays the captured DENY directly with no divergence pin; unit:storage/sandbox/rules-evaluator.test.ts covers the evaluator seam. (Structured evidence: rules-oracle-conformance.test.ts)RulesTernary ?: — branch selection, error-in-condition deny, and error || true absorption
NEW ROW, 2026-07-17: production capture proves the evaluator selects ternary branches by condition, denies when the CONDITION errors (even with identical
true branches — production errors the whole conditional rather than falling through to a branch), and still absorbs the same error through || true. oracle:rules-storage-ternary-and-error-absorption matches production verdict-for-verdict on all 5 cases. A division-by-zero in the condition previously yielded JS Infinity (no error) and false-ALLOWed the erroring-condition case; zero divisors now error-and-deny. (Structured evidence: rules-oracle-conformance.test.ts)Rulesin on list literals (membership) and on maps (OWN-key membership) — prototype names (toString/constructor/hasOwnProperty) are never keys
NEW ROW, 2026-07-17: production capture proves
in tests list membership and map OWN keys only — 'toString' in metadata is false unless the map literally carries that key, for both custom-metadata maps and map literals. oracle:rules-storage-in-membership-and-proto-keys matches production verdict-for-verdict on all 8 cases. Pre-fix the evaluator used JS in, which walks the prototype chain and false-ALLOWed the proto-key cases (the same bug class the Firestore simulator fixed under RULES-B7); the own-key check now guards it, pinned by unit:storage/sandbox/rules-values.test.ts JS-semantics guards. RECAPTURED, 2026-09-28: the scenario adds 9 production cases (17 in all) for in over a value that is not a collection. Each is an evaluation error that denies, so its negation denies too: !('a' in null) is "Null value error."; in over a string, an int, a float, a bool, request.time, request.path or a map diff is "Function not found error: Name: [in]."; and !(1 in metadata) is "Unsupported operation error. Received: map.in(int). Expected: map.in(string).". Storage reports the same verdict and text as Firestore for each. The evaluator returned false for an int key into a map, so its negation allowed, and reported its own text for the other shapes; it now shares the Firestore simulator's in implementation (rules/simulator/membership.ts) and matches production on all 17 cases. unit:rules/membership.test.ts runs every shape through both engines and pins the text. (Structured evidence: rules-oracle-conformance.test.ts)Rulesis type tests over the storage bindings (size is int, contentType is string, metadata is map, split() is list) and int/float LITERAL typing (1.0 is float, 1 is int, cross checks false)
ROW CORRECTED, 2026-07-17 (same day): the evaluator now adopts the simulator's RULES-B5 float model — a
RulesFloat wrapper tags float values (a numeric literal written with a decimal point converts to one) while a bare JS number means int — so 1.0 is float / !(1.0 is int) type by literal form exactly as production does. oracle:rules-storage-type-checks-is now matches production verdict-for-verdict on all 3 cases with no knownGap abstentions. The prior same-day row recorded the value-typed divergence; that gap is closed. (Structured evidence: rules-oracle-conformance.test.ts)RulesList/map literals, range-slice access [i:j] on lists and strings (out-of-range bounds ERROR, no JS clamp), and structural == on lists
NEW ROW, 2026-07-17: production capture proves slices evaluate on
split() lists and on strings, that an out-of-range slice END errors and denies (production does NOT clamp to length the way JS .slice() does — same semantics the Firestore capture pinned in rules-firestore-range-slice-list-and-string), and that a slice compares equal to a list literal structurally. oracle:rules-storage-list-map-literals-and-slice matches production verdict-for-verdict on all 6 cases. Pre-fix the evaluator clamped bounds JS-style and compared lists by reference identity; both fixed and pinned by unit:storage/sandbox/rules-values.test.ts JS-semantics guards. RECAPTURED, 2026-09-27: the scenario adds 13 production cases (19 in all) with the Firestore bounds shapes, and Storage reports the same verdict and text as Firestore for each. start must be an index and end - 1 must be an index ("Index out of bound error. Index: [i] , size: [n]."), so [0:0], [n:n], [1:0] and a slice of an empty list or string deny; start must not exceed end ("Illegal range error. From index: [3] , To index: [1]."); [i:i] for 0 < i < n is empty. The evaluator accepted [0:0], [n:n] and slices of empty values; it now shares the Firestore simulator's bounds check (rules/simulator/slice-bounds.ts) and matches production on all 19 cases. unit:rules/slice-bounds.test.ts runs every shape through both engines. RECAPTURED, 2026-09-28: 4 production cases (23 in all) index a split() list: an index in range reads the element, an index past either end is "Index out of bound error. Index: [5] , size: [4].", and a string key is "Unsupported operation error. Received: list[string]. Expected: list[int]." The evaluator read list['length'] as the list's length and allowed that case; list index access now goes through rules/simulator/index-access.ts, shared with the Firestore simulator, and matches production on all 23 cases (unit:rules/index-access.test.ts). RECAPTURED, 2026-09-28: 19 equality cases (42 in all) pin == over numbers inside List and Map literals, with the same verdicts as the Firestore capture: 1 == 1.0 and 0 == -0.0 allow, while [1] == [1.0], [[1]] == [[1.0]], {'a': 1} == {'a': 1.0}, [0.0] == [-0.0] and [NaN] == [NaN] deny and the != forms allow. The evaluator compared List and Map elements by numeric value, so each int-and-float shape and each 0.0 and -0.0 shape allowed; == now calls rulesValuesEqual in rules/simulator/value-equality.ts, shared with the Firestore simulator. It matches all 42 verdicts (unit:rules/simulator/collection-identity.test.ts). RECAPTURED, 2026-09-30: 12 production cases (90 in all) send the Firestore scenario's new shapes and get the same verdicts. Dot access on a path reads an unbound name with the bracket form's error (request.path.segments is "Property segments is undefined on object."), and an int index on a timestamp or a latlng is "Function not found error: Name: [[]]." Storage rules evaluate latlng.value(): production fails only at the index that follows it. The evaluator had no latlng namespace and denied every call as an unsupported method, which denied the latlng.value(1.0, 2.0)[0] == null || true case production allows; it now builds a LatLng (unit:storage/sandbox/rules-latlng.test.ts) and matches production on all 90 cases. (Structured evidence: rules-oracle-conformance.test.ts)RulesFloat literals, %, unary minus, float division, negative-dividend modulo (-7 % 2 == -1), TRUNCATING int division (10 / 4 == 2, -7 / 2 == -3), + concatenating two strings, and +, -, *, /, % on any other non-numeric operand pair (list + list, string + int, int + string, list + string, map + map) as an Unsupported operation error; <, >, <=, >= ordering ints and floats by value and two strings lexicographically, with every other operand pair (int and string, bool and bool, bool and int, timestamp and int, list and list, map and map, int and null) as an Unsupported operation error; and ==, != across types as false and true
ROW CORRECTED, 2026-07-17 (same day): with the RULES-B5 float model adopted from the simulator, int ÷ int truncates toward zero, float division stays float (re-tagged), and int-op-float promotes to float.
oracle:rules-storage-float-modulo-unary-minus now matches production verdict-for-verdict on all 6 cases with no knownGap abstentions. An int zero divisor errors-and-denies; a float zero divisor follows the simulator's CEL-pinned ±Infinity/NaN. The prior same-day row recorded the truncation divergence; that gap is closed. ROW EXTENDED, 2026-09-27: oracle:rules-storage-arithmetic-operand-types captures 20 production cases for operand types. + concatenates two strings, including a path built from request.auth.uid and path variables, and int + float promotes to float. Production has no list + list overload: [1] + [2] == [1, 2] denies with "Unsupported operation error. Received: list + list.", as do string + int (bound or literal), int + string, list + string, string + list, map + map, and -, *, /, % on strings. The error denies through != and ! and || true absorbs it. The evaluator previously returned an undefined value for a non-numeric pair, so a concatenated string compared with == denied and with != allowed; it now concatenates two strings and returns the error value for every other pair, matching production verdict-for-verdict on all 20 cases. ROW EXTENDED, 2026-09-27: oracle:rules-storage-ordering-operand-types captures 28 production cases for ordering and equality operand types. Ints and floats order by value and two strings order lexicographically. Every other ordering pair is "Unsupported operation error. Received: <left> <op> <right>. Expected: string < string, bytes < bytes, int < int, float < float, duration < duration, timestamp < timestamp, constraint < any, any < constraint.": int < string and string >= int (bound or literal), bool < bool, bool < int, timestamp > int, int <= timestamp, list < list, map < map, and int < null. The error denies on its own and through !, || true absorbs it, !(error && false) allows, and !(error && true) denies. == and != across types are not errors: int == string is false, and int != string, bool != int, timestamp != int, list != map, and null != int are true. The evaluator previously computed an ordering of mismatched operands as NaN and returned false, so !(1 < 'a') allowed; it now returns the error value, matching production verdict-for-verdict on all 28 cases. (Structured evidence: rules-oracle-conformance.test.ts)RulesFunction declarations at GLOBAL scope (above service) and SERVICE scope (inside service, outside any match), with inner-shadows-outer resolution; the global conversion functions int(), string(), and float(), which a same-named ruleset function shadows; no global bool() function; and a call to an undefined function or with the wrong argument count as an error value that && and || absorb; and the math namespace (abs, ceil, floor, round, sqrt, pow, isNaN, with no isInfinite) with production's result types and argument errors
NEW ROW, 2026-07-17: production capture proves production accepts functions declared at global and service scope and resolves a match-scope function over a same-named global (inner shadows outer).
oracle:rules-storage-function-scopes-and-shadowing matches production verdict-for-verdict on all 5 cases. The shared grammar previously rejected both placements at parse (PR #333 grammar fix); the storage evaluator attaches global- and service-scope functions to the root match block, which the capture proves is verdict-equivalent to production's scoping for this surface. ROW EXTENDED, 2026-09-27: oracle:rules-storage-conversion-functions captures 54 production cases for int(), string(), and float(). int(string) parses a whole signed int64 decimal string; whitespace, a fraction, hex, and out-of-range text are "Type conversion error". int(float) truncates toward zero, saturates at the int64 bounds, and maps NaN to 0. float(string) accepts decimal, exponent, and hex forms, surrounding whitespace, an f or d suffix, NaN, and Infinity, and rejects inf and nan. string() accepts int, float, null, string, bool, and path; a float prints with at least one fractional digit and in <digits>E<exponent> form outside 1e-3, 1e7). A bool or null argument to int() or float(), and a list, map, or bytes argument to string(), is "Unsupported operation error". Every conversion failure, a call to an undefined function ("Function not found error"), and a call with the wrong argument count ("Incorrect number of arguments") is an error value that denies through != and ! and that || true absorbs; !(foo(1) && false) allows. A ruleset function named int shadows the global. The evaluator previously resolved only ruleset functions and failed every other call closed, so any rule that converted a value denied; it now implements the three conversions and returns the error values, matching production verdict-for-verdict on all 54 cases. RECAPTURED, 2026-09-27: the scenario adds 8 production cases (62 in all). string() prints a float as Java Double.toString does: when the shortest decimal has one significant digit, the two-digit decimal closest to the value wins, so the smallest subnormal prints as 4.9E-324 (not 5.0E-324), 1e-323 as 9.9E-324, and 2e-323 as 2.0E-323. int('1e3') is a "Type conversion error", int(9223372036854775807) keeps the int64 maximum, and string() of a duration or latlng is "Unsupported operation error". The evaluator printed the shortest decimal (5.0E-324) before; it now matches production on all 62 cases, and the Firestore simulator shares its conversion functions. ROW EXTENDED, 2026-09-27: [oracle:rules-storage-bool-function captures 25 production cases for bool(). The rules.Boolean reference page shows bool("true") == true, but Storage rules have no global bool(): a call with a string ('true', 'false', 'TRUE', '1'), int (1, 0), bool, null, list, or metadata argument is "Function not found error: Name: [bool]." Each call denies through == and !, a bare bool('true') condition denies, || true absorbs the error, !(bool('true') && false) allows, and a ruleset function named bool is callable. The evaluator returns the Function not found error value for bool() and matches production verdict-for-verdict on all 25 cases. ROW EXTENDED, 2026-09-27: oracle:rules-storage-math-namespace captures 22 production cases for the math namespace, the same cases the Firestore scenario time-math-and-casts sends, with the same verdicts. math.abs() keeps its argument's type, math.ceil() and math.floor() return a float, math.round() rounds half up to an int, math.sqrt() and math.pow() return a float, and math.isNaN() accepts an int or a float. A wrong argument type ("Unsupported operation error"), a wrong argument count ("Incorrect number of arguments"), and math.isInfinite() ("Function not found error", although the rules reference lists it) are error values that deny through ! and that || true absorbs. The evaluator had no math namespace and denied every call as an unsupported method, which denied the 9 cases production allows; it now calls the math module the Firestore simulator uses and matches production on all 22. EXTENDED, 2026-09-27: production rejects a ruleset that defines one function name twice in one match block with "Function f is already defined." at compile time. The Storage parser accepted it and resolved the later definition; it now rejects it with that text through the shared compile-limit module, and a nested match block function that shadows an outer one still parses. unit:storage/sandbox/rules.test.ts pins both. A second 2026-09-27 recapture adds one math case (23 in all): math.abs() of the int64 minimum returns it unchanged, so it stays negative, as the shared math module now does. (Structured evidence: rules-oracle-conformance.test.ts, math-builtins.test.ts)Rules2+modules Storage rules resolve through service-aware contracts: the common auth and membership exports are admitted and retain their production auth, claim, map-membership, and role semantics; Firestore-only helpers are rejected before evaluation
NEW ROW, 2026-07-20; paired proof added 2026-07-21: one targeted production Rules Test API capture proves the exact six bundled function bodies (
isAuthenticated, isOwner, hasClaim, hasClaimRole, isMemberOf, hasRole) under firebase.storage, matching the local evaluator verdict-for-verdict on 12 allow/deny cases. oracle:rules-storage-common-auth-membership supplies the Storage answer key; Firestore Rules row #189 independently captures the same exact bodies under cloud.firestore (12 matching verdicts). A separately authored, explicitly reconstructed normalized-AST digest locks the captured Storage corpus bodies, and the source-lock test requires the Firestore corpus and shipped modules to remain AST-identical. Resolver tests separately prove 2+modules lowers these imports to plain v2 and fails closed with INCOMPATIBLE_FUNCTION for a Firestore-only export and for a transitive helper that reads resource.data; the Storage service integration test proves normal setup invokes that checked resolver. (Structured evidence: storage-stdlib-source-lock.test.ts, rules-oracle-conformance.test.ts, resolver.test.ts, enforce.test.ts)RulesStorage-native upload primitives at security boundaries: inclusive byte maximums, exact and whole-string MIME checks, metadata-only updates with unchanged bytes/owner, string path wildcards, generation/metageneration identity, and strict creation-time windows. A client upload is evaluated as create whether or not an object exists at the path, with resource bound to the stored object when one does; a metadata update is evaluated as update. A real upload or metadata update builds request.resource with the object's name (full object path) and bucket, its settable content fields (a client upload that sets no contentDisposition stores inline; filename*=utf-8''<file>, the file name percent-encoded per RFC 5987, and an admin-plane write stores none; an unset contentEncoding reads as identity on both writes and in a client metadata read; other unset fields and metadata are null), null generation/metageneration/etag on an upload, the stored generation/metageneration on a metadata update, and no timeCreated or updated
NEW ROW, 2026-07-20:
oracle:rules-storage-upload-primitives-boundaries captures 26 production cases in one Rules Test API request. The local evaluator matches every case scoped to this row: size 0/exact/+1, MIME exact/case/parameter and regex anchoring, metadata update invariants, filename wildcard typing, exact/absent generation identity, and request.time just before/at/after a strict 60-second boundary plus a future timeCreated fixture. Metadata collection methods and missing request.resource are separated into divergence rows #127/#128 rather than contaminating this credit. Extended 2026-09-27: the Rules Test API takes request.resource as input, so it cannot show which fields production builds. oracle:stdlib-realstorage-request-resource-fields deploys 182 probe rules to a real bucket and records production verdicts under real client uploads to new paths, metadata updates, and uploads over existing objects: presence, type, and value of every documented field, key membership, and key count. It also reads back the content fields of client uploads that set or leave unset contentDisposition and contentEncoding (including a file name that needs percent-encoding) and of an object written through the GCS JSON API, through both the GCS JSON API and the Firebase Storage endpoint, and records metadata updates over objects each API wrote. On an upload over an existing object production allows under allow create, denies under allow update, and binds resource to the stored object (resource.size is the stored size while request.resource.size is the new size). unit:storage/request-resource-real-replay.test.ts deploys the same rules to a sandbox, makes the same writes through the Storage SDK, and matches every verdict and read-back this row claims. It pins 25 divergences outside this row's claim: the sandbox does not carry md5Hash, crc32c, storageClass, or a metadata update's etag. unit:storage/enforce.test.ts, unit:storage/resumable-upload.test.ts, and unit:storage/sandbox/rules-resources.test.ts cover the upload, resumable upload, and metadata-update call sites and the binding; packages/cli/test/serve/worker/storage-chunked-commit.test.ts covers the chunked upload's check at begin and at commit. (Structured evidence: rules-oracle-conformance.test.ts)RulesStorage custom-metadata collection methods: Map.keys().hasAll() for required-key policy, Map.values() in written order, Map.get(key, default) for an absent key, and the List methods toSet(), join(), hasAny(), hasOnly(), concat(), and removeAll() on the keys() List and on List literals
GAP CLOSED, 2026-07-21: the Storage evaluator now implements own-key
Map.keys(), structural hasAll(), and string-key Map.get(key, default). oracle:rules-storage-upload-primitives-boundaries replays the production required-key and absent-key-default cases directly with no divergence pin; public-seam unit cases cover both admitted forms. RECAPTURED, 2026-09-28: the scenario adds 11 production cases (37 in all) that show Map.keys() returns a List: keys() is list allows, keys() is set is false (its negation allows), and toSet(), hasAll(), hasAny(), hasOnly(), size(), toSet().size(), [0] and join(',') evaluate on it. The evaluator had no join() and did not accept set as an is type name; it now implements both and matches production on all 37 cases. The 2+modules resolver typed keys() as a Set and took the hasAll() receiver contract from that typing, so a module function calling keys().size() was rejected; keys() is now a List, hasAll() accepts a List or Set receiver and size() a Set as well, and unit:rules/modules/service-compatibility.test.ts pins the admitted shapes. RECAPTURED, 2026-09-28: the scenario adds 52 List-method cases (89 in all), each method with value cases from keys() and from List literals, a != witness, and error cases written as a negated comparison that would allow if the call returned a value. toSet() takes no argument, and a Set or Map receiver is "Function not found error". join(separator) requires one string separator and converts each element as string() does, so ['a', 1, true, null].join('|') is 'a|1|true|null' and [2.0, -0.5].join(',') is '2.0,-0.5', while a List element is string()'s unsupported-operation error. concat(list) appends in order and keeps duplicates, and removeAll(list) drops every element equal to one in the argument, List, Map, and null elements included; a Set, string, or missing argument to either is an error, and a Set, Map, or string receiver is "Function not found error". On a List receiver, hasAll(), hasAny(), and hasOnly() take only a List argument: a Set argument is "Unsupported operation error. Received: list.hasAny(set). Expected: list.hasAny(list)."; a Set receiver takes a List or Set. The Storage evaluator had no concat() or removeAll(), required a List of strings for join(), and accepted a Set argument to a List receiver; it now matches production on all 89 cases and reports production's message for each error case, which unit:rules/simulator/list-methods.test.ts pins. concat(), removeAll(), and join() live in one module (rules/simulator/list-methods.ts) that the Firestore simulator also calls for concat() and removeAll(). The Storage language catalog gains the six List-method constructs on this row, so the 2+modules resolver admits them in a Storage module function. RECAPTURED, 2026-09-28: 63 production cases (152 in all), with the same verdicts and error text as the Firestore list-methods-concat-removeall-toset capture. List membership and removeAll() compare an element's numeric type: 1.0 in [1], [1].hasAny([1.0]), [1].hasAll([1.0]), [1].hasOnly([1.0]) and [[1]].hasAny([[1.0]]) deny, [1, 2].removeAll([1.0]) is [1, 2], -0.0 in [0.0] allows, and NaN is in no List. Further join() cases: two separators is "Incorrect number of arguments. Received: 2.", ['a', null].join(',') is not 'a,', [2.0].join(',') is not '2', floats print as string() prints them (1.0E8), a path element is its text, a Map, bytes or duration element is an error, and || true absorbs each error. removeAll(), join(), toSet(), hasAny(), hasAll() and hasOnly() on a string, and concat(), join() and hasAll() on a Map, are "Function not found error". keys() lists a Map literal's keys and custom metadata keys in ascending Unicode code point order ('1' < 'B' < 'a' < 'b', '10' before '9', 'z' before '😀'), which changes keys()[0] and keys().join(). The evaluator matched List elements by numeric value and returned keys in JavaScript property order; List membership and removeAll() now compare under listElementsEqual in rules/simulator/value-equality.ts and keys() comes from rules/simulator/map-keys.ts, both shared with the Firestore simulator, and it matches all 152 verdicts (unit:rules/simulator/list-methods.test.ts, unit:rules/simulator/collection-identity.test.ts). RECAPTURED, 2026-09-30: 33 production cases (185 in all). Production accepts Map.values() on a Map literal and on custom metadata: a literal's values come in the order written, integer-like keys included, a repeated key keeps its first position and its last value, values().join(',') and values()[0] follow that order, and custom metadata values come in the order the request sent them. keys() and values() take no argument, and keys(), values() or get() on a List or string is "Function not found error". A List receiver's hasAll(), hasAny() and hasOnly() take one List: a Map or null argument is an unsupported operation, no argument or two arguments "Incorrect number of arguments", and || true absorbs each error. The evaluator had no values(), so 13 cases disagreed; values() now comes from rules/simulator/map-keys.ts, shared with the Firestore simulator, and the List membership methods check their argument through listMembership in rules/simulator/list-methods.ts. The evaluator matches all 185 verdicts (unit:storage/rules-oracle-conformance.test.ts, unit:rules/simulator/list-methods.test.ts). (Structured evidence: map-keys-list.test.ts)Rulesrequest.resource on delete where no incoming object exists: request.resource == null
GAP CLOSED, 2026-07-21: production errors when
request.resource is absent on delete, including a direct null comparison. The evaluator now carries the absent incoming binding as a Rules error. oracle:rules-storage-upload-primitives-boundaries replays the captured DENY directly with no divergence pin; unit:storage/sandbox/rules-evaluator.test.ts covers the evaluator seam. (Structured evidence: rules-oracle-conformance.test.ts)RulesMocked Storage-to-Firestore lookup evaluation: get/exists return and missing-field errors, repeated and same-resolved-path calls, get+exists composition, and lazy ||/&&/ternary branches with hosted function-call diagnostics
DOCUMENTED MOCK-ORACLE DIVERGENCE, 2026-07-21:
oracle:rules-storage-firestore-lookup-budget matches the local evaluator on 13 of 14 cases and hosted diagnostics prove lazy branches omit lookup calls. The one mismatch is intentional and pinned on both sides: the Rules Test API ALLOWs three distinct mocked exists calls, while the evaluator DENYs the third distinct path to match the separately captured real-resource production contract in row #131. This row remains diverged because its mocked observation is not verdict-identical; it supplies no budget credit. (Structured evidence: rules-oracle-conformance.test.ts)RulesAnonymous request.auth != null used as a ternary condition before a cross-service lookup
GAP CLOSED, 2026-07-21: anonymous
request.auth is now represented as an absent-property Rules error, so a ternary condition denies before selecting either lookup branch, matching hosted diagnostics. oracle:rules-storage-firestore-lookup-budget replays the captured DENY directly with no divergence pin; unit:storage/sandbox/rules-methods.test.ts covers the lookup evaluator seam. (Structured evidence: rules-oracle-conformance.test.ts)RulesReal-resource Storage-to-Firestore contract: at most two distinct document paths per evaluation with repeated-path caching; typed document data and missing-document errors; default-database-only and owning-project isolation; lazy/helper/let composition; and independence from Firestore client rules
NEW ROW, 2026-07-21: four deploy-observe-restore captures establish the real-resource contract beyond Rules Test API mocks:
oracle:stdlib-realstorage-p3-lookup-budget-iam-enabled, oracle:stdlib-realstorage-p3-advanced-iam-enabled, oracle:stdlib-realstorage-p3-named-database, and oracle:stdlib-realstorage-p3-project-isolation. unit:conformance/storage-stdlib-real-replay.test.ts executes the locally decidable lookup matrices and locks reviewed reconstructions of their normalized probe code; the lock records state whether the digest covers an injected block or a canonical synthetic wrapper. The surrounding deployed base rules were not retained, so no full-source digest is claimed for these historical captures. Future rigs emit both probe-block and full deployed-rules-file digests. unit:storage/enforce.test.ts proves the normal enforcement seam reads only its owning sandbox and bypasses Firestore client rules. The separate consistency capture remains bounded characterization and is not promoted into a latency guarantee.RulesThe service-scoped storage/uploads, storage/metadata, storage/objects, and storage/time modules resolve through 2+modules and preserve their production upload-bound, MIME, metadata, operation-identity, and strict timestamp-window semantics
NEW ROW, 2026-07-21: one bounded Rules Test API batch captures 15 verdicts for the exact 13 deployable function bodies in the four shipped modules (
oracle:rules-storage-stdlib-storage-modules). A separately authored, explicitly reconstructed normalized-AST digest locks the captured corpus bodies, and the source-lock test requires the shipped functions of the same names to remain AST-identical. The generic Storage stdlib fixture runner and oracle replay execute those bodies locally; resolver tests prove the modules are admitted only for firebase.storage, lower to plain v2, and fail closed under Firestore. The module surface excludes the advanced integrity and metadata-diff candidates. UPDATED, 2026-09-28: Storage module functions may call firestore.get() and firestore.exists() within production's limit of two distinct Firestore documents per request. storage/objects adds nameSegment(index) and matchesDocument(path, field); matchesDocument passes a path argument to firestore.get() and reads one document per call. oracle:rules-storage-resource-object-identity (row #116) captures the request.resource.name and split('/') index shapes they rely on, and the module replay test/rules/modules/fixtures/stdlib-replay-storage-objects.json records production agreeing with all 26 storage/objects cases, checked by unit:conformance/firestore-stdlib-replay.test.ts; unit:conformance/storage-stdlib-source-lock.test.ts requires that replay for every shipped function outside the captured batch. (Structured evidence: rules-oracle-conformance.test.ts, stdlib-cases.test.ts, stdlib.test.ts)RulesCEL commutative error absorption in && and ||: a determining operand (false for &&, true for ||) absorbs the other operand's error; error && true and true && error both propagate to deny
NEW ROW, 2026-09-01:
oracle:rules-storage-error-absorption-and-direction captures the previously unpinned && direction of corpus scenario "error-absorption-and-direction" via consumed discriminators (!(error && false) and (error && false) == false both ALLOW; both propagation orders DENY; the || direction is consumed as a control). The local evaluator replays all six verdicts with no divergence pin after the tri-state operand change in storage/sandbox/rules-evaluator.ts, which mirrors the captured Firestore semantics (RULES-B3). The 2026-09-27 recapture adds allow rules after an error (1 / 0 == 0): a later true rule in the same block or a second matching block allows, a later false rule denies, and an error then a true rule past the 1000-expression limit denies with the earlier error as production's note; unit:storage/sandbox/rules-expression-budget.test.ts pins the count and the reported error. A second 2026-09-27 recapture adds 8 cases (18 in all): an int division or modulo by request.resource.size of 0 is "Divide by zero error."; with two erroring operands production reports the left one of ==, the first list element and method argument, the receiver before an argument, and the collection of in before its element; and an operand past the limit after an error in the same expression denies with the limit message. unit:storage/sandbox/rules-error-values.test.ts pins the errors production named. (Structured evidence: rules-oracle-conformance.test.ts)RulesStorage to Firestore IAM boundary: without roles/firebaserules.firestoreServiceAgent on the Storage service agent, every EXECUTED firestore.get()/exists() lookup fails and the rule DENIES, while a short-circuited lookup is never executed and its rule still ALLOWS. Modeled by the crossServiceIam: 'granted' | 'denied' storage sandbox option (default granted)
PROMOTED, 2026-08-31: the real-resource IAM-DISABLED deploy-observe-restore baseline
oracle:stdlib-realstorage-p3-lookup-budget (previously an excused negative capture, and the sibling of row #131's IAM-enabled twin: same probe matrix, role removed) pins one/two/three/repeat/get-exists/missing-* = DENY and short = ALLOW. unit:conformance/storage-stdlib-real-replay.test.ts replays all 8 captured verdicts against the local evaluator injected with the EXACT production denied-mode lookup (crossServiceIamDeniedLookup from storage/enforce.ts); unit:pyric/test/e2e-soundness/cross-service-iam.test.ts proves the crossServiceIam option reaches that lookup through the full sandbox enforcement path, that granted and default behavior is unchanged, and that a late differing mode throws. Scope: the capture pins only the executed-lookup/short-circuit boundary. How an IAM failure composes with CEL &&/|| error absorption was not exercised IAM-disabled and remains unpinned; the denied-mode error uses the evaluator's absorbable error class, the existing no-capability precedent.RulesCEL types the top-level allow condition as bool: a non-boolean result is an evaluation error that denies the rule and lets the walk continue to the next rule, rather than a JavaScript truthiness coercion
BORN UNVERIFIED, 2026-09-08: the local evaluator follows CEL's boolean typing of the allow boundary and the pinned Firestore capture
oracle:rules-firestore-strict-boolean-control-flow, which records production denying three direct non-boolean conditions under cloud.firestore (registry row #188). No Storage capture pins the same position under firebase.storage yet. Corpus scenario strict-boolean-allow-and-ternary is the capture that would verify this row; unit:storage/sandbox/rules-evaluator.test.ts pins the local behavior in the meantime. VERIFIED, 2026-10-27: oracle:rules-storage-strict-boolean-allow-and-ternary captures the scenario under firebase.storage (5 cases), and the evaluator agrees on all 5; unit:storage/rules-oracle-conformance.test.ts replays them with no pin.RulesCEL types a ternary CONDITION as bool: a non-boolean condition produces an evaluation error that propagates like any other rules error, so || true and a negated && false both absorb it
BORN UNVERIFIED, 2026-09-08: the local evaluator follows CEL's boolean typing of the ternary condition and the pinned Firestore capture
oracle:rules-firestore-strict-boolean-control-flow, whose three tautological error discriminators still DENY under cloud.firestore (registry row #188). No Storage capture pins the same position under firebase.storage yet. Corpus scenario strict-boolean-allow-and-ternary consumes the error through || true and !(… && false) and is the capture that would verify this row; unit:storage/sandbox/rules-evaluator.test.ts pins the local behavior in the meantime. VERIFIED, 2026-10-27: oracle:rules-storage-strict-boolean-allow-and-ternary captures the scenario under firebase.storage (5 cases), and the evaluator agrees on all 5; unit:storage/rules-oracle-conformance.test.ts replays them with no pin.Rulesrequest.time, resource.timeCreated, and resource.updated are timestamps; timestamp.date/timestamp.value build timestamps and duration.value/duration.time/duration.abs build durations. The timestamp accessors year(), month(), day(), hours(), minutes(), seconds(), nanos(), dayOfWeek(), dayOfYear(), date(), time(), and toMillis() read UTC components, where seconds() is the seconds of the minute and toMillis() is the only epoch value. Timestamp minus timestamp is a duration, timestamp plus or minus duration is a timestamp, values of one type compare with == and <, and is timestamp and is duration hold. An int has no timestamp methods, an error that || true absorbs, and comparing a timestamp with an int is an error
CONFORMS, 2026-09-24:
oracle:rules-storage-stdlib-timestamp-duration captures 15 production verdicts for corpus scenario "stdlib-timestamp-duration", including the paired seconds-of-minute and epoch-seconds cases and the production diagnostics Function not found error: Name: [hours]. and Unsupported operation error. Received: timestamp < int. request.time, the resource time fields, and the timestamp. and duration. constructors are the shared Timestamp and Duration values, which answer their own accessors and operators. unit:storage/rules-oracle-conformance.test.ts replays all 15 verdicts; unit:storage/sandbox/rules-time-methods.test.ts, unit:storage/sandbox/rules-operators.test.ts, and unit:storage/sandbox/rules-bindings.test.ts pin the values and error messages.RulesString literal escapes, including \x and octal escapes as code points and \u as one UTF-16 code unit, with \/ a parse error; and String lower(), upper(), trim(), replace(pattern, replacement), and toUtf8(). replace compiles the pattern as a regular expression, replaces every match, expands $1 group references and reads \$ as a dollar sign in the replacement, and is an error on an invalid pattern; toUtf8() returns Bytes. An int has no string methods, which is an error
CONFORMS, 2026-09-24:
oracle:rules-storage-stdlib-string-bytes-hashing captures 19 production verdicts for corpus scenario "stdlib-string-bytes-hashing"; its case and replace cases pin regular-expression replace-all, Java Matcher replacement templates, and Invalid regular expression pattern on (. A $& replacement makes the Rules Test API answer HTTP 500 for the whole request, so production's verdict for an invalid group reference is not captured; the evaluator denies it as an error. unit:storage/rules-oracle-conformance.test.ts replays all 19 verdicts and unit:storage/sandbox/rules-string-methods.test.ts pins the methods, the replacement templates, and the receiver and argument errors. ROW EXTENDED, 2026-09-27: the same capture adds 18 production verdicts for string literal escapes in Storage rules, 37 in all, the same cases and verdicts as the string escape cases of the Firestore capture rules-firestore-string-literals-and-regex. A backslash escapes a backslash, either quote, n, r, t, b, or f. \x takes exactly two hexadecimal digits and \ takes three octal digits up to 377; each is the code point of that value, not a byte. \u takes exactly four hexadecimal digits and is one UTF-16 code unit, and size() counts code units. Production rejects the Storage ruleset for the same malformed escapes as the Firestore one, including \/, \a, \v, \0, \x4, \U escapes, and a raw line break inside the quotes, and the shared grammar rejects them. The grammar previously rejected \x, \u, octal, \b, and \f escapes and accepted \/. unit:storage/rules-oracle-conformance.test.ts replays all 37 verdicts and unit:storage/sandbox/rules-string-escapes.test.ts pins the string escape cases. (Structured evidence: string-escape-strict.test.ts)RulesBytes from a bytes literal b'...', from toUtf8(), and from hashing.md5, hashing.sha256, hashing.crc32, and hashing.crc32c over a string or Bytes: size() counts bytes, toBase64() is padded base64url, toHexString() is uppercase hexadecimal, Bytes compare by value, a string hashes like its UTF-8 bytes, and CRC digests serialize least-significant byte first. Hashing an int is an error
CONFORMS, 2026-09-24:
oracle:rules-storage-stdlib-string-bytes-hashing pins the md5, sha256, crc32, and crc32c digests of abc as hexadecimal, the base64url and hexadecimal encodings of hi, Bytes equality, and the production diagnostic Unsupported operation error. Received: hashing.md5(int). These are the representations the Firestore capture rules-firestore-bytes-toutf8-and-hashing pins for cloud.firestore (row #161), and the Storage evaluator computes them with the same shared Bytes wrapper and built-in hashing functions, whose MD5 and SHA-256 unit:rules/simulator/hashing-builtins.test.ts checks against the RFC 1321 and FIPS 180-4 vectors and node:crypto. unit:storage/rules-oracle-conformance.test.ts replays the verdicts and unit:storage/sandbox/rules-hashing-methods.test.ts pins the digests, encodings, and errors. ROW EXTENDED, 2026-09-27: oracle:rules-storage-bytes-literal captures 22 production verdicts for the bytes literal in Storage rules, the same cases and verdicts as the bytes literal cases of the Firestore capture rules-firestore-bytes-toutf8-and-hashing. The prefix is b or B directly before a single- or double-quoted body. A plain character contributes its UTF-8 encoding. A backslash escapes a backslash, either quote, n, r, t, b, or f; x with exactly two hexadecimal digits of either case, or three octal digits up to 377, is one byte. A bytes literal equals only bytes, orders lexicographically, is in a list by value, and hashes like the string it encodes; + on two bytes values and [] on bytes are error values that || true absorbs. Production rejects the Storage ruleset for the same malformed forms as the Firestore one, including a u escape ("Invalid bytes literal"), and the shared grammar rejects them. The grammar previously had no bytes literal, so a Storage ruleset that used one failed to parse. The Storage evaluator now converts the literal to the Bytes value toUtf8() produces; unit:storage/rules-oracle-conformance.test.ts replays all 22 verdicts and unit:storage/sandbox/rules-bytes-literal.test.ts pins them. (Structured evidence: bytes-literal.test.ts)RulesList.toSet() removes duplicates and Sets compare by value regardless of order. Set size(), hasAll, hasAny, and hasOnly take a List or Set argument, and List hasAll, hasAny, and hasOnly take a List argument, where a Set argument is an error. Set difference, union, and intersection take a Set argument, where a List argument is an error, and a List receiver has none of them, which is an error. in tests Set membership
CONFORMS, 2026-09-24:
oracle:rules-storage-stdlib-sets-and-mapdiff captures 13 production verdicts for corpus scenario "stdlib-sets-and-mapdiff", including the diagnostics Unsupported operation error. Received: set.difference(list). and Function not found error: Name: [difference]. for a List receiver. Sets are the shared Set value. unit:storage/rules-oracle-conformance.test.ts replays all 13 verdicts and unit:storage/sandbox/rules-collection-methods.test.ts pins membership, algebra, equality, in, and the receiver and argument errors. RECAPTURED, 2026-09-28: 27 Set cases, with the same verdicts as the Firestore set-algebra-difference-union-intersection capture, show a Set compares elements by numeric value at every depth: [1].toSet() == [1.0].toSet(), [1, 1.0].toSet().size() == 1, 1 in [1.0].toSet(), [1].toSet().hasAll([1.0]), [[1]].toSet() == [[1.0]].toSet() and [1] in [[1.0]].toSet() allow, difference(), intersection() and union() treat an int and the equal float as one element, 0.0 and -0.0 are one element, and two NaN are one element that is in its own Set. The evaluator kept two NaN as two elements; Sets now compare under setElementsEqual in rules/simulator/value-equality.ts, shared with the Firestore simulator, and the scenario's 46 verdicts all match (unit:rules/simulator/collection-identity.test.ts). RECAPTURED, 2026-09-30: 35 set method cases (81 in all) pin the same Set and MapDiff method surface as the Firestore capture: a Set has no keys(), values(), get() or diff(), a MapDiff no keys(), values(), get() or size(), size() takes no argument, the membership methods take one List or Set, the algebra methods one Set, and Set algebra on a List, string or Map is "Function not found error". The evaluator reported non-production text for an argument to a Set's size(), for values() on a Set or MapDiff, and for an algebra argument count; Set methods now dispatch through setMethod in rules/simulator/firestore-set.ts, shared with the Firestore simulator, and the evaluator matches all 81 verdicts (unit:storage/rules-oracle-conformance.test.ts, unit:rules/simulator/collection-identity.test.ts).RulesMap.diff(other) over custom metadata returns a MapDiff whose addedKeys(), removedKeys(), changedKeys(), unchangedKeys(), and affectedKeys() are Sets of own keys, including keys named constructor and toString, so an affectedKeys().hasOnly([...]) guard allows a change to the listed keys and denies any other
CONFORMS, 2026-09-24:
oracle:rules-storage-stdlib-sets-and-mapdiff pins all five accessors on one metadata update, the label-only guard ALLOW and owner-change DENY, in over changedKeys(), and a diff that adds constructor and removes toString. The discovery capture stdlib-storage-p2-native-advanced recorded the same affected/added/removed guard verdicts earlier. The shared MapDiff reads own keys only. unit:storage/rules-oracle-conformance.test.ts replays the verdicts and unit:storage/sandbox/rules-collection-methods.test.ts pins the accessors and own-key diffs. RECAPTURED, 2026-09-28: 6 diff() cases show a diff compares values by numeric value at every depth, as Firestore's does: an int and the equal float, an int List and the equal float List, 0.0 and -0.0, and two NaN are unchanged, and an int beside a different float is changed. The shared MapDiff reported two NaN as changed; it now compares under setElementsEqual in rules/simulator/value-equality.ts and matches all six (unit:rules/simulator/collection-identity.test.ts).Rulesmatches() uses RE2: \s is [\t\n\f\r ], . matches \r, \pL, [[:alpha:]] and \Q..\E are a class, a POSIX class and literal quoting, and (?i)k matches the Kelvin sign U+212A (ST-H1-3, sharing FS2-SIM-5a, FS2-SIM-5a2, FS2-SIM-5b, FS2-SIM-5c and FS2-SIM-5d)
oracle:rules-storage-h1-regex-re2-classes (captured 2026-10-27, 16 cases) records production verdicts for POSIX classes, \pL, \s and \S over NBSP, U+2003 and vertical tab, . against \r, \Q..\E and (?i) over the Kelvin sign. The Storage evaluator agrees on all 16 cases. (Structured evidence: rules-oracle-conformance.test.ts, rules-string-methods.test.ts)Rulesresource binds md5Hash, crc32c, etag, contentDisposition, contentEncoding, contentLanguage and cacheControl from the stored object (ST-H1-1)
oracle:rules-storage-h1-resource-unmodeled-fields (captured 2026-10-27, 9 cases) records production ALLOWING a rule that reads each of the seven fields' stored values. The evaluator binds all seven fields on resource and request.resource and agrees on all 9 cases. (Structured evidence: rules-oracle-conformance.test.ts)RulesWithout rules_version = '2', a recursive wildcard needs at least one segment (ST-H1-2)
oracle:rules-storage-h1-v1-recursive-wildcard (captured 2026-10-27, 4 cases) records production DENYING v1 glob: zero segments for the glob deny and ALLOWING the other 3. The evaluator agrees on all 4: under rules_version = '1', the default, a recursive wildcard needs one or more segments (recursiveWildcardMinimum in rules-path-match.ts, #1330). unit:storage/rules-oracle-conformance.test.ts replays them with no pin, and unit:storage/sandbox/rules-v1-recursive-wildcard.test.ts covers versions 1 and 2.RulesIntegers are 64-bit: distinct values above 2^53 compare unequal, int() and string() keep every bit, and overflow is an evaluation error (ST-H1-4, sharing FS2-SIM-2 and FS2-SIM-3)
oracle:rules-storage-h1-int64-precision (captured 2026-10-27, 9 cases) records production DENYING 9007199254740993 == 9007199254740992 and 9223372036854775807 + 1 > 0, and ALLOWING 9223372036854775807 > 9223372036854775806, 9007199254740993 - 1 == 9007199254740992 and string(9007199254740993) == '9007199254740993'. The evaluator agrees on all 9: Storage's integer operators call the shared int64 arithmetic in rules/simulator/rules-int.ts (#1335), so literals, int() and string() keep every bit and overflow is production's Integer value is out of the range error value. unit:storage/rules-oracle-conformance.test.ts replays them with no pin, and unit:storage/sandbox/rules-int64.test.ts covers each operator's overflow and the Invalid number literal compile refusal.Rulesin and is chain and compare at parse: size is int == true, (a in list) is bool, (a in list) in [true] and (1 is int) is bool compile (ST-H1-5)
oracle:rules-storage-h1-in-is-precedence-deploy (captured 2026-10-27, 4 cases) records production compiling all four expressions and giving ALLOW, DENY, ALLOW and ALLOW. The shared grammar and evaluator agree on all 4 cases. (Structured evidence: rules-oracle-conformance.test.ts)Rulesin binds looser than == and !=: 'a' in ['a','b'] == true reads as 'a' in (['a','b'] == true) and denies, while the parenthesized form allows
oracle:rules-storage-h1-in-is-precedence (captured 2026-10-27, 6 cases) records production DENYING the four unparenthesized in comparisons and ALLOWING the parenthesized control and a nested ternary. The evaluator agrees on all 6, refuting the evaluation half of ST-H1-5; the documented precedence table is wrong for in. unit:storage/rules-oracle-conformance.test.ts replays them with no pin.RulesA signed-in request always carries a request.auth.token map, even when the case names only a uid (ST-H1-7)
oracle:rules-storage-h1-auth-token-default (captured 2026-10-27, 4 cases) records production ALLOWING token is a map, token is empty and token.get default when the case gives no token. buildRequestObject defaults request.auth.token to {} when request.auth is present without an explicit token, agreeing on all 4 cases. (Structured evidence: rules-oracle-conformance.test.ts)RulesAn unknown method is an evaluation error value, so 'a'.foo() || true and !('a'.foo() == 1 && false) allow (ST-H1-8)
oracle:rules-storage-h1-unknown-method-absorption (captured 2026-10-27, 4 cases) records production ALLOWING all four absorbed unknown-method cases. The evaluator agrees on all 4: a method no receiver type defines is production's "Function not found error: Name: [foo].", an error value || and && absorb (evalMethodCall in rules-methods.ts, #1343). unit:storage/rules-oracle-conformance.test.ts replays them with no pin, and unit:storage/sandbox/rules-evaluator-semantics.test.ts covers the four cases and the unabsorbed denial.RulesA / inside an interpolated $(v) in a firestore.get() or firestore.exists() path stays inside one segment, so a request value cannot select a deeper document (ST-H1-10)
oracle:rules-storage-h1-lookup-interpolated-slash (captured 2026-10-27, 3 cases) records production DENYING get and exists when the interpolated value holds slashes, and ALLOWING the literal-path control. The evaluator agrees on all 3: an interpolated string is one segment, and a segment holding / names no document, so the call errors (buildFirestoreDocPath in rules-firestore-lookup.ts, #1330). unit:storage/rules-oracle-conformance.test.ts replays them with no pin, and unit:storage/sandbox/rules-firestore-lookup-paths.test.ts covers get and exists. The capture ran under the Rules Test API, where an unmocked call also errors, so it cannot show whether a real database answers exists on a slashed id with false; that the call errors, so !exists(...) also denies, is inferred and not captured.RulesStrings order by UTF-16 code unit, so a character above the BMP sorts before U+FFFF and U+FF5A
oracle:rules-storage-h1-string-ordering (captured 2026-10-27, 5 cases) records production DENYING the three code-point-order comparisons and ALLOWING the ASCII and map-keys controls. The evaluator agrees on all 5, refuting ST-H1-9. unit:storage/rules-oracle-conformance.test.ts replays them with no pin.Rulesservice cloud.storage, the spelling in the documented v2 snippet, is accepted beside service firebase.storage (ST-H1-14)
oracle:rules-storage-h1-deploy-cloud-storage-service (captured 2026-10-27, 1 case) records production compiling a service cloud.storage ruleset and ALLOWING its read. parseStorageRules accepts service cloud.storage alongside service firebase.storage and agrees. (Structured evidence: rules-oracle-conformance.test.ts)Rules$(rest) from a {rest=**} capture interpolates its segments into a firestore.exists() path (ST-H2-9)
oracle:rules-storage-storage-lookup-path-interpolation (captured 2026-10-27, 4 cases) records production ALLOWING a single-segment and a three-segment path capture interpolated into the lookup path, and DENYING the two string() forms. The evaluator agrees on all 4: a path value splices in as its segments, while string(rest) is one segment holding / and errors (buildFirestoreDocPath in rules-firestore-lookup.ts, #1330). unit:storage/rules-oracle-conformance.test.ts replays them with no pin, and unit:storage/sandbox/rules-firestore-lookup-paths.test.ts covers captures and path().RulesThe bucket wildcard, request.resource.bucket and resource.bucket carry the real bucket name, so a ruleset that names its bucket is honored
oracle:rules-storage-storage-named-bucket-binding (captured 2026-10-27, 4 cases) records production binding the real bucket name in all three places. The evaluator, given the case's bucket, agrees on all 4; unit:storage/rules-oracle-conformance.test.ts replays them with no pin. The live planes bind the same name: the in-page plane from the app's storageBucket or getStorage's bucket URL, the SharedWorker and Node host from the name the caller knows the bucket by, and simulate, the storage methods and pyric verify from the served app's storageBucket or the name the live op recorded (unit:storage/sandbox/rules-bucket-name.test.ts, test/apps/storage-rules-bucket-name).RulesOne service firebase.storage may hold more than one top-level match block, one per bucket (ST-H2-8)
oracle:rules-storage-storage-two-top-level-bucket-matches (captured 2026-10-27, 2 cases) records production compiling two top-level match blocks, ALLOWING get in the named bucket's block and DENYING the other bucket under the wildcard block. ServiceBlock accepts multiple top-level match blocks and agrees on both cases. (Structured evidence: rules-oracle-conformance.test.ts)RulesA root match that names its bucket literally grants only that bucket; a request in another bucket, including a bucket name that extends it, matches no rule and denies
oracle:rules-storage-xref-root-literal-bucket (captured 2026-10-27, 5 cases) records production ALLOWING get and create in the named bucket and DENYING them in another bucket and in demo-pyric.appspot.com2. The evaluator agrees on all 5, so the Firestore root-path fail-open (FS2-ENF-1) does not reach Storage. unit:storage/rules-oracle-conformance.test.ts replays them with no pin.RulesThe language semantics the Firestore hunt found hold under firebase.storage too: split() drops capture-group text and trailing empty pieces, trim() keeps NBSP, ints are 64-bit with overflow errors and MIN / -1 == MIN, a timestamp past its range is an error, and unary minus negates a duration (ST-H1-13, sharing FS2-SIM-1, FS2-SIM-2, FS2-SIM-3, FS2-SIM-4, FS2-SIM-7, FS2-SIM-8 and FS2-SIM-9)
oracle:rules-storage-xref-shared-language-semantics (captured 2026-10-27, 12 cases) records production giving the Firestore-reported answer on all 12. The evaluator agrees on all 12: int-above-2-53-distinct (FS2-SIM-2), int-add-overflow-errors and int-min-div-minus-one (FS2-SIM-3), since Storage's integer operators call the shared int64 arithmetic in rules/simulator/rules-int.ts (#1335, covered by unit:storage/sandbox/rules-int64.test.ts), duration-unary-minus (FS2-SIM-1, #1343, also covered by unit:storage/sandbox/rules-evaluator-semantics.test.ts), timestamp-plus-duration-past-range-errors under FS2-SIM-9, since the shared Timestamp wrapper errors past its range (#1336, replayed by unit:rules/simulator/time-range.test.ts), (?i) in split() and replace(), duration.value() past its range, and trim-keeps-nbsp under FS2-SIM-8: Storage's trim() now calls the shared trimRulesString (#1295), replayed by unit:storage/sandbox/rules-string-methods.test.ts. Storage's split() and replace() now call the shared splitRe2 and replaceRe2 (#1333), so split-drops-capture-text (FS2-SIM-4) and split-drops-trailing-empty (FS2-SIM-7) agree, and a pattern from request data gets pyric's size limit and the 1000-repeat cap; unit:rules/simulator/split-and-replace.test.ts checks both engines. unit:storage/rules-oracle-conformance.test.ts replays all 12 with no pin.Ruleslower() and upper() map the ASCII letters only and leave every other letter as it is (ST3-D-1)
oracle:rules-storage-st3-case-mapping-ascii (captured 2026-11-04 by the Storage rules engine defect hunt, 12 cases) records production ALLOWING 'é'.upper() == 'é', 'Ä'.lower() == 'Ä', 'ΑΣ'.lower() == 'ΑΣ', 'ж'.upper() == 'ж', 'İ'.lower() == 'İ', 'ı'.upper() == 'ı' and 'aé'.upper() == 'Aé', and DENYING 'é'.upper() == 'É', 'Ä'.lower() == 'ä', 'ж'.upper() == 'Ж', 'a'.upper() == 'A' and 'ÉVE@X.COM'.lower() == 'éve@x.com'. oracle:rules-storage-st3-case-mapping (same hunt, 13 cases) records production ALLOWING 'aB'.upper() == 'AB', 'ß'.upper() == 'ß', 'ß'.upper().size() == 1, 'fi'.upper() == 'fi', 'İ'.lower().size() == 1 and 'և'.upper().size() == 1, and DENYING 'ΑΣ'.lower() == 'ασ', 'İ'.lower() == 'i', 'ı'.upper() == 'I', 'ſ'.upper() == 'S', 'Dž'.upper() == 'DŽ' and 'ß'.upper() == 'ẞ'. Storage's lower() and upper() call the shared lowerRulesString and upperRulesString in rules/simulator/string-case.ts (#1885), so the evaluator agrees on all 24 case-mapping verdicts; before, it mapped every Unicode letter and 20 differed. The capture's last case, a one-key {path} map from a firestore.get() function mock, is ST3-D-3 and stays pinned in packages/conformance/storage-rules-exceptions/. unit:storage/rules-oracle-conformance.test.ts replays all 25 verdicts and unit:storage/sandbox/rules-ascii-case.test.ts runs the case-mapping cases through uploadBytes. (Structured evidence: rules-storage-st3-case-mapping-ascii)RulesA path wildcard named request or resource reads as the wildcard inside its block, not as the global of the same name (ST3-D-2)
oracle:rules-storage-st3-wildcard-shadows-global (captured 2026-11-04 by the Storage rules engine defect hunt, 3 cases) records production ALLOWING request == 'q' under match /pr/{request} and resource == 'q' under match /ps/{resource} for a get of the segment q, and DENYING request.method == 'get' under match /pt/{request}. The Storage evaluator now resolves an identifier as a let binding or function parameter, then a path wildcard, then the request and resource globals, the order the Firestore simulator already uses (resolveIdentifier in rules/simulator/evaluator.ts), so it agrees on all 3; before #1886 it read the globals first and all 3 differed. unit:storage/rules-oracle-conformance.test.ts replays them with no pin, and unit:storage/sandbox/rules-wildcard-shadows-global.test.ts runs the three shapes through getMetadata and their Firestore twins through getDoc.RulesA coarse write with request.resource over a stored object is checked as a create, as production checks an upload over an existing object, so an allow update grant cannot admit it; evaluateStorageRules and CLI/MCP rules.simulate agree with the live upload (ST3-C-1)
oracle:stdlib-realstorage-request-resource-fields records production, under real client uploads of 6 bytes over a stored 5-byte object, ALLOWING overwrite/verb-create (allow create: if true) and overwrite/create-stored-and-new-size, and DENYING overwrite/verb-update (allow update: if true). Before #1884 impliedVerbs bound such a write to update, so the evaluator and simulate gave the opposite verdict on all three and predicted ALLOW for a 50 MB overwrite that allow create caps. unit:storage/sandbox/rules-evaluator-semantics.test.ts replays those probes and the 50 MB case through evaluateStorageRules, and packages/cli/test/bridge/surface/rules-engines/storage.test.ts runs them through rules.simulate over an object stored in the sandbox.RTDB rules engine — production simulator conformance (rules-rtdb corpus)
Rules simulatorauth != null gate on .read/.write — authed ops allow, signed-out ops deny
oracle:rules-rtdb-r1-auth-only — production verdicts captured by deploy-observe-restore against the live oracle database (RTDB has no server-side rules test API), replayed verdict-for-verdict against the in-process simulator by packages/pyric/test/rules/rtdb/rules-conformance.test.ts; all 4 cases match production.Rules simulator$uid path-variable ownership ($uid === auth.uid) — the owner path allows, a foreign uid and an anonymous request deny
oracle:rules-rtdb-r2-own-uid: production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict against the in-process simulator; all 5 cases match production, so the simulator binds the path variable against auth.uid exactly as production does. oracle:rules-rtdb-r22-strict-equality-types (captured 2026-09-27) deploys the same ownership rule as $uid === auth.uid and a $name !== 'nobody' key guard: production allows the owner read and write, denies a foreign uid and an anonymous read, and denies the sentinel key. It also records strict typing: newData.val() === 5 denies the string '5', and newData.val() !== '5' allows the number 5. The expression grammar parses === and !==, the simulator evaluates them without type conversion, and all 11 cases match production. (Structured evidence: rules-conformance.test.ts, RtdbExprParser.test.ts, simulator.test.ts, sandbox-controls.test.ts)Rules simulatorWrite-rule CASCADE — a truthy ancestor .write grants the write regardless of a deeper !data.exists() rule, so the populated-path write ALLOWS
oracle:rules-rtdb-r3-data-exists — production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict. Production ALLOWS the write to the populated path even though the child rule is !data.exists(): the ancestor .write: auth != null already granted it, and RTDB never consults a deeper rule to revoke a grant. All 3 cases match; the simulator models the same cascade. (Structured evidence: rules-conformance.test.ts)Rules simulator.validate VETO — a failing child .validate denies a write the .write rule would otherwise permit (validate does not cascade and cannot be overridden)
oracle:rules-rtdb-r4-validate-structure — production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict; both cases match production. This row was the corpus's one historical simulator-vs-production divergence: at the 2026-05-18 agreement capture the simulator ALLOWED the missing-body write because it did not veto on the child .validate. The simulator now denies it, and this fresh capture re-confirms production's DENY, so the divergence is RESOLVED and needs no pin. (Structured evidence: rules-conformance.test.ts)Rules simulatorCascade is GRANT-ONLY — a root .read: true grants every descendant read (authed and anonymous), and a deeper .write: false cannot revoke a truthy ancestor .write grant
oracle:rules-rtdb-r5-cascade-root-grant — production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict; all 4 cases ALLOW in production, including the write to a node whose own .write is literal false. The simulator reproduces grant-only cascade rather than treating the deeper false as a veto. (Structured evidence: rules-conformance.test.ts)Rules simulatorLiteral .read/.write: false: the deny-all baseline denies every op, authed or anonymous, read or write, and a request no .read or .write rule on its path grants is denied, including where the deepest rules node on the path has only children, only a .validate, or only the other operation's rule
oracle:rules-rtdb-r6-deny-everything: production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict; all 3 cases DENY in production and in the simulator. oracle:rules-rtdb-r24-deny-without-rule (captured 2026-09-27) deploys a subtree whose root .read and .write are false: production denies a write under a node with only a .validate when the room .write is false, a write under a node with only a .read, and a read and a write of a node with only children, and allows the room-granted write and reads. All 7 cases match production, and simulate reports each denial as DENY naming the deepest .read or .write rule on the path, the verdict the sandbox returns for the same request. (Structured evidence: rules-conformance.test.ts, handler.test.ts, simulate-sandbox-agreement.test.ts)Rules simulatorNested path variable in an expression ($sessionId === auth.uid) — the matching session allows, a mismatched session denies, and an unmatched anonymous op denies with no matching rule
oracle:rules-rtdb-r7-pathvar-binding: production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict; all 4 cases match. The simulator binds the nested variable identically and denies the anonymous read of sessions, a node with only children and no ancestor .read that grants, as production does. (Structured evidence: rules-conformance.test.ts)Rules simulatordata and newData are bound at the RULE node, not the written path — an ancestor .write sees the pre-write subtree in data and the merged post-write subtree in newData across descendant sets, deep creates, leaf deletes, and multi-path updates
oracle:rules-rtdb-r8-combined-check — production verdicts captured by deploy-observe-restore, replayed verdict-for-verdict. Production DENIES all three writes, including the "matching owner" case whose owner field lives under /item rather than at the rule node; only the auth-gated read allows. All 4 cases match, so the simulator projects newData at the same node production does — rule placement relative to the written path decides the outcome. Extended 2026-11-07: oracle:rules-rtdb-r63-ancestor-write-data-newdata captures an ancestor $m .write reading both data.child('speaker').child('uid') and newData.child('speaker').child('uid'): production ALLOWS an owner deep-writing content (merged newData retains speaker), ALLOWS an owner leaf-deleting content/text, and ALLOWS creating /msgs/m2 with own speaker, while DENYING a non-owner deep write, a non-owner rewriting speaker/uid to self (data at $m remains pre-write), a deep create at /msgs/m3/content without speaker (newData at $m lacks speaker), and a non-owner multi-path update from /msgs. All 7 cases match production. (Structured evidence: rules-conformance.test.ts)Rules simulatorArithmetic and comparison operators in quota rules: + - / %, > >= < <=, === !==, ==, ||, the ternary, and unary minus, grouped without parentheses as production groups them: ! and unary minus first, then / %, + -, the relational operators, the equality operators, &&, ||, and the ternary last; binary operators group to the left and the ternary to the right
NEW ROW, 2026-07-12: production capture proves the simulator evaluates every arithmetic and ordering operator as production does, across increment-only counters, doubling and halving deltas, a parity check, inclusive and exclusive range caps, a negative sentinel, loose equality against zero, a disjunction, and a ternary tier bound.
oracle:rules-rtdb-r9-quota-arithmetic matches production verdict-for-verdict on all 23 cases. The corpus rules are the ones that capture deployed, with === and !== in the delta, parity, sentinel, and disjunction checks. oracle:rules-rtdb-r22-strict-equality-types adds mixed-type operands: production treats the number 5 and the string '5' as unequal under both === and !==, and the simulator agrees. oracle:rules-rtdb-r25-loose-equality-types (captured 2026-09-27) records that == and != do not convert types either: production denies newData.val() == '5' for the number 5, newData.val() == true for the number 1, newData.val() == 0 and newData.val() == '' for false, and newData.val() == '1' for true, and allows the matching != writes. It also records that data.val() == null holds for a missing node and not for a stored value, and that the number 1 equals the literal 1.0. The simulator evaluates == and != without type conversion, and all 19 cases match production. oracle:rules-rtdb-r35-operator-precedence (captured 2026-10-07) deploys one .read of literals per node and records production DENYING !(true || false && false), false == 1 < 2, true || false ? false : true, true ? false : true ? true : true, true ? false : true || true and !false && false, and ALLOWING false && false || true, true || false && false, true == 1 < 2, 1 < 2 == 2 < 3, 1 + 2 3 == 7, true || false && false ? true : false, -1 + 2 == 1, 10 - 4 - 3 == 3, 8 / 4 / 2 == 1 and 7 % 4 2 == 6. Each case separates two groupings, so && binds tighter than ||, the relational operators tighter than the equality operators, and the ternary condition takes the whole ||. The expression grammar has one level per group in that order, and the simulator matches all 16 cases. (Structured evidence: rules-conformance.test.ts, simulator.test.ts, simulate-sandbox-agreement.test.ts)Rules simulatorSnapshot structure and type guards — hasChild, parent(), isString, isNumber, isBoolean
NEW ROW, 2026-07-12: production capture proves the simulator resolves the type predicates and the
parent() path climb as production does, including RTDB's rule that a child .validate runs only for children PRESENT in newData — the name-without-age write is denied by that field's own parent guard, not by the absent sibling's type rule, which never runs. oracle:rules-rtdb-r10-snapshot-type-guards matches production verdict-for-verdict on all 7 cases. (Structured evidence: rules-conformance.test.ts)Rules simulatorString methods on a snapshot value: beginsWith, contains, endsWith, matches with a regex literal, .length, toLowerCase, toUpperCase, and replace-ALL replace, whose pattern is a string matched as text, so replace('/a/g', 'z') replaces the text /a/g. matches takes only a regular expression literal, whose only flag is i; a string argument fails the rule
NEW ROW, 2026-07-12: production capture proves
String.replace substitutes EVERY occurrence of the substring, not only the first: production ALLOWS the write whose rule is newData.val().replace('_', '-') === 'a-b-c' for the value a_b_c, which holds only under replace-all. The simulator delegated to JavaScript's String.prototype.replace, which given a string pattern substitutes only the first occurrence, and DENIED that write; the substitution now replaces every occurrence and the two-underscore case guards the regression. The same capture proves toUpperCase is a valid production rule method that the simulator's validator previously rejected outright as unknown. oracle:rules-rtdb-r11-string-validation matches production verdict-for-verdict on all 18 cases. oracle:rules-rtdb-r32-method-argument-types (captured 2026-10-07) records production ALLOWING newData.val().replace('/a/g', 'z') == 'z' for the value /a/g and DENYING it for a: a slash-delimited string pattern is text, not a regular expression. The simulator's replace takes only string arguments and matches both cases. Production refuses to deploy matches('^a') and matches(/^A/g) (oracle:rtdb-rules-deploy-refusals, row rtdb#89); unit:rules/rtdb/grammar/regex-literals-and-constant-comparisons.test.ts pins that a string given to matches fails the rule when it runs.Rules simulatornow (the server evaluation clock) and auth.token claims, read both dotted (auth.token.firebase.sign_in_provider) and subscripted (auth.token['firebase']['sign_in_provider'])
NEW ROW, 2026-07-12: production capture proves the simulator resolves the server clock and the decoded ID-token claims as production does, through both access forms. The subscript's receiver is load-bearing: production's rules compiler ACCEPTS
auth.token[...], a map indexed by key, but REJECTS the same subscript applied to a snapshot value: newData.val()['kind'] fails to compile with "No such method/property", so [] is a map accessor, not a general indexing operator. oracle:rules-rtdb-r12-server-time-and-token matches production verdict-for-verdict on all 7 cases. Extended 2026-10-07: oracle:rules-rtdb-r27-stdlib-core-patterns records production ALLOWING a written { ".sv": "timestamp" } under newData.val() == now and DENYING a client clock time there: the server resolves the server value before the rules run. simulate resolves a written { ".sv": "timestamp" } to its now and { ".sv": { "increment": n } } to the stored value plus n before it evaluates, as the sandbox does at its write boundary (unit:rules/rtdb/simulate-sandbox-agreement.test.ts), and the replay of that capture passes the client value through unchanged. Extended 2026-10-07: oracle:rules-rtdb-r28-stdlib-presence-timing records production ALLOWING a written serverTimestamp() under newData.val() == now as a set of the node, as a child in a set, and in a root multi-path update next to the data it stamps, and DENYING a client clock time in each place. The sandbox resolves a write's server timestamps and evaluates its rules at one instant of its clock for set, update, multi-path update, onDisconnect registration and transactions (unit:database/server-timestamp-now.test.ts, which advances the clock on every read); before, it read the clock twice and could deny the write. Production verdicts for a server timestamp in an onDisconnect write or a transaction are not captured. The simulator and the sandbox match production on all 28 cases of that capture. Extended 2026-10-07: oracle:rules-rtdb-r34-stdlib-auth-membership-quota signs in as Auth users the capture creates, through custom tokens, and records production reading the account's auth.token.email_verified and auth.token.email (ALLOWING a verified email and a verified email at the required domain, DENYING an unverified email, an email at another domain and an anonymous token without an email) and developer claims (ALLOWING role of 'admin' or 'editor' and beta == true, DENYING 'viewer', a missing claim and the string 'true'). The claim set follows oracle:auth-id-token-standard-claims. A token without a tenant fails auth.token.firebase.tenant == 'acme'; a tenant sign-in is not captured. The simulator and the sandbox match production on all 36 cases of that capture, which also cover roles and member lists stored in the database and a windowed quota. (Structured evidence: rules-conformance.test.ts, corpus-lock.test.ts)Rules simulatorgetPriority() on a plain set (an unset priority reads null) and the .indexOn query-planner directive
NEW ROW, 2026-07-12: production capture proves a plain
set leaves a node's priority unset, so getPriority() reports null in production exactly as the simulator does, and that a ruleset carrying .indexOn deploys and evaluates with every verdict intact. The scope is exactly that: .indexOn never changes an allow/deny verdict, so the twin evidences only that production's compiler accepts and deploys the directive, and it says nothing about query behavior. Non-null priorities are verified separately by row #20, whose capture seeds them through the admin adapter and writes one in a { .value, .priority } value. oracle:rules-rtdb-r13-priority-and-index-directive matches production verdict-for-verdict on all 4 cases. (Structured evidence: rules-conformance.test.ts)Rules simulatorThe root binding — root.child(...).exists() resolved against the database root
NEW ROW, 2026-07-12: production capture proves the simulator resolves the
root binding and reports a missing child as absent exactly as production does. The scope is bounded by the rig: the capture runner mounts the scenario subtree under a per-run randomly-named namespace while the replay suite mounts it at the root, so a rule naming any PRESENT path through root would address a different node on each side and diverge for harness reasons. Only a sentinel key absent under BOTH roots is mount-invariant, so that is what this row verifies; a populated root lookup remains unverified and needs a rig that can seed outside the scenario subtree and mount both sides at the same depth. oracle:rules-rtdb-r14-root-lookup matches production verdict-for-verdict on all 3 cases. (Structured evidence: rules-conformance.test.ts)Rules simulator.validate runs on the ancestors of each written path and on every node the written value carries, each against the merged post-write value at its own location; a sibling node the write does not carry is not validated
oracle:rules-rtdb-r15-validate-ancestor-scope: production DENIES a deep write that leaves its validated ancestor without the required child, while the same write under a rule-free ancestor ALLOWS and the write ALLOWS once the ancestor requirement is seeded. oracle:rules-rtdb-r23-validate-sibling-scope records production ALLOWING a set of one child, an update of that child alone, a multi-path update of two rooms' children, and a deletion of one child, next to an unchanged sibling whose .validate requires a change and a stored sibling that fails its .validate, in the same room or another room; ALLOWS a set, an update, and a multi-path update that delete a child an unwritten sibling's .validate requires; and DENIES a set of the room or an update that writes those siblings with the value they already hold. The simulator walks validation from the root through each write location and through the written value, never into an unwritten sibling, and matches all 21 captured production cases. unit:simulation/handler.test.ts pins the same scope for set, delete, update, and multi-path update. Extended 2026-10-07: oracle:rules-rtdb-r27-stdlib-core-patterns deploys the RTDB rules standard library's compiled match, table, note, player and counter rules and records production ALLOWING an update of guest and status alone next to a step-checked moveCount the update does not carry, and an update of currentTurn and moveCount that steps the count by one, while DENYING an update that steps it by two and a create whose moveCount starts past 0. The simulator and the sandbox match production on every standard library case in that capture; unit:rules/rtdb/stdlib/corpus-lock.test.ts runs each case through simulate and the sandbox and fails when the builders compile to a different ruleset. (Structured evidence: rules-conformance.test.ts, case-update-query.test.ts, simulate-sandbox-agreement.test.ts)Rules simulatorauth.provider names the sign-in method, equal to auth.token.firebase.sign_in_provider (anonymous for an anonymous sign-in), and auth.tenant reads null without a tenant
oracle:rules-rtdb-r16-auth-provider-and-tenant records production for an anonymous sign-in: auth.provider == 'anonymous' ALLOWS, auth.provider == 'password' DENIES, auth.provider == auth.token.firebase.sign_in_provider ALLOWS, and both auth.tenant == null and auth.token.firebase.tenant == null ALLOW. The simulator matches all 7 cases: it builds auth through the shared normalizeAuthState and reads provider from the token's sign_in_provider. The sandbox's own enforcement agrees, because a signed-in data context's auth.token carries the firebase namespace of its minted ID token (packages/pyric/test/auth/sandbox-backend-rules-token.test.ts). The corpus signs in anonymously only, so a federated provider's auth.provider value is not captured. (Structured evidence: rules-conformance.test.ts)Rules simulatorA .read, .write, or .validate expression that errors at evaluation, such as .length or a string method on a number or on null, or a method argument that is not a string (null from a missing value or a signed-out auth.uid, or a number), fails as that rule; an argument is never converted to a string: the error fails the whole expression, including on the left of || and under !. A .validate that errors denies the write, and a .read or .write that errors does not grant, so a descendant rule on the path can still grant
oracle:rules-rtdb-r17-validate-runtime-error: production DENIES a number written under newData.val().length > 2 and under newData.val().toUpperCase() == 'OK', ALLOWS strings that satisfy them, and DENIES under a type guard that short-circuits first. The simulator matches all 5 cases. oracle:rules-rtdb-r26-rule-runtime-error (captured 2026-09-27) extends this to .read and .write: production DENIES a read and a write whose rule calls toUpperCase() on a number, ALLOWS a read and a write under a descendant rule that grants below an ancestor rule that errors, DENIES newData.val().toUpperCase() == 'OK' || newData.isNumber() and !(newData.val().toUpperCase() == 'OK') for the number 5, and DENIES toUpperCase() on a missing child value. simulate counts such an error as the rule failing, the verdict the sandbox returns, and matches all 13 cases. oracle:rules-rtdb-r32-method-argument-types (captured 2026-10-07) records production DENYING contains, beginsWith and hasChild given a missing value or a number, child(auth.uid) for a signed-out read with a null key stored, and replace given a number replacement, and ALLOWING each with a string argument and hasChildren([]) on an object and on a leaf. The simulator raises the same error for each, and simulate and the sandbox match all 16 cases (unit:rules/rtdb/argument-and-operand-sandbox.test.ts). Extended 2026-10-15 (LNT-1): oracle:rules-rtdb-r41-error-and-false-short-circuit records 8 production verdicts for !(X && false), (X && false) || true, and (X && false) ? false : true in .read and .write when X calls toUpperCase() on a number versus a string; production DENIES all 5 erroring cases and ALLOWS all 3 string controls, and the simulator matches all 8. (Structured evidence: rules-conformance.test.ts, handler.test.ts, simulate-sandbox-agreement.test.ts, method-argument-types.test.ts)Rules simulatorchild() does not resolve . or .. path segments: child('./x') and child('a/../x') find nothing where child('x') finds a child
oracle:rules-rtdb-r18-child-dot-segments — production ALLOWS a write whose validate requires newData.child('x').exists() and DENIES the same data under child('./x') and child('a/../x'). The simulator matches all 3 cases. (Structured evidence: rules-conformance.test.ts)Rules simulatorA literal child key excludes its $wildcard sibling: the wildcard's .read, .write and .validate do not apply to a key a literal sibling names, whichever is declared first
oracle:rules-rtdb-r19-literal-and-wildcard-siblings records production DENYING reads and writes of special under a denying literal next to a granting $id, with the literal declared first or second; ALLOWING special under a granting literal next to a denying $id; and not running $other's failing .validate for the literal title. The simulator matches all 10 cases: a key a literal sibling names never goes to the wildcard, when collecting .read/.write rules or walking .validate. Extended 2026-10-07: oracle:rules-rtdb-r27-stdlib-core-patterns deploys the closed shapes the RTDB rules standard library's validation.shape builds, typed literal children next to a $other whose .validate is false, and records production ALLOWING a match and a player that write only the listed fields and DENYING a match and a player that add an unlisted field. The simulator and the sandbox match. (Structured evidence: rules-conformance.test.ts)Rules simulatorgetPriority() returns a node's number or string priority, on the node or through child(), and val() returns the node's value rather than its { .value, .priority } form, for stored data and for a write that carries a priority
oracle:rules-rtdb-r20-priority-values records production ALLOWING all 8 cases: seeded number and string priorities read back through getPriority(), the value of a prioritized node and of a prioritized child read through val(), a plain node reads a null priority, and a write of { '.value': 'w', '.priority': 7 } passes newData.getPriority() == 7 && newData.val() == 'w'. The simulator matches all 8 cases: getPriority() reads a node's .priority, and val() reads .value and drops .priority at every level. The sandbox matches all 8 too (unit:rules/rtdb/argument-and-operand-sandbox.test.ts replays the capture): it stores the priority of every node a written or seeded value carries, a nested { '.value', '.priority' } included, and rules read stored priorities through data, root and newData. (Structured evidence: rules-conformance.test.ts)Rules simulator.validate does not run for a node whose new value is null: deleting a node, writing {} to it, or deleting the only child of a node whose .validate requires children is allowed, while a write that leaves the node non-null still runs its .validate
oracle:rules-rtdb-r21-validate-on-delete records production ALLOWING a write of {} and a write of null to a node whose .validate requires reqA and reqB, the deletion of a parent's only child under newData.hasChildren(), and the deletion of one of two children; and DENYING the deletion of reqB alone and a write of the node without reqB. The simulator matches all 6 cases: an object with no children reads as null. (Structured evidence: rules-conformance.test.ts)Rules simulatorlocateRtdbRule(source, path, kind) maps a rule node (.read, .write, .validate or .indexOn at a rule-tree path) to the line and column of its key in database.rules.json, including files with comments, rule strings that span lines, and trailing commas; Studio marks that line for an RTDB denial and pyric database rules validate prints it per finding. locateRtdbTrace(source, trace) gives each entry of an evaluation trace the line of the rule it evaluated; Studio renders one row per evaluated rule and marks the row's line when it is clicked, and rules.simulate with inline database rules returns the trace with those lines
unit:rules/rtdb/source-locations.test.ts pins nested paths, $wildcard segments, keys and braces inside comments and strings, block comments across lines, CR and CRLF line endings, rule strings that span lines, trailing commas in objects and arrays, duplicate keys and unparseable text, and refuses a doubled or leading comma; oracle:rtdb-rules-text-dialect records production accepting and refusing the same forms. unit:cli/rules-engines/database-denial.test.ts asserts the lines of an explainDenial draft whose rule string spans lines and whose objects end in commas. unit:studio/rules-debug.test.ts runs sandbox RTDB denials against a commented ruleset and asserts the marked line, including a path whose rule text is identical to another's, and the rendered line label. unit:cli/cli.test.ts asserts line and column on a validate finding. unit:rules/rtdb/source-locations.test.ts also covers the trace lookup, unit:studio/rules-debug/RtdbTrace.test.tsx renders a three-rule cascade and asserts each row's line and the marked line after a click, and unit:cli/rules-engines/database.test.ts asserts the lines on an inline rules.simulate trace. Source positions are Pyric tooling: production returns no rule position, so there is no production observation to replay.Rules simulatorAn arithmetic or ordering operator with a null operand fails the rule: + with a number or a string on either side, -, *, /, %, unary -, <, <=, > and >= applied to data.val() where nothing is stored are evaluation errors, so newData.val() == data.val() + 1 denies a create and data.val() + 1 == 1 || true denies. == and != compare null without an error
oracle:rules-rtdb-r27-stdlib-core-patterns (captured 2026-10-07) records production DENYING a write of 1 under newData.val() == data.val() + 1 where nothing is stored, and under each of data.val() + 1 == 1 || true, 1 + data.val() == 1 || true, data.val() - 1 == -1 || true, data.val() * 2 == 0 || true, data.val() + 'a' == 'nulla' || true, -data.val() == 0 || true and data.val() < 1 || true, and denying data.val() + 1 != 1. The || true cases deny only if the left side is an error, so each operator with a null operand fails the whole rule. oracle:rules-rtdb-r33-null-operands (captured 2026-10-07) records production DENYING /, %, <=, > and >= with a null operand under || true, on either side, and ALLOWING each with a stored number. The simulator and the sandbox raise a rule runtime error for a null operand of each of these operators and match every case in both captures: unit:rules/rtdb/stdlib/corpus-lock.test.ts replays r27-stdlib-core-patterns and unit:rules/rtdb/argument-and-operand-sandbox.test.ts replays r33-null-operands through simulate and the sandbox, and unit:rules/rtdb/grammar/method-argument-types.test.ts pins ==, !=, === and !== comparing null on either side without an error. Every RTDB rules standard library builder that computes with a stored value checks first that it exists or is a number, and the library's 49 cases in the same capture agree with production. (Structured evidence: rules-conformance.test.ts)Rules simulatorPyric's load-time check refuses the rulesets production's rules endpoint refuses for an unknown variable, newData in a .read, an unknown snapshot or value method, and an assignment, and loads the rulesets production accepts: an operand typed only at evaluation, an unknown property of auth, and a ruleset over the documented 256 KB limit. Rules file text reads as the deploy endpoint reads it: comments, a rule string that spans lines (LF or CRLF), a raw tab inside a rule string, and a trailing comma before } or ] are accepted, and a backslash before a line break, a doubled comma and a leading comma are refused
oracle:rules-rtdb-r29-deploy-rejections sends 33 rulesets to production's rules endpoint as dry runs (PUT /.settings/rules.json?dryRun=true, the validation firebase deploy runs before it deploys) and records each verdict and error text. Production rejects foo == 1 ("Unknown variable 'foo'."), newData.exists() in .read ("newData is invalid in .read expressions."), data.foo() and newData.val().bar() ("No such method/property"), and auth.uid = 'x' ("Rule expressions may not contain assignments."); Pyric's load-time check rejects the same five rulesets. Production accepts auth.uid + 1 > 'x', auth.foo == 1, and a ruleset of about 300 KB; Pyric loads all three. oracle:rtdb-rules-text-dialect (captured 2026-10-07) sends 12 rules file texts byte for byte as dry runs and records production accepting comments, a rule string spanning lines with LF and with CRLF, a raw tab inside a rule string, and a trailing comma in a rule object, in every object, in an .indexOn array and before a comment, and refusing a backslash before a line break inside a rule string ("Invalid escape"), a doubled comma and a leading comma. unit:database/oracle-conformance.test.ts reads each text through toStrictRulesJson, the reader every RTDB rules load path uses, and the load-time check, and agrees with every verdict. packages/conformance/src/rules-rtdb-replay.test.ts replays deploy cases through the local check. (Structured evidence: rules-conformance.test.ts)Rules simulatorA .read rule reads the request's query through query: orderByChild, orderByValue, equalTo, startAt, endAt, limitToFirst and limitToLast carry the query's values, orderByChild reads null for a read without a query, and a limit the query does not set reads null, so a bound on it fails the rule
oracle:rules-rtdb-r30-query-rules runs 20 reads against production, 15 of them queries built with the Web SDK. Production allows an orderByChild('owner').equalTo(uid) list read for the user's own uid, and denies another uid, another child, a plain read, and a signed-out query; reads orderByValue as true under orderByValue(); reads startAt and endAt as the range bounds and denies a different startAt; reads orderByChild as null for a plain read and not null under orderByChild; grants limitToFirst <= 2 and limitToLast <= 2 under a limit of 2 and denies a limit of 3; and denies limitToFirst <= 2 for a plain read and limitToLast <= 2 under limitToFirst(1), where the unset limit is null and <= with a null operand fails the rule (row #22). The simulator matches each of these cases; see row #26 for orderByKey and orderByPriority. (Structured evidence: rules-conformance.test.ts)Rules simulatorCustom claims on the ID token read through auth.token: boolean, string, number and nested object claims, a claim the token does not carry, and custom as the sign-in provider of a custom-token sign-in
oracle:rules-rtdb-r31-token-claims signs in with a custom token minted by the service account for each case's claims, the token production issues for those claims. Production allows auth.token.admin == true, auth.token.role == 'editor', auth.token.level >= 3 and auth.token.org.tier == 'gold' when the token carries that value and denies other values; reads a claim the token does not carry as null; reads auth.token.firebase.sign_in_provider and auth.provider as custom; and denies the admin gate for an anonymous user and a signed-out request. The simulator matches all 12 cases. The capture deletes every Auth user it signs in as and proves each deletion with a lookup. (Structured evidence: rules-conformance.test.ts)Rules simulatorquery.orderByKey and query.orderByPriority read as production reads them, including for a read whose query does not set them
oracle:rules-rtdb-r30-query-rules records production reading orderByKey as true under orderByKey() and false for a plain read, and reading orderByPriority as true under orderByPriority() and false for a plain read. oracle:rules-rtdb-r45-not-operator-runtime (captured 2026-10-15) records !query.orderByKey ALLOWing, !!query.orderByKey DENYing, and query.orderByKey == false ALLOWing on a plain read (confirming query.orderByKey is boolean false, not null, and closing MET-1). buildSimulatedQueryContext and querySpecToSimulationQuery default orderByKey, orderByValue, and orderByPriority to false on reads and populate orderByPriority: true under orderByPriority(); the simulator matches all 20 r30 verdicts and all 3 r45 verdicts. (Structured evidence: rules-conformance.test.ts, handler.test.ts)Rules simulatorPyric's load-time check refuses a database.rules.json that production's rules endpoint refuses to deploy for its tree structure or for a type error in a rule, with the endpoint's text. Tree structure: two $ children of one node, a number or object as a rule value, a number as .indexOn, a key containing #, a .-prefixed key that is not a rule, and a child whose value is a string. Type errors: an undeclared $ variable, an unknown query field, child() with no argument or two, length() called as a method, a property read on a snapshot, a snapshot used as an operand, 'a' - 1, true > 1 and !'a', a rule whose result is a string or a number, a snapshot method on auth or a string method on a snapshot, and matches() with a string or hasChild() with a number. A rejected ruleset leaves the rules in force. The forms inferred from those texts but not yet captured (an .indexOn array with a non-string member, a key holding ., /, [, ] or an inner $ without #) load with a warning
oracle:rules-rtdb-r29-deploy-rejections sends each of these rulesets to production's rules endpoint as a dry run and records the verdict and text: two $ children ("Cannot have multiple default rules ('$x' and '$y')."), a number or an object as a rule value ("Invalid rule expression. Expected 'true', 'false', or an expression string."), a number as .indexOn ("Invalid indexOn expression. Must be either a string or an array of strings"), a child key containing # ("String can't contain ., #, $, /, [, or ]"), and a .-prefixed key that is not a rule or a child that is a string ("Expected '{'."). unit:rtdb/source-rejection.test.ts loads each of them through rtdbRulesSourceRejection, which every RTDB rules load path calls, and asserts the same text; unit:rtdb/rules-conformance.test.ts and the replay in rules-rtdb-replay.test.ts agree with every recorded verdict, the type errors included.Rules simulatorRuntime non-number / non-string operands of -, *, /, %, unary -, +, <, >, >=, and .length on non-strings fail the rule as production does, rather than coercing booleans, numeric strings, or objects through JavaScript operators or reading a child key named length (FUZ-3, MET-2)
oracle:rules-rtdb-r36-runtime-arithmetic-types (captured 2026-10-15) records 20 production verdicts for -, *, /, %, and unary - on runtime booleans, numeric strings, non-numeric strings, and objects (including under || true and !(X == 0)): production DENIES all 19 non-number cases and ALLOWS the numeric control 5 - 1 == 4. oracle:rules-rtdb-r37-runtime-comparison-and-length-types (captured 2026-10-15) records 20 production verdicts for +, <, >, >=, and .length: production ALLOWS string-plus-number concatenation ("5" + 1 == "51" and under || true) and DENIES all 18 boolean/object +, mixed-type </>/>=, and non-string .length cases (including {length: 10}.length > 2). The simulator raises RtdbRuleRuntimeError on non-number arithmetic, boolean/object +, mixed-type relational comparisons, and non-string .length, matching all 40 verdicts across both captures. (Structured evidence: rules-conformance.test.ts, simulator.test.ts)Rules simulatorRuntime division and modulo by zero (x / 0, x % 0) match production rather than evaluating 10 / 0 to JavaScript Infinity and granting 10 / 0 > 100 (COV-2)
oracle:rules-rtdb-r38-div-mod-by-zero (captured 2026-10-15) records 8 production verdicts for runtime division and modulo with a seeded zero divisor: production DENIES 10 / 0 > 100 and ALLOWS the 5 == 0 || true / !(X == 0) cases and 2 non-zero controls. The simulator evaluates runtime division and modulo by zero to NaN without raising an evaluation error, so 10 / 0 > 100 is false (DENY) and == 0 || true / !(X == 0) are true (ALLOW), matching all 8 verdicts. (Structured evidence: rules-conformance.test.ts, simulator.test.ts)Rules simulatorEvaluating root.parent() at runtime fails the rule expression as production does, so neither == null nor || true can evaluate to ALLOW (COV-1). The deploy verdict of (true ? data.parent() : null).exists() is row 196
oracle:rules-rtdb-r39-root-parent-runtime (re-captured on firebase 12.19.0 for #1676) records 7 production verdicts: production DENIES all 6 root.parent() cases ((true ? root.parent() : null) == null, (true ? root.parent() : null) != null || true, ((true ? root.parent() : 1) == 1) || true, (true ? root.parent() : 1) != 1, (true ? root.parent() : '').length == null || true, and root.parent().exists() || true) and ALLOWS the non-root data.parent().exists() control at /nested/child. DataSnapshot.prototype.parent() raises RtdbRuleRuntimeError('Cannot call parent() on root.') on the root snapshot (COV-1), matching all 7 verdicts. (Structured evidence: rules-conformance.test.ts, simulator.test.ts, validator-types.test.ts)Rules simulatorDynamic indexing on auth.token[expr] when expr evaluates to null (a missing child value) fails the rule as production does rather than coercing null to the claim key "null" via String(idx) (FUZ-4)
oracle:rules-rtdb-r40-auth-token-dynamic-index (captured 2026-10-15) records 4 production verdicts: production DENIES auth.token[data.child('k').val()] == true with claim "null": true and missing k, DENIES auth.token[data.child('k').val()] == true || true with missing k, ALLOWS numeric k = 5 with claim "5": true, and ALLOWS string k = "ok" with claim "ok": true. CallExpr_indexAccess raises RtdbRuleRuntimeError when the index is not a string or number, matching all 4 verdicts. (Structured evidence: rules-conformance.test.ts, simulator.test.ts)Rules simulatorCustom-token sign-in populates standard ID-token fields on auth.token (sub, iat, exp, iss, aud, auth_time, user_id, firebase.identities, firebase.sign_in_provider) as production does (COV-3)
oracle:rules-rtdb-r42-custom-token-standard-claims (captured 2026-10-15) records 12 production verdicts after custom-token sign-in (claims: { role: 'member' }): production ALLOWS all 12 checks (sub != null, sub == auth.uid, iat != null, exp != null, iss != null, aud != null, auth_time != null, user_id != null, user_id == auth.uid, firebase.identities != null, firebase.sign_in_provider != null, and firebase.sign_in_provider == 'custom'). A signed-in sandbox session's auth.token is the minted ID token's full claim set (rulesTokenFromIdToken in rules/auth/token-claims.ts, #1341), so sub, iat, auth_time, exp, iss and aud carry the minted values and auth_time stays at the sign-in. iss is https://securetoken.google.com/<projectId> and aud the project id, as production's are (#1503); a caller that knows no project mints for pyric-sandbox. For a simulate() case that omits them, withIdTokenClaims fills the standard ID-token fields (sub, user_id, iat, auth_time, exp, iss, aud, firebase.identities). Both match all 12 verdicts. (Structured evidence: rules-conformance.test.ts, handler.test.ts, rules-token-claims.test.ts)Rules simulatorPyric's load-time check (rtdbRulesSourceRejection) and checkRtdbRules (localDeployVerdict) match production dry-run deploy validation for structural non-object children and unknown dotted keys (CON-6), auth[...] indexing (FUZ-4), double-quoted and single-quoted string escape sequences and raw newlines (FUZ-1), and regular expression literals in matches() (FUZ-2, FUZ-8), alongside 1e309 (COV-2) and root.parent() (COV-1)
oracle:rules-rtdb-r43-deploy-expression-and-structure-probes (captured 2026-10-15, 14 dry-run deploy cases) records production ACCEPTING 1e309 > 100 (COV-2), (true ? root.parent() : null) == null and ((true ? root.parent() : 1) == 1) || true (COV-1), and auth.token[data.child('k').val()] == true (FUZ-4), and REJECTING root.parent() != null || true (COV-1), auth[data], auth[true], auth[null] (FUZ-4, "Invalid property access on 'auth' object."), ".valdiate": false, child values true, null, 42, [{".read": true}] (CON-6, "Expected '{'."), and ".read": [true] (CON-6, "Invalid rule expression."). oracle:rules-rtdb-r44-deploy-string-and-regex-probes (captured 2026-10-15, 9 dry-run deploy cases) records production ACCEPTING "\'", "\x41", and raw tab in double-quoted rule strings (FUZ-1), /+/, /[z-a]/, /a{2,1}/ (FUZ-2), and /^[^/]+$/ (FUZ-8), and REJECTING a raw newline in a double-quoted rule string (FUZ-1, "unterminated string literal") and matches(/(/) (FUZ-2, "Illegal regular expression, expected ')' at position 5"). Both rtdbRulesSourceRejection and localDeployVerdict (checkRtdbRules(() => compileRtdbRules(...))) agree with production on 14/14 in r43 and 9/9 in r44. (Structured evidence: source-rejection.test.ts, regex-literals-and-constant-comparisons.test.ts, validator-types.test.ts, simulator.test.ts, rules-rtdb-replay.test.ts)Rules simulatormatches() evaluates a regular expression as production does: lookahead (?=, negative lookahead (?!, a backreference \1 and a word boundary \b never match as JavaScript reads them (\b reads as the letter b and \1 as the digit 1), so !matches() over them grants, and . matches \n and \r (SP-2b, SP-8)
oracle:rules-rtdb-r47-regex-runtime (captured 2026-10-26, 16 cases) records production DENYING a lookahead requiring a digit on ab1, a negative lookahead refusing admin on guest, a backreference on aa and a word boundary on a cat sat, and ALLOWING /^a.b$/ on a\nb. oracle:rules-rtdb-r50-regex-unsupported-semantics (captured 2026-10-26, 12 cases) records production ALLOWING !matches() over a negative lookahead on guest, a lookahead on ab1, a backreference on aa and a word boundary on a cat sat, ALLOWING /\bcat\b/ on bcatb and /^(a)\1$/ on a1, and ALLOWING /^a.b$/ on a\rb. The simulator now parses production's dialect (rules/rtdb/grammar/regex.ts: a leading ^ and trailing $ stripped, .* for a missing one, a backslash making the next character literal except \d \w \s and their capitals, . matching every character) and matches it with the shared linear-time NFA (rules/simulator/regex-nfa.ts), so it agrees with all 28 r47 and r50 cases, including $ not matching before a trailing newline (SP-7 refuted), the i flag, an unanchored pattern and a lazy quantifier; unit:rules/rtdb/rules-conformance.test.ts replays them with no pin. unit:rules/rtdb/grammar/regex-dialect.test.ts covers the dialect and ^(a+)+$ in linear time (LD-6), and unit:database/sandbox/rules-regex-dialect.test.ts covers the in-page sandbox. Fixed in #1247 stream S1.Rules simulatorPyric's load-time check refuses a regular expression production refuses to deploy: a ^ that is not the first character or a $ that is not the last, and a Unicode property class \p{..} (SP-1, SP-2a)
oracle:rules-rtdb-r46-deploy-regex-constructs (captured 2026-10-26, 9 dry-run deploy cases) records production REJECTING /^red$|^blue$/ and /(^a)/ ("Illegal regular expression, unescaped ^, ^ can only appear at the end of regular expressions") and /^\p{L}+$/ ("Illegal regular expression, integer expected at position 3"), and ACCEPTING lookahead, negative lookahead, a backreference, \b, a lazy quantifier and /^[a-z0-9-]+$/ (SP-2c refuted). oracle:rules-rtdb-r51-deploy-anchor-index-and-length-probes (captured 2026-10-26) records production REJECTING /a$|b/ and /(a$)/ with the same text and ACCEPTING /a\$b/. Pyric's load-time check (rtdbRegexError in rules/rtdb/grammar/regex.ts) refuses all five with production's exact text and accepts the rest; unit:conformance/rules-rtdb-replay.test.ts replays them with no pin, and unit:rules/rtdb/grammar/regex-dialect.test.ts asserts the texts. Fixed in #1247 stream S1.Rules simulatorquery in a .write or .validate rule reads as it does on a plain read, so query.orderByKey is false and !query.orderByKey grants (SP-4)
oracle:rules-rtdb-r49-value-edges (captured 2026-10-26) records production ALLOWING a write under !query.orderByKey and under query.orderByKey == false, and under the control query.limitToFirst == null. The simulator gives a write the plain-read query (buildSimulatedQueryContext), and unit:rules/rtdb/rules-conformance.test.ts replays all three verdicts. unit:rules/rtdb/simulation/handler.test.ts checks .write and .validate both read it and that a write ignores a query passed with it. Row #26 records the same fields agreeing on reads. Fixed in #1247 stream S3.Rules simulatorA child named __proto__ is an ordinary key: a write at /__proto__ lands in the post-write tree and its $wildcard .validate runs (CS-1)
oracle:rules-rtdb-r52-prototype-named-keys (captured 2026-10-26, 7 cases) records production DENYING a string set at /path/__proto__ under a number-only $k .validate, as it denies one at /path/plain and /ctor/constructor. The simulator's post-write tree sets each written key as an own property (post-write-tree.ts withValueAt), so the key lands and its .validate runs; unit:rules/rtdb/rules-conformance.test.ts replays all 7 verdicts, and unit:rules/rtdb/simulation/prototype-named-keys.test.ts covers an update key, a listed update path, stored data and snapshot reads under __proto__. The object and update cases carrying an own __proto__ key are allowed in production: the capture runner copies each case value by assignment, which drops the key, so production received an empty write. The SDK's set() also drops it (ChildrenNode.val() assigns each child), and the simulator writes such a value without the key. The SDK's update() sends its value as given, so the simulator keeps an own __proto__ nested in an update value and runs its .validate. Fixed in #1247 stream S3.Rules simulatorPyric's load-time check refuses an .indexOn entry naming a child with a . in it, as production refuses to deploy it (CS-17)
oracle:rules-rtdb-r51-deploy-anchor-index-and-length-probes (captured 2026-10-26) records production REJECTING ".indexOn": ["x.y"] ("Invalid key: x.y. Index must be either .value or declared on a valid path") and ACCEPTING an empty entry [""] and a nested path ["x/y"]. Pyric's load-time check refuses the dotted entry with production's text and accepts the other two; unit:conformance/rules-rtdb-replay.test.ts replays all three. Fixed in #1247 stream S5 (CS-17).Rules simulatorUnder Node, lint() and simulate() read a || chain of 500, 501 and 2,000 terms, as production deploys each (LD-7)
oracle:rules-rtdb-r51-deploy-anchor-index-and-length-probes (captured 2026-10-26) records production ACCEPTING .read rules that chain 500, 501 and 2,000 auth.uid == 'u<n>' terms with ||. Before the fix, every semantics pass over the left-recursive grammar descended once per term, and a fresh Node process (22.15 and 24.16 alike) exhausted its default stack at 499 terms; whether 500 or 501 terms overflowed in a process that had already run other cases depended on JIT warm-up and case order, not the Node version. lint() then reported PARSE_ERROR and simulate() returned UNSUPPORTED. || and && now match as flat chains folded in a loop, and unit:rules/rtdb/node-stack.test.ts runs each ruleset in its own fresh Node child against dist and asserts agreement with production for all three. The row scopes rtdb.operator.or because the r51 cases attribute themselves to it; the defect was the parser's recursion depth over a chain, not how || evaluates. Fixed in #1247 stream S5 (LD-7).Rules simulator==, != and === with an object value from val() compare as production compares them: an object is never equal to anything, an identical object included, and != is true, without failing the rule (SP-3 refuted)
oracle:rules-rtdb-r48-object-equality (captured 2026-10-26, 10 cases) records production DENYING data.val() == data.val() on a stored object, data.val() == newData.val() and === over identical objects, ALLOWING != over identical and different objects, and ALLOWING !(newData.val() == 'x') and !(newData.val() == null) for an object, which shows == with an object operand is false rather than a rule error. Number controls under == and != allow. The simulator matches all 10 verdicts. (Structured evidence: rules-conformance.test.ts)Rules simulatorMembers of auth read null when nobody is signed in, child() with a dotted or empty key and hasChild('.priority') read as production reads them, and .length counts UTF-16 code units (SP-5, SP-6 refuted)
oracle:rules-rtdb-r49-value-edges (captured 2026-10-26, 13 cases) records production ALLOWING a signed-out read under auth.token.admin != true and under auth.uid == null, treating child('a.b') as a missing child, child('') as the node itself and hasChild('.priority') as true on a leaf with a priority, and DENYING three emoji under length <= 3. The simulator matches these 11 verdicts; row #36 records the two query cases where it does not. (Structured evidence: rules-conformance.test.ts)Rules simulatorPyric's load-time check refuses a malformed regular expression with production's deploy error text: an unmatched ) ("end-of-string expected"), an unclosed (, repeat count or character set at production's position, and an empty alternative left by the anchor strip, and it deploys a ) after a leading ^ as a literal
oracle:rules-rtdb-r53-deploy-regex-paren (captured 2026-10-27, 10 dry-run deploy cases) records production REJECTING /)/ and /a)b/ ("Illegal regular expression, end-of-string expected"), /^(/ ("expected ')' at position 3"), /^(a$/ (position 2), /a(b/ (position 7), /a{2/ ("expected '}' at position 5"), /^a|$/ ("unexpected end-of-string") and /^[]$/ ("expected ']' at position 2"), and ACCEPTING /^)/ and /^(a)$/. The positions count from the pattern production parses: the leading ^ and trailing $ stripped, .* for a missing one. rtdbRegexError (rules/rtdb/grammar/regex.ts) agrees on all 10 with the exact texts; unit:conformance/rules-rtdb-replay.test.ts replays the verdicts and unit:rules/rtdb/grammar/regex-dialect.test.ts the texts. Found in #1247 stream S1.Rules simulatormatches() applies production's anchor rewrite to a top-level alternation: with no group around the pattern, /cat|dog/ reads as .cat|dog. (a string ending in cat or starting with dog) and /^a|b$/ as exactly a or b, where JavaScript reads both as "contains either side"
oracle:rules-rtdb-r54-regex-alternation-runtime (captured 2026-10-27, 10 cases) records production DENYING /cat|dog/ on a cat here and hotdog and ALLOWING it on bobcat, dogs and cat, DENYING /^a|b$/ on ax and xb and ALLOWING it on a, and, for the control /(cat|dog)/, ALLOWING a cat here and DENYING a cow here. The simulator (rules/rtdb/grammar/regex.ts) matches all 10; unit:rules/rtdb/rules-conformance.test.ts replays them. Found in #1247 stream S1. (Structured evidence: regex-dialect.test.ts)Rules simulatorPyric's load-time check accepts a regular expression the anchor rewrite leaves empty or nearly empty: /^$/ (the empty string), /^/, /$/ and /^()$/
oracle:rules-rtdb-r55-deploy-regex-empty (captured 2026-10-27, 4 dry-run deploy cases) records production ACCEPTING /^$/, /^/, /$/ and /^()$/. rtdbRegexError (rules/rtdb/grammar/regex.ts) accepts all four; unit:conformance/rules-rtdb-replay.test.ts replays them and unit:rules/rtdb/grammar/regex-dialect.test.ts checks that /^$/ matches only the empty string. Found in #1247 stream S1.Rules simulatormatches() reads \s, \w and \d as ASCII classes, folds case under i by adding each pattern character's own upper and lower case, and reads & ~ # @ >, an escaped n and the | of an empty alternative as plain characters
oracle:rules-rtdb-r56-regex-classes-runtime (captured 2026-10-27, 40 cases) records production ALLOWING /^\s$/ only on space, tab, line feed, vertical tab, form feed and carriage return and DENYING it on U+00A0, U+2003, U+3000, U+FEFF, U+2028, U+0085 and U+001C (and ALLOWING /^\S$/ on U+00A0); DENYING \w on é and \d on U+0663; under i, ALLOWING k/K, é/É, [a-z]/Q and dotless ı/I and DENYING k against the Kelvin sign and [^a]/A; ALLOWING a&b, a~b, a#b, a@b and a>b as literals and DENYING every near miss; matching the Zod email pattern on a@b.co only; reading \n as the letter n; and matching /^(|a)$/ only on |a. The simulator (rules/rtdb/grammar/regex-parser.ts) matches all 40; unit:rules/rtdb/rules-conformance.test.ts replays them. Found in #1247 stream S1. (Structured evidence: regex-dialect.test.ts)Rules simulatorPyric's load-time check accepts " and < in a regular expression, a ^ inside a character set that is not first, and a $ alone in a set, as production does
oracle:rules-rtdb-r57-deploy-regex-operators (captured 2026-10-27 on pyric-oracle-rtdb-2, 4 dry-run deploy cases) records production ACCEPTING /^a"b$/, /^a<b$/, /^[a^]$/ and /^[$]$/; rtdbRegexError accepts all four. Found in #1247 stream S1. (Structured evidence: rules-rtdb-replay.test.ts)Rules simulatorPyric's load-time check refuses a repeat count past 2^31 - 1 with production's text, Java's For input string: "2147483648"
oracle:rules-rtdb-r58-deploy-regex-count-past-int (captured 2026-10-27 on pyric-oracle-rtdb-2, 1 dry-run deploy case) records production REJECTING /^a{2147483648}$/ with For input string: "2147483648", the text of Java's NumberFormatException, without the "Illegal regular expression" prefix. rules/rtdb/grammar/regex-limits.ts reports the same text. Found in #1247 stream S1. (Structured evidence: rules-rtdb-replay.test.ts, regex-limits.test.ts)Rules simulatorPyric's load-time check refuses a{100000} with production's "could not determinize efficiently" text
oracle:rules-rtdb-r59-deploy-regex-count-100000 (captured 2026-10-27 on pyric-oracle-rtdb-2, 1 dry-run deploy case) records production REJECTING /^a{100000}$/ with "Illegal regular expression, could not determinize efficiently". Production's exact threshold is unobserved: pyric refuses a pattern with more than 10,000 character positions once its repeats are expanded, and every accepted corpus pattern has at most 12. Found in #1247 stream S1. (Structured evidence: rules-rtdb-replay.test.ts, regex-limits.test.ts)Rules simulatorPyric's load-time check refuses (a{1000}){1000} with production's "could not determinize efficiently" text, without building its million states
oracle:rules-rtdb-r60-deploy-regex-repeat-of-repeat (captured 2026-10-27 on pyric-oracle-rtdb-2, 1 dry-run deploy case) records production REJECTING /^(a{1000}){1000}$/ with "Illegal regular expression, could not determinize efficiently". pyric counts positions while it parses and refuses before any matcher is built. Found in #1247 stream S1. (Structured evidence: rules-rtdb-replay.test.ts, regex-limits.test.ts)Rules simulatorrtdbRules(...).simulate(cases) returns coverage: each .read, .write, .validate and .indexOn node is reported as allow, deny, error, mixed, unsupported or never evaluated, with per-outcome counts, per-file and per-kind totals that include unsupported nodes, the indexes a read case's query needed but no node declares, and, given the rules source text, the line of each rule key
unit:rules/rtdb/coverage.test.ts pins a suite that exercises two of three rules (the third is never evaluated), a validate rule that only denied, one that allowed and denied, one that raised at evaluation, a rule the simulator cannot evaluate (status unsupported, counted in the totals so covered, never-evaluated and unsupported nodes sum to the total), a read cascade that stops at a granting ancestor (rules below it stay unevaluated), .indexOn use and missingIndexes derived from a read case's query, a suite that reaches full coverage, per-file totals and line numbers. Coverage is computed from the per-rule evaluation trace, whose agreement with the replayed production verdicts unit:conformance/rules-rtdb-replay.test.ts checks. Rule coverage is Pyric tooling: production reports no rule evaluation record, so there is no production observation to replay.Rules simulatorThe rules tool factories (createFirestoreRulesTools, createFirestoreSimulatorTools, createFirestoreRulesStdlibTools) return handlers typed by Pyric's own ToolHandler, ToolResult and ToolContext from pyric/sandbox/internal; an agent tool registry accepts and dispatches them without casts, and neither pyric nor @pyric/cli depends on an agent runtime
unit:rules-tools/tools.test.ts registers every rules tool in the agent runtime's registry and dispatches calls through it. unit:studio/ai/pyric-tool-types.test.ts asserts at compile time that Pyric's handler and result types are assignable to the agent runtime's, and that the agent's context is assignable to Pyric's, then registers and dispatches the standard library tools. The packaging gate's declaration check fails when a published .d.ts in pyric or @pyric/cli imports a package missing from that package's dependencies or peerDependencies. Tool handler types are Pyric tooling: production has no tool surface, so there is no production observation to replay.Rules simulatorProduction refuses (true ? data.parent() : null).exists() at deploy with "Invalid property access: target is not an object." Pyric's load-time check refuses it with the same message
oracle:rules-rtdb-r62-deploy-ternary-snapshot-member records the refusal. Production deployed it on 2026-10-15, and Pyric's type checker rejects member access on NullableSnapshot (RuleDataSnapshot | null) with the same error. (Structured evidence: rules-rtdb-replay.test.ts)Current gaps
Documented divergences
Known differences between Pyric and production Firebase. Each remains tracked as a non-conforming row.
RulesMocked Storage-to-Firestore lookup evaluation: get/exists return and missing-field errors, repeated and same-resolved-path calls, get+exists composition, and lazy ||/&&/ternary branches with hosted function-call diagnostics
DOCUMENTED MOCK-ORACLE DIVERGENCE, 2026-07-21:
oracle:rules-storage-firestore-lookup-budget matches the local evaluator on 13 of 14 cases and hosted diagnostics prove lazy branches omit lookup calls. The one mismatch is intentional and pinned on both sides: the Rules Test API ALLOWs three distinct mocked exists calls, while the evaluator DENYs the third distinct path to match the separately captured real-resource production contract in row #131. This row remains diverged because its mocked observation is not verdict-identical; it supplies no budget credit. (Structured evidence: rules-oracle-conformance.test.ts)Unverified
Tracked behavior whose available evidence does not yet establish the production result.
Rules simulatorIn multi-document batched writes and transactions, getAfter() on a document the batch updates returns the stored document with the update's field mask applied: fields the update does not name keep their stored values, and a nested map the update names is replaced, not merged.
Unverified, 2026-11-01 (#1322): no capture with this probe's controls backs this row yet. The Rules Test API cannot evaluate
getAfter(). The committed rules-firestore-atomic-batch-sibling-merge observation is a real-database capture from before firestore-real-sibling-merge.ts, with no two-field ALLOW control, and its hostedTestApiLimitation diagnostic records Function not found error: Name: [getAfter]. The weekly re-capture on the oracle project answers DENY for the same case, and that DENY is the same Test API error (Function not found error: Name: [getAfter]), not an answer from a database. The corpus case it replays is also not a batch: it is a single create with a get mock that already holds both fields. The real-database rig's cross-document batch probe (crossDocumentBatch in rules-firestore-get-after-and-exists-after) updates a companion document whose only field is the one the batch changes, so it does not test a field the batch leaves alone. run-firestore-real.ts now adds that case from the plan in firestore-real-sibling-merge.ts: it seeds a companion with role: 'admin' and modified: false, commits a batch that updates only modified beside a create whose rule reads both fields through getAfter(), makes the same create alone as a DENY control, and commits a batch that updates both fields of a second companion as an ALLOW control. The writer refuses to record a capture unless both solo controls answer DENY and the two-field batch answers ALLOW. Its next run writes the batch verdict into the observation's behavior under the corpus case key, and all three verdicts into diagnostics.productionDatabase, which also makes run-rules.ts leave the observation alone. packages/conformance/test/src/firestore-real-sibling-merge.test.ts runs the same plan through LocalEnvironment and compares it with those recorded verdicts. Until the capture lands, the unit-backed assertion in unit:rules/oracle-conformance.test.ts pins the local behavior: a batch update keeps the companion's other fields in getAfter(). (Structured evidence: get-after-batch.test.ts)