From 32781007b455f960e56616142eb0b102b636886a Mon Sep 17 00:00:00 2001 From: Jithin VG Date: Tue, 17 Nov 2026 09:36:30 +0530 Subject: [PATCH 1/3] One detector dialect, read alike by every runtime pact check holds every looks-like line to the detector dialect (loader/looks-like-outside-the-dialect); the TypeScript port and shared conformance cases hold Rust, Python and TypeScript to one answer. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 30 + README.md | 4 +- ...t_every_port_reads_one_detector_dialect.py | 107 + adapters/typescript/read-detectors.mts | 22 + adapters/typescript/src/detectors.ts | 642 ++ crates/pact-loader/src/detecting.rs | 56 + crates/pact-loader/src/dialect.rs | 566 ++ crates/pact-loader/src/lib.rs | 1 + .../tests/detector_dialect_cases.rs | 37 + docs/90-REVIEW.md | 4 +- site-docs/index.md | 2 +- site-docs/status/verified.md | 6 +- spec/schema.yaml | 11 +- tests/conformance/detectors.json | 7033 +++++++++++++++++ 14 files changed, 8512 insertions(+), 9 deletions(-) create mode 100644 adapters/python/tests/test_every_port_reads_one_detector_dialect.py create mode 100644 adapters/typescript/read-detectors.mts create mode 100644 adapters/typescript/src/detectors.ts create mode 100644 crates/pact-loader/src/dialect.rs create mode 100644 crates/pact-loader/tests/detector_dialect_cases.rs create mode 100644 tests/conformance/detectors.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ae8eb4..d541cb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,36 @@ What changed in PACT, newest first. Each entry says what an author can now write, or what now holds that did not; the commits are listed under it for whoever wants the detail. +## 2026-11 — one detector dialect, read alike by every runtime (17 November) + +A workspace's `detectors:` wrote their `looks-like:` patterns as any regular expression Python's `re` +compiled. A runtime written in another language reads them with its own engine, and engines disagree +on lookaround, back-references, `\b` beside non-ASCII letters, `$` before a final newline and what an +empty match steps past, so one tree could hide a card number on one runtime and let it through on +another. + +### What holds now + +- **`pact check` holds every `looks-like:` line to the detector dialect** (spec/schema.yaml, + `detector.looks-like`; `crates/pact-loader/src/dialect.rs`) and refuses the rest with + `loader/looks-like-outside-the-dialect`, naming what the pattern writes and where. The dialect is + what Python's `re` and the Rust `regex` crate both read, with Python's meaning: literals, `.`, `^`, + `$`, `\A`, `\Z`, `\b`, `\B`, the class escapes, `[...]` with ranges, character escapes, groups, + `(?P...)`, `(?i:...)`, `(?m:...)`, `(?s:...)`, alternation and the quantifiers with their lazy + forms. A pattern that can match an empty value is outside it. +- **A TypeScript port** (`adapters/typescript/src/detectors.ts`) translates exactly the patterns in + the dialect to JavaScript that finds what Python's `re` finds, refuses the rest with the checker's + reasons, compiles a workspace's `detectors:` (holding each to its `examples:`) and carries the five + built-in recognisers. +- **Shared cases** (`tests/conformance/detectors.json`): 87 patterns over 68 texts, each in or outside + the dialect with its reason, and every match `re.finditer` yields for the ones in it. The checker + (`detector_dialect_cases.rs`), the reference and the TypeScript port + (`test_every_port_reads_one_detector_dialect.py`) read every case alike. + +A tree whose detector writes a pattern outside the dialect no longer loads: rewrite it in the dialect +(a lookbehind usually becomes a group around the part before, a `(?...)` becomes +`(?P...)`). + ## 2026-11 — a measured figure says how it was measured, and a line is held to its interval (16 November) A figure's `provenance:` said where a number came from but not how much of the benchmark it rests on diff --git a/README.md b/README.md index 225e0cf..5667401 100644 --- a/README.md +++ b/README.md @@ -1001,11 +1001,11 @@ framework is an extra. |---|---| | **Design** | Thesis, 29 binding decisions, FRD (120 requirements), 60-row refusal ledger — complete | | **Research** | 14 source-grounded studies, ~15,750 lines, over 140 repos (~15 GB) + 57 papers | -| **Code** | Loader, diagnostics, schema engine, CLI, harness, resolver, evals, SLO — **5331 tests (1722 Rust + 3609 adapter), clippy clean, TypeScript type-checked** | +| **Code** | Loader, diagnostics, schema engine, CLI, harness, resolver, evals, SLO — **5340 tests (1727 Rust + 3613 adapter), clippy clean, TypeScript type-checked** | | **Adapters** | **All 7 named targets**, proven against one shared conformance suite | ```bash -./scripts/test-all.sh # 5331 tests, Rust + 7 adapters, fully offline +./scripts/test-all.sh # 5340 tests, Rust + 7 adapters, fully offline ``` **What is still owed** is not hidden — it lives in diff --git a/adapters/python/tests/test_every_port_reads_one_detector_dialect.py b/adapters/python/tests/test_every_port_reads_one_detector_dialect.py new file mode 100644 index 0000000..02a6141 --- /dev/null +++ b/adapters/python/tests/test_every_port_reads_one_detector_dialect.py @@ -0,0 +1,107 @@ +"""One detector dialect, read alike by the checker, Python and TypeScript. + +A workspace's `detectors:` write the patterns a thing looks like, and a hiding +rule replaces every value one of them finds. A pattern that Python's `re` and +another runtime's engine read differently hides a value on one runtime and +lets it through on another, so `pact check` holds every `looks-like:` line to +the detector dialect (spec/schema.yaml, `detectors`) and refuses the rest with +`loader/looks-like-outside-the-dialect`. + +`tests/conformance/detectors.json` holds the cases. This suite holds the +reference to them (each pattern in the dialect, compiled by +`detectors.declared_in`, finds exactly the listed matches), the TypeScript +port (`adapters/typescript/src/detectors.ts`, through `read-detectors.mts`: +the same refusals with the same reasons, the same matches), and the checker +(a tree whose detector writes a pattern outside the dialect is refused). The +Rust reader's refusals are held to the same cases by +`crates/pact-loader/tests/detector_dialect_cases.rs`. + +Skips, stated rather than hidden: no `node` able to strip types, and no built +`pact` binary. +""" + +from __future__ import annotations + +import json +import re +import shutil +import subprocess +from pathlib import Path + +import pytest + +from pact_adapters.detectors import declared_in + +REPO = Path(__file__).resolve().parents[3] +HELD = json.loads((REPO / "tests" / "conformance" / "detectors.json").read_text(encoding="utf-8")) +PACT = REPO / "target" / "debug" / "pact" + + +def _expected(case: dict) -> dict: + if case["outside"]: + return {"outside": True, "reason": case["reason"]} + return {"outside": False, "finds": case["finds"]} + + +def test_the_reference_finds_what_every_case_in_the_dialect_lists() -> None: + wrong = [] + for case in HELD["cases"]: + if case["outside"]: + continue + pattern = declared_in({"detectors": {"thing": {"looks-like": [case["looks-like"]]}}})["thing"] + finds = [] + for index, text in enumerate(HELD["texts"]): + found = [match.group(0) for match in re.finditer(pattern, text)] + if found: + finds.append({"in": index, "found": found}) + if finds != case["finds"]: + wrong.append(case["looks-like"]) + assert not wrong, wrong + + +def test_no_case_in_the_dialect_can_match_an_empty_value() -> None: + # The dialect leaves out patterns that can match nothing: Python's re and + # JavaScript step past an empty match differently, so their matches differ. + for case in HELD["cases"]: + if not case["outside"]: + assert all("" not in find["found"] for find in case["finds"]), case["looks-like"] + + +def test_the_typescript_port_reads_every_case_as_held() -> None: + if shutil.which("node") is None: + pytest.skip("node is not on PATH, so the TypeScript port cannot run") + run = subprocess.run( + ["node", "--experimental-strip-types", "--no-warnings", str(REPO / "adapters" / "typescript" / "read-detectors.mts")], + input=json.dumps({"texts": HELD["texts"], "cases": HELD["cases"]}), + capture_output=True, + text=True, + ) + assert run.returncode == 0, run.stderr + port = json.loads(run.stdout) + wrong = [ + case["looks-like"] for case, answer in zip(HELD["cases"], port, strict=True) if answer != _expected(case) + ] + assert not wrong, wrong + + +def test_the_checker_refuses_a_tree_whose_detector_is_outside_the_dialect(tmp_path: Path) -> None: + if not PACT.exists(): + pytest.skip("no built pact binary at target/debug/pact") + case = next(c for c in HELD["cases"] if c["outside"] and c["looks-like"] == "(?<=x)y") + (tmp_path / "workspace.yaml").write_text( + "name: Desk\n" + "detectors:\n" + " order reference:\n" + " description: An order reference.\n" + f" looks-like:\n - {json.dumps(case['looks-like'])}\n" + " examples:\n - xy\n", + encoding="utf-8", + ) + agent = tmp_path / "agents" / "desk" + agent.mkdir(parents=True) + (agent / "agent.yaml").write_text("description: Answers.\ninstructions: Answer.\n", encoding="utf-8") + run = subprocess.run([str(PACT), "check", str(tmp_path)], capture_output=True, text=True) + said = run.stdout + run.stderr + assert run.returncode != 0, said + assert "loader/looks-like-outside-the-dialect" in said, said + assert case["reason"] in said, said diff --git a/adapters/typescript/read-detectors.mts b/adapters/typescript/read-detectors.mts new file mode 100644 index 0000000..7dfc9df --- /dev/null +++ b/adapters/typescript/read-detectors.mts @@ -0,0 +1,22 @@ +// Read every case of `tests/conformance/detectors.json`, given on stdin, with +// the TypeScript port: whether `translateDetectorPattern` refuses the pattern +// and why, and otherwise every match it finds in each text, in order. The +// Python suite compares the answers with the cases, in +// `test_every_port_reads_one_detector_dialect.py`. +import { readFileSync } from "node:fs"; +import { translateDetectorPattern } from "./src/detectors.ts"; + +const given = JSON.parse(readFileSync(0, "utf8")) as { + texts: string[]; + cases: { "looks-like": string }[]; +}; +const answers = given.cases.map((c) => { + const translation = translateDetectorPattern(c["looks-like"]); + if (!translation.ok) return { outside: true, reason: translation.reason }; + const finds = given.texts.flatMap((text, index) => { + const found = [...text.matchAll(new RegExp(translation.source, "gu"))].map((match) => match[0]); + return found.length === 0 ? [] : [{ in: index, found }]; + }); + return { outside: false, finds }; +}); +process.stdout.write(JSON.stringify(answers)); diff --git a/adapters/typescript/src/detectors.ts b/adapters/typescript/src/detectors.ts new file mode 100644 index 0000000..4a1b1d4 --- /dev/null +++ b/adapters/typescript/src/detectors.ts @@ -0,0 +1,642 @@ +// Detectors in TypeScript: the five recognisers every rule can name and the +// ones a workspace declares under `detectors:`, as `detectors.declared_in` and +// `interceptors.RECOGNISES` read them, compiled to JavaScript regular +// expressions that find what Python's `re` finds. +// +// A declared pattern is written in the detector dialect (spec/schema.yaml, +// `detectors`; `crates/pact-loader/src/dialect.rs`): the syntax both Python's +// `re` and the Rust `regex` crate read, with Python's meaning, so one document +// detects the same values on every runtime. `pact check` refuses a pattern +// outside it (`loader/looks-like-outside-the-dialect`), and +// `translateDetectorPattern` refuses the same patterns with the same reasons, +// among them a pattern that can match an empty value, whose matches Python's +// `re` and JavaScript would step past differently. +// The built-in patterns are the reference's own and are translated with +// lookahead allowed, since the card number's dotted form needs it. +// +// Each detector's `examples:` are held to its own pattern when it is compiled, +// so a pattern that misses the example its author wrote stops the run before +// it starts. +// +// `tests/conformance/detectors.json` holds this port and Python's `re` to the +// same matches (`test_every_port_reads_one_detector_dialect.py`, through +// `read-detectors.mts`). +/** One entry of a workspace's `detectors:`, as `pact show` prints it. */ +export interface Detector { + /** The patterns the thing looks like: one line, or several, each in the detector dialect. */ + "looks-like"?: string | readonly string[]; + /** Values the patterns must find. */ + examples?: string | readonly string[]; + /** What the thing is, for a person. */ + description?: string; +} + +/** + * The five built-in recognisers, by name, exactly as the reference adapter writes them + * (`interceptors.RECOGNISES`, Python syntax). + */ +export const PACT_BUILT_IN_DETECTOR_PATTERNS: Readonly> = Object.freeze({ + "card number": String.raw`\b(?:\d[ \u00a0\u2007\u2009\u202f-]*?){12,}\d\b|\b(?=(?:\d\.?){13,}\b)\d+(?:\.\d+){2,}\b`, + "bank account": String.raw`(?i:\b[A-Z]{2}\d{2}(?:[ ][A-Z0-9]{4}){2,7}(?:[ ][A-Z0-9]{1,3})?\b)|(?i:\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b)|\b\d{2}[- ]\d{2}[- ]\d{2}\b|\b\d{8,17}\b`, + "email address": String.raw`\b[\w.+-]+@[\w-]+\.[\w.-]+\b`, + "phone number": String.raw`\+?\d(?:[ ()-]*\d){9,}`, + "social security number": String.raw`\b(?:\d{3}-\d{2}-\d{4}|\d{3} \d{2} \d{4}|\d{9})\b`, +}); + +/** + * Why a detector cannot be compiled: + * - `outside-dialect`: a `looks-like:` line writes syntax outside the detector dialect, or is not a pattern. + * - `misses-example`: the detector's pattern does not find one of its own `examples:`. + */ +export type PactDetectorErrorCode = "outside-dialect" | "misses-example"; + +/** A detector that cannot be compiled; callers switch on {@link PactDetectorError.code}. */ +export class PactDetectorError extends Error { + /** Which failure this is. */ + readonly code: PactDetectorErrorCode; + /** The detector's name as the workspace writes it. */ + readonly detector: string; + + /** + * @param code - which failure this is. + * @param detector - the detector's name. + * @param message - the sentence naming the detector, what is wrong and what to change. + */ + constructor(code: PactDetectorErrorCode, detector: string, message: string) { + super(message); + this.name = "PactDetectorError"; + this.code = code; + this.detector = detector; + } +} + +/** A translated pattern: the JavaScript source (compiled with the `u` flag), or why it is outside the dialect. */ +export type PactDetectorTranslation = + | { readonly ok: true; readonly source: string; } + | { readonly ok: false; readonly reason: string; readonly at: number; }; + +/** Python's whitespace (`str.isspace()`), the meaning of `\s`, as class members. */ +const SPACE_MEMBERS = String.raw`\t-\r\u{1c}-\u{20}\u{85}\u{a0}\u{1680}\u{2000}-\u{200a}\u{2028}\u{2029}\u{202f}\u{205f}\u{3000}`; +/** Python's word characters (`str.isalnum()` or `_`), the meaning of `\w`, as class members. */ +const WORD_MEMBERS = String.raw`\p{L}\p{N}_`; +/** Python's decimal digits, the meaning of `\d`, as class members. */ +const DIGIT_MEMBERS = String.raw`\p{Nd}`; +const WORD = `[${WORD_MEMBERS}]`; +const ANY = String.raw`[\s\S]`; + +/** The class escapes, each with its members and whether it is the complement of them. */ +const CLASS_ESCAPES: Readonly> = { + d: { members: DIGIT_MEMBERS, negated: false }, + D: { members: DIGIT_MEMBERS, negated: true }, + w: { members: WORD_MEMBERS, negated: false }, + W: { members: WORD_MEMBERS, negated: true }, + s: { members: SPACE_MEMBERS, negated: false }, + S: { members: SPACE_MEMBERS, negated: true }, +}; + +/** The single-character escapes both readers share, by letter. */ +const CHARACTER_ESCAPES: Readonly> = { n: 0x0a, t: 0x09, r: 0x0d, f: 0x0c, v: 0x0b, a: 0x07 }; + +/** Python's `re` refuses a repetition count from this one up (`sre_constants.MAXREPEAT`). */ +const PYTHON_MAX_REPEAT = 4_294_967_295; + +/** Characters JavaScript's `u` mode reads as syntax outside a class. */ +const SYNTAX = new Set("^$\\.*+?()[]{}|/"); +/** Characters escaped inside a class. */ +const CLASS_SYNTAX = new Set("\\]-[^"); + +/** Flags a group may set. */ +interface Flags { + readonly i: boolean; + readonly m: boolean; + readonly s: boolean; +} + +class OutsideDialect extends Error { + readonly reason: string; + readonly at: number; + + constructor(reason: string, at: number) { + super(reason); + this.reason = reason; + this.at = at; + } +} + +function hexOf(code: number): string { + return `\\u{${code.toString(16)}}`; +} + +/** One code point as a literal outside a class. */ +function literal(code: number): string { + const char = String.fromCodePoint(code); + if (SYNTAX.has(char)) return `\\${char}`; + return code < 0x20 || code > 0x7e ? hexOf(code) : char; +} + +/** One code point as a class member. */ +function member(code: number): string { + const char = String.fromCodePoint(code); + if (CLASS_SYNTAX.has(char)) return `\\${char}`; + return code < 0x20 || code > 0x7e ? hexOf(code) : char; +} + +/** + * The pairs Python's `re` treats as one letter under `(?i:...)` beyond lower-casing (`sre_compile._equivalences`): + * dotless i, long s, micro sign, the Greek symbol variants, final sigma and two ligatures. + */ +const PYTHON_CASE_EQUIVALENCES: readonly (readonly number[])[] = [ + [0x69, 0x131], [0x73, 0x17f], [0xb5, 0x3bc], [0x345, 0x3b9, 0x1fbe], [0x390, 0x1fd3], [0x3b0, 0x1fe3], [0x3b2, 0x3d0], + [0x3b5, 0x3f5], [0x3b8, 0x3d1], [0x3ba, 0x3f0], [0x3c0, 0x3d6], [0x3c1, 0x3f1], [0x3c2, 0x3c3], [0x3c6, 0x3d5], + [0x1e61, 0x1e9b], [0xfb05, 0xfb06], +]; + +/** The highest code point with a lower-case form; every cased letter of Unicode sits below it. */ +const LAST_CASED = 0x1e943; + +/** One code point's lower-case form, when that is one code point; otherwise the code point itself. */ +function lowerOf(code: number): number { + const lower = String.fromCodePoint(code).toLowerCase(); + const first = lower.codePointAt(0) as number; + return lower.length === (first > 0xffff ? 2 : 1) ? first : code; +} + +let byLower: ReadonlyMap | undefined; + +/** Every code point by its lower-case form, built on first use. */ +function codesByLower(): ReadonlyMap { + if (byLower !== undefined) return byLower; + const map = new Map(); + for (let code = 0; code <= LAST_CASED; code += 1) { + const lower = lowerOf(code); + if (lower === code) continue; + const list = map.get(lower) ?? [lower]; + list.push(code); + map.set(lower, list); + } + byLower = map; + return map; +} + +/** + * The code points one character is matched as under `(?i:...)`, as Python's `re` matches them: every code point + * with the same lower-case form, and the members of its equivalence pair. + */ +function caseForms(code: number): number[] { + const forms = new Set([code]); + const lowers = new Set([lowerOf(code)]); + for (const group of PYTHON_CASE_EQUIVALENCES) { + if (group.includes(lowerOf(code))) for (const member of group) lowers.add(member); + } + for (const lower of lowers) { + forms.add(lower); + for (const form of codesByLower().get(lower) ?? []) forms.add(form); + } + return [...forms].sort((a, b) => a - b); +} + +/** One parsed class item. */ +type ClassItem = + | { readonly kind: "char"; readonly code: number; } + | { readonly kind: "range"; readonly from: number; readonly to: number; } + | { readonly kind: "escape"; readonly members: string; readonly negated: boolean; }; + +/** Translated JavaScript, and whether it can match an empty value. */ +interface Piece { + readonly source: string; + readonly empty: boolean; +} + +/** One translated atom: whether a quantifier may follow it, and whether it can match an empty value. */ +interface Atom extends Piece { + readonly repeatable: boolean; +} + +/** A reader of one pattern, emitting JavaScript as it goes. */ +class Translator { + private at = 0; + private readonly names = new Set(); + + private readonly pattern: string; + private readonly lookaround: boolean; + + constructor(pattern: string, lookaround: boolean) { + this.pattern = pattern; + this.lookaround = lookaround; + } + + translate(): string { + const whole = this.alternation({ i: false, m: false, s: false }); + if (this.at < this.pattern.length) this.refuse("a `)` that closes no group; write `\\)` for the character"); + if (whole.empty) this.refuse("a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character", 0); + return whole.source; + } + + private refuse(reason: string, at = this.at): never { + throw new OutsideDialect(reason, at); + } + + private peek(offset = 0): string | undefined { + return this.pattern[this.at + offset]; + } + + private startsWith(text: string): boolean { + return this.pattern.startsWith(text, this.at); + } + + /** Alternatives: empty when one of them can match an empty value. */ + private alternation(flags: Flags): Piece { + const branches = [this.sequence(flags)]; + while (this.peek() === "|") { + this.at += 1; + branches.push(this.sequence(flags)); + } + return { source: branches.map((branch) => branch.source).join("|"), empty: branches.some((branch) => branch.empty) }; + } + + /** Atoms in a row: empty when all of them can match an empty value. */ + private sequence(flags: Flags): Piece { + let source = ""; + let empty = true; + for (;;) { + const char = this.peek(); + if (char === undefined || char === "|" || char === ")") return { source, empty }; + const start = this.at; + const atom = this.atom(flags); + if (atom.repeatable) { + const quantifier = this.quantifier(); + source += atom.source + quantifier.text; + empty &&= atom.empty || quantifier.none; + } else { + source += atom.source; + empty &&= atom.empty; + if (this.quantifierAhead()) this.refuse("a quantifier after something that is no character or group", start); + } + } + } + + private quantifierAhead(): boolean { + const char = this.peek(); + return char === "*" || char === "+" || char === "?" || (char === "{" && this.braceQuantifier() !== undefined); + } + + /** A `{n}`, `{n,}` or `{n,m}` at the cursor: its text, or undefined when the brace is no quantifier. */ + private braceQuantifier(): string | undefined { + const match = /^\{(\d*)(,?)(\d*)\}/.exec(this.pattern.slice(this.at)); + if (match === null) return undefined; + const [text, low = "", comma = "", high = ""] = match; + if (low === "" && comma === "") return undefined; + if (low === "") this.refuse("a `{,m}` quantifier with no lower bound, which the Rust regex crate does not read; write `{0,m}`"); + if (high !== "" && Number(high) < Number(low)) this.refuse(`a quantifier \`${text}\` whose upper bound is below its lower bound`); + if (Number(low) >= PYTHON_MAX_REPEAT || (high !== "" && Number(high) >= PYTHON_MAX_REPEAT)) this.refuse(`a quantifier \`${text}\` above the largest repetition count Python's re reads`); + return text; + } + + /** The quantifier at the cursor, if any, and whether it allows no repeat. */ + private quantifier(): { readonly text: string; readonly none: boolean } { + let out = ""; + let none: boolean; + const char = this.peek(); + if (char === "*" || char === "+" || char === "?") { + out = char; + none = char !== "+"; + this.at += 1; + } else if (char === "{") { + const brace = this.braceQuantifier(); + if (brace === undefined) return { text: "", none: false }; + out = brace; + none = Number(/^\{(\d*)/.exec(brace)?.[1]) === 0; + this.at += brace.length; + } else { + return { text: "", none: false }; + } + if (this.peek() === "?") { + out += "?"; + this.at += 1; + } else if (this.peek() === "+") { + this.refuse("a possessive quantifier, which the Rust regex crate does not read"); + } + if (this.quantifierAhead()) this.refuse("two quantifiers in a row; put the first in a group `(?:...)`"); + return { text: out, none }; + } + + private atom(flags: Flags): Atom { + const char = this.peek() as string; + if (char === "(") return this.group(flags); + if (char === "[") return { source: this.characterClass(flags), repeatable: true, empty: false }; + if (char === "*" || char === "+" || char === "?") this.refuse("a quantifier with nothing before it to repeat"); + if (char === "{") { + if (this.braceQuantifier() !== undefined) this.refuse("a quantifier with nothing before it to repeat"); + this.refuse("a `{` that is no quantifier; write `\\{` for the character"); + } + this.at += 1; + switch (char) { + case ".": return { source: flags.s ? ANY : String.raw`[^\n]`, repeatable: true, empty: false }; + case "^": return { source: flags.m ? String.raw`(? 0xffff) this.at += 1; + return { source: this.character(code, flags), repeatable: true, empty: false }; + } + } + } + + private character(code: number, flags: Flags): string { + if (!flags.i) return literal(code); + const forms = caseForms(code); + return forms.length === 1 ? literal(code) : `[${forms.map(member).join("")}]`; + } + + private group(flags: Flags): Atom { + const start = this.at; + if (this.startsWith("(?P<")) { + const match = /^\(\?P<([A-Za-z_][A-Za-z0-9_]*)>/.exec(this.pattern.slice(this.at)); + if (match === null) this.refuse("a group name that is not a letter or `_` followed by letters, digits or `_`"); + const name = match[1] as string; + if (this.names.has(name)) this.refuse(`the group name \`${name}\` written twice`); + this.names.add(name); + this.at += match[0].length; + const inner = this.closed(flags, start); + return { source: `(?<${name}>${inner.source})`, repeatable: true, empty: inner.empty }; + } + for (const opener of ["(?=", "(?!", "(?<=", "(?")) this.refuse("a back-reference to a named group, which the Rust regex crate does not read"); + if (this.startsWith("(?#")) this.refuse("a comment group, which the Rust regex crate does not read"); + if (this.startsWith("(?>")) this.refuse("an atomic group, which the Rust regex crate does not read"); + if (this.startsWith("(?(")) this.refuse("a conditional group, which neither the Rust regex crate nor the PACT dialect reads"); + if (this.startsWith("(?<")) this.refuse("a named group written `(?...)`, which Python's re refuses; write `(?P...)`"); + if (this.startsWith("(?:")) { + this.at += 3; + const inner = this.closed(flags, start); + return { source: `(?:${inner.source})`, repeatable: true, empty: inner.empty }; + } + if (this.startsWith("(?")) { + const match = /^\(\?([a-zA-Z-]*)([:)])/.exec(this.pattern.slice(this.at)); + if (match === null) this.refuse("a `(?` that opens no group the dialect reads"); + const [, letters = "", end = ""] = match; + if (end === ")") this.refuse("a flag for the whole pattern, which the reference adapter cannot read inside a detector; write `(?i:...)` around the part it applies to"); + if (letters.includes("-")) this.refuse("a group that turns a flag off, which the PACT dialect does not read"); + for (const letter of letters) { + if (letter !== "i" && letter !== "m" && letter !== "s") this.refuse(`the flag \`${letter}\`, which the PACT dialect does not read; it reads \`i\`, \`m\` and \`s\``); + } + this.at += match[0].length; + const scoped = { i: flags.i || letters.includes("i"), m: flags.m || letters.includes("m"), s: flags.s || letters.includes("s") }; + const inner = this.closed(scoped, start); + return { source: `(?:${inner.source})`, repeatable: true, empty: inner.empty }; + } + this.at += 1; + const inner = this.closed(flags, start); + return { source: `(${inner.source})`, repeatable: true, empty: inner.empty }; + } + + private closed(flags: Flags, start: number): Piece { + const inner = this.alternation(flags); + if (this.peek() !== ")") this.refuse("a group that is never closed", start); + this.at += 1; + return inner; + } + + /** The code point a character escape names, or undefined when the escape is no character. */ + private escapedCode(letter: string): number | undefined { + const fixed = CHARACTER_ESCAPES[letter]; + if (fixed !== undefined) { + this.at += 1; + return fixed; + } + const digits = letter === "x" ? 2 : letter === "u" ? 4 : letter === "U" ? 8 : 0; + if (digits > 0) { + const hex = this.pattern.slice(this.at + 1, this.at + 1 + digits); + if (!new RegExp(`^[0-9A-Fa-f]{${String(digits)}}$`).test(hex)) this.refuse(`\`\\${letter}\` followed by other than ${String(digits)} hexadecimal digits`); + const code = Number.parseInt(hex, 16); + if (code > 0x10ffff) this.refuse(`\`\\${letter}${hex}\`, which is no character`); + this.at += 1 + digits; + return code; + } + if (/^[\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]$/.test(letter)) { + this.at += 1; + return letter.codePointAt(0); + } + return undefined; + } + + private refuseEscape(letter: string | undefined): never { + if (letter === undefined) this.refuse("a `\\` that ends the pattern"); + if (/^[0-9]$/.test(letter)) this.refuse(`\`\\${letter}\`, a back-reference or an octal escape, which the Rust regex crate does not read`); + this.refuse(`the escape \`\\${letter}\`, which Python's re and the Rust regex crate do not read alike`); + } + + private escape(flags: Flags): Atom { + const letter = this.peek(); + const assertion: Readonly> = { + b: `(?:(?<=${WORD})(?!${WORD})|(? 0xffff ? 2 : 1; + return { kind: "char", code }; + } + + private characterClass(flags: Flags): string { + const start = this.at; + this.at += 1; + const negated = this.peek() === "^"; + if (negated) this.at += 1; + const items: ClassItem[] = []; + let first = true; + for (;;) { + const char = this.peek(); + if (char === undefined) this.refuse("a class `[` that is never closed", start); + if (char === "]" && !first) break; + first = false; + if (char === "]") { + this.at += 1; + items.push({ kind: "char", code: 0x5d }); + continue; + } + const item = this.classItem(); + if (this.startsWith("--")) this.refuse("`--` inside a class, which the Rust regex crate reads as a set operation; escape one of the two"); + const dash = this.peek() === "-" && this.peek(1) !== "]" && this.peek(1) !== undefined; + if (!dash) { + items.push(item); + continue; + } + const dashAt = this.at; + this.at += 1; + const end = this.classItem(); + if (item.kind !== "char" || end.kind !== "char") this.refuse("a range whose end is a class such as `\\d`", dashAt); + if (end.code < item.code) this.refuse("a range whose end comes before its start", dashAt); + items.push({ kind: "range", from: item.code, to: end.code }); + } + this.at += 1; + return this.emitClass(items, negated, flags); + } + + private rangeMembers(from: number, to: number, ignoreCase: boolean): string[] { + const out = [from === to ? member(from) : `${member(from)}-${member(to)}`]; + if (!ignoreCase) return out; + if (to > 0x7f) this.refuse("a range of letters beyond ASCII inside `(?i:...)`, which the PACT dialect does not read; list the letters"); + const forms = new Set(); + for (let code = from; code <= to; code += 1) { + for (const form of caseForms(code)) if (form < from || form > to) forms.add(form); + } + return [...out, ...[...forms].sort((a, b) => a - b).map(member)]; + } + + private emitClass(items: readonly ClassItem[], negated: boolean, flags: Flags): string { + const members: string[] = []; + const complements: string[] = []; + for (const item of items) { + if (item.kind === "escape") { + if (item.negated) complements.push(item.members); + else members.push(item.members); + } else if (item.kind === "range") { + members.push(...this.rangeMembers(item.from, item.to, flags.i)); + } else { + members.push(...(flags.i ? caseForms(item.code) : [item.code]).map(member)); + } + } + const own = members.join(""); + if (complements.length === 0) return `[${negated ? "^" : ""}${own}]`; + if (!negated) return `(?:${[...own === "" ? [] : [`[${own}]`], ...complements.map(set => `[^${set}]`)].join("|")})`; + const [last, ...rest] = complements as [string, ...string[]]; + return `(?:${own === "" ? "" : `(?![${own}])`}${rest.map(set => `(?=[${set}])`).join("")}[${last}])`; + } +} + +/** + * Translate one pattern of the detector dialect to JavaScript. + * @param pattern - the pattern in Python syntax. + * @param options - `lookaround: true` reads lookahead and lookbehind too, as the built-in patterns need. + * @returns the JavaScript source to compile with the `u` flag, or the reason and position the pattern is outside the + * dialect. + * @example + * translateDetectorPattern("ORD-[0-9]{8}") // { ok: true, source: "ORD-[0-9]{8}" } + * translateDetectorPattern("(?<=x)y") // { ok: false, reason: "a lookaround …", at: 0 } + */ +export function translateDetectorPattern(pattern: string, options: { readonly lookaround?: boolean; } = {}): PactDetectorTranslation { + try { + return { ok: true, source: new Translator(pattern, options.lookaround === true).translate() }; + } catch (error: unknown) { + if (!(error instanceof OutsideDialect)) throw error; + return { ok: false, reason: error.reason, at: error.at }; + } +} + +function compiled(source: string): RegExp { + return new RegExp(source, "u"); +} + +/** The built-in recognisers, compiled once. */ +const BUILT_IN: ReadonlyMap = new Map(Object.entries(PACT_BUILT_IN_DETECTOR_PATTERNS).map(([name, pattern]) => { + const translation = translateDetectorPattern(pattern, { lookaround: true }); + if (!translation.ok) throw new Error(`the built-in detector '${name}' is outside the dialect: ${translation.reason}`); + return [name, compiled(translation.source)]; +})); + +/** The detectors one workspace can name: its declared ones, then the built-in ones. */ +export interface PactDetectorSet { + /** + * The compiled pattern of a detector by name, compared as the reference compares it: trimmed and lower-cased, + * a declared detector before a built-in one of the same name. + * @param name - the name a `looks-like:` writes. + * @returns the pattern, or undefined when nothing here knows the name. + */ + pattern(name: string): RegExp | undefined; + /** The names the workspace declares, trimmed and lower-cased, in written order. */ + readonly declared: readonly string[]; +} + +/** The set with no declared detectors: the five built-in ones. */ +export const PACT_BUILT_IN_DETECTORS: PactDetectorSet = Object.freeze({ + pattern: (name: string) => BUILT_IN.get(name.trim().toLowerCase()), + declared: Object.freeze([]), +}); + +function texts(value: string | readonly string[] | undefined): string[] { + if (value === undefined) return []; + return (Array.isArray(value) ? value : [value]).map(item => String(item)); +} + +/** + * Compile a workspace's `detectors:` as `detectors.declared_in` reads them: each detector's non-blank `looks-like:` + * lines joined into one pattern (`(?:a)|(?:b)`), held to the dialect and to its own `examples:`. A detector that + * writes no non-blank pattern is skipped, as the reference skips it. + * @param detectors - the workspace's `detectors:`, or undefined. + * @returns the set that answers the declared names and the built-in ones. + * @throws {PactDetectorError} `outside-dialect` for a line outside the dialect, `misses-example` for an example the + * pattern does not find. + * @example + * const set = compileDetectors({ + * "order reference": { description: "An order", "looks-like": ["ORD-[0-9]{8}"], examples: ["ORD-12345678"] }, + * }) + * set.pattern("Order Reference")?.test("see ORD-12345678") // true + */ +export function compileDetectors(detectors: Readonly> | undefined): PactDetectorSet { + const declared = new Map(); + for (const [name, body] of Object.entries(detectors ?? {})) { + const lines = texts(body["looks-like"]).filter(line => line.trim() !== ""); + if (lines.length === 0) continue; + const joined = lines.map(line => `(?:${line})`).join("|"); + const translation = translateDetectorPattern(joined); + if (!translation.ok) { + throw new PactDetectorError("outside-dialect", name, `the detector '${name}' looks like a pattern outside the detector dialect: ${translation.reason} (at character ${String(translation.at + 1)} of \`${joined}\`). Fix its \`looks-like:\` lines.`); + } + // The translation is valid JavaScript for every pattern the dialect reads, so compiling it cannot fail. + const pattern = compiled(translation.source); + for (const example of texts(body.examples)) { + if (!pattern.test(example)) { + throw new PactDetectorError("misses-example", name, `the detector '${name}' does not recognise its own example '${example}', so it would let that value through. Fix its \`looks-like:\` lines, or the example.`); + } + } + declared.set(name.trim().toLowerCase(), pattern); + } + return Object.freeze({ + pattern: (name: string) => { + const key = name.trim().toLowerCase(); + return declared.get(key) ?? BUILT_IN.get(key); + }, + declared: Object.freeze([...declared.keys()]), + }); +} diff --git a/crates/pact-loader/src/detecting.rs b/crates/pact-loader/src/detecting.rs index f56eaa7..177a84a 100644 --- a/crates/pact-loader/src/detecting.rs +++ b/crates/pact-loader/src/detecting.rs @@ -5,6 +5,7 @@ //! | `loader/effect-of-no-call` | `effect:` on a condition that looks at a value; it is about the call a `tool:` line names | //! | `loader/a-value-word-on-a-call` | `in-share:` or `looks-like:` on a condition that looks at a call (`tool:`); both read a value | //! | `loader/looks-like-nothing-known` | `looks-like:` names neither a built-in recogniser nor one of `detectors:` | +//! | `loader/looks-like-outside-the-dialect` | a `detectors:` entry's `looks-like:` pattern is outside the detector dialect ([`crate::dialect`]) | //! //! Where a hiding SENTENCE names a detector, the schema's sentence check //! resolves it (`pact-schema`, the `` hole). This holds the condition @@ -32,6 +33,61 @@ pub fn check(root: &Node, diags: &mut Diagnostics) { .map(|m| m.keys().cloned().collect()) .unwrap_or_default(); walk(root, &declared, diags); + if let Some(detectors) = root.get("detectors").and_then(Node::as_map) { + for (name, entry) in detectors { + patterns_of(name, &entry.node, diags); + } + } +} + +/// Hold one declared detector's `looks-like:` lines to the dialect: each line +/// on its own, so the message points at it, and then the lines joined as every +/// runtime joins them, which only a group name written in two lines fails. +fn patterns_of(name: &str, detector: &Node, diags: &mut Diagnostics) { + let Some(written) = detector.get("looks-like") else { + return; + }; + let lines: Vec<&Node> = match written.as_list() { + Some(items) => items.iter().collect(), + None => vec![written], + }; + let mut texts = Vec::new(); + for line in lines { + let Some(text) = line.as_str() else { + continue; + }; + if let Some(outside) = crate::dialect::outside(text) { + diags.push(outside_the_dialect(name, text, &outside, line.span.clone())); + return; + } + texts.push(text); + } + let joined = crate::dialect::joined(&texts); + if let Some(outside) = crate::dialect::outside(&joined) { + diags.push(outside_the_dialect(name, &joined, &outside, written.span.clone())); + } +} + +fn outside_the_dialect( + name: &str, + pattern: &str, + outside: &crate::dialect::Outside, + span: pact_diag::Span, +) -> Diagnostic { + Diagnostic::error( + "loader/looks-like-outside-the-dialect", + span, + format!( + "The detector '{name}' looks like `{pattern}`, which writes {} (at character {}). \ + Python and the Rust regex crate would not detect the same values with it.", + outside.reason, + outside.at + 1 + ), + "Write the pattern in the detector dialect: literals, `.`, `^`, `$`, `\\b`, `\\d \\w \\s` \ + and their capitals, `[...]`, `(?:...)`, `(?P...)`, `(?i:...)`, alternation and \ + `* + ? {n} {n,} {n,m}` (spec/schema.yaml, `detectors`)." + .to_string(), + ) } fn walk(node: &Node, declared: &[String], diags: &mut Diagnostics) { diff --git a/crates/pact-loader/src/dialect.rs b/crates/pact-loader/src/dialect.rs new file mode 100644 index 0000000..f54c46a --- /dev/null +++ b/crates/pact-loader/src/dialect.rs @@ -0,0 +1,566 @@ +//! **The detector dialect**: which patterns a `detectors:` entry may write +//! under `looks-like:`, so that one document detects the same values on every +//! runtime. +//! +//! A pattern is in the dialect when Python's `re` and the Rust `regex` crate +//! both read it, and it means what Python's `re` makes of it; the TypeScript +//! port (`adapters/typescript/src/detectors.ts`) translates exactly these +//! patterns to JavaScript. The dialect has literals, `.`, `^`, `$`, `\A`, +//! `\Z`, `\b`, `\B`, the classes `\d \D \w \W \s \S` (in their Unicode +//! meaning) and `[...]` with ranges, the escapes `\n \t \r \f \v \a \xHH +//! \uHHHH \UHHHHHHHH` and escaped ASCII punctuation, groups `(...)`, +//! `(?:...)`, `(?P...)`, flag groups `(?i:...)`, `(?m:...)`, +//! `(?s:...)`, alternation, and the quantifiers `* + ? {n} {n,} {n,m}` with +//! their lazy forms. +//! +//! A pattern that can match an empty value is outside it too: it would find +//! something in every text, and Python's `re` and JavaScript step past an +//! empty match differently, so they would not find the same values. +//! +//! Everything else is outside it, and [`outside`] says why: lookaround, +//! back-references, octal escapes, possessive and open-below (`{,m}`) +//! quantifiers, atomic and conditional groups, comments, flags for the whole +//! pattern, flags turned off, nested classes and class set operations, a `{` +//! that is no quantifier, Unicode property escapes, and a range of letters +//! beyond ASCII inside `(?i:...)`. Each of those is either read differently by +//! the two engines or not read by one of them, so a tree that wrote one would +//! hide a value on one runtime and let it through on another. +//! +//! The shared cases are `tests/conformance/detectors.json`. + +/// Python's `re` refuses a repetition count from this one up +/// (`sre_constants.MAXREPEAT`). +const PYTHON_MAX_REPEAT: u64 = 4_294_967_295; + +/// Why a pattern is outside the dialect, and the character (counted from 0, +/// in Unicode scalar values) where the reader stopped. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Outside { + /// What the pattern writes and why the dialect does not read it. + pub reason: String, + /// The character the reader stopped at. + pub at: usize, +} + +/// Why `pattern` is outside the detector dialect, or `None` when it is in it. +#[must_use] +pub fn outside(pattern: &str) -> Option { + let mut reader = Reader { + chars: pattern.chars().collect(), + at: 0, + names: Vec::new(), + }; + reader.pattern().err() +} + +/// One whole pattern's detectors as `detectors.declared_in` joins them: each +/// non-blank `looks-like:` line in its own `(?:...)`, joined by `|`. +#[must_use] +pub fn joined(lines: &[&str]) -> String { + lines + .iter() + .filter(|line| !line.trim().is_empty()) + .map(|line| format!("(?:{line})")) + .collect::>() + .join("|") +} + +/// What one class item is: a character, which may start or end a range, or a +/// class escape such as `\d`, which may not. +#[derive(Clone, Copy)] +enum Item { + Char(u32), + Set, +} + +/// What one atom is to the atoms around it. +#[derive(Clone, Copy)] +struct Atom { + /// A quantifier may follow it. + repeatable: bool, + /// It can match an empty value. + empty: bool, +} + +impl Atom { + /// A character or a class: one character, repeatable. + const CHARACTER: Self = Self { repeatable: true, empty: false }; + /// `^`, `$`, `\b` and the like: no character, and nothing to repeat. + const ASSERTION: Self = Self { repeatable: false, empty: true }; + + /// A group, repeatable, empty when its alternatives can be. + fn group(empty: bool) -> Self { + Self { repeatable: true, empty } + } +} + +struct Reader { + chars: Vec, + at: usize, + names: Vec, +} + +type Read = Result; + +impl Reader { + fn refuse(&self, reason: impl Into) -> Read { + self.refuse_at(reason, self.at) + } + + fn refuse_at(&self, reason: impl Into, at: usize) -> Read { + Err(Outside { reason: reason.into(), at }) + } + + fn peek(&self, offset: usize) -> Option { + self.chars.get(self.at + offset).copied() + } + + fn starts_with(&self, text: &str) -> bool { + let mut i = self.at; + for c in text.chars() { + if self.chars.get(i) != Some(&c) { + return false; + } + i += 1; + } + true + } + + fn pattern(&mut self) -> Read<()> { + let empty = self.alternation(false)?; + if self.at < self.chars.len() { + return self.refuse("a `)` that closes no group; write `\\)` for the character"); + } + if empty { + return self.refuse_at( + "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character", + 0, + ); + } + Ok(()) + } + + /// Alternatives; `true` when one of them can match an empty value. + fn alternation(&mut self, ignore_case: bool) -> Read { + let mut empty = self.sequence(ignore_case)?; + while self.peek(0) == Some('|') { + self.at += 1; + empty |= self.sequence(ignore_case)?; + } + Ok(empty) + } + + /// Atoms in a row; `true` when all of them can match an empty value. + fn sequence(&mut self, ignore_case: bool) -> Read { + let mut empty = true; + loop { + match self.peek(0) { + None | Some('|' | ')') => return Ok(empty), + Some(_) => {} + } + let start = self.at; + let atom = self.atom(ignore_case)?; + let mut atom_empty = atom.empty; + if atom.repeatable { + atom_empty |= self.quantifier()?; + } else if self.quantifier_ahead()? { + return self.refuse_at("a quantifier after something that is no character or group", start); + } + empty &= atom_empty; + } + } + + fn quantifier_ahead(&self) -> Read { + Ok(match self.peek(0) { + Some('*' | '+' | '?') => true, + Some('{') => self.brace_quantifier()?.is_some(), + _ => false, + }) + } + + /// A `{n}`, `{n,}` or `{n,m}` at the cursor: how many characters it takes + /// and its lower bound, or `None` when the brace is no quantifier. + fn brace_quantifier(&self) -> Read> { + let mut i = self.at + 1; + let digits = |i: &mut usize| { + let from = *i; + while self.chars.get(*i).is_some_and(char::is_ascii_digit) { + *i += 1; + } + self.chars[from..*i].iter().collect::() + }; + let low = digits(&mut i); + let comma = self.chars.get(i) == Some(&','); + if comma { + i += 1; + } + let high = digits(&mut i); + if self.chars.get(i) != Some(&'}') || (low.is_empty() && !comma) { + return Ok(None); + } + let text: String = self.chars[self.at..=i].iter().collect(); + if low.is_empty() { + return self.refuse( + "a `{,m}` quantifier with no lower bound, which the Rust regex crate does not read; write `{0,m}`", + ); + } + let count = |digits: &str| digits.parse::().unwrap_or(u64::MAX); + if !high.is_empty() && count(&high) < count(&low) { + return self.refuse(format!("a quantifier `{text}` whose upper bound is below its lower bound")); + } + if count(&low) >= PYTHON_MAX_REPEAT || (!high.is_empty() && count(&high) >= PYTHON_MAX_REPEAT) { + return self.refuse(format!( + "a quantifier `{text}` above the largest repetition count Python's re reads" + )); + } + Ok(Some((i + 1 - self.at, count(&low)))) + } + + /// The quantifier at the cursor, if any; `true` when it allows no repeat. + fn quantifier(&mut self) -> Read { + let none = match self.peek(0) { + Some(c @ ('*' | '+' | '?')) => { + self.at += 1; + c != '+' + } + Some('{') => match self.brace_quantifier()? { + Some((taken, low)) => { + self.at += taken; + low == 0 + } + None => return Ok(false), + }, + _ => return Ok(false), + }; + if self.peek(0) == Some('?') { + self.at += 1; + } else if self.peek(0) == Some('+') { + return self.refuse("a possessive quantifier, which the Rust regex crate does not read"); + } + if self.quantifier_ahead()? { + return self.refuse("two quantifiers in a row; put the first in a group `(?:...)`"); + } + Ok(none) + } + + /// One atom: whether a quantifier may follow it, and whether it can match + /// an empty value. + fn atom(&mut self, ignore_case: bool) -> Read { + let Some(c) = self.peek(0) else { + return Ok(Atom::ASSERTION); + }; + match c { + '(' => self.group(ignore_case), + '[' => self.class(ignore_case).map(|()| Atom::CHARACTER), + '*' | '+' | '?' => self.refuse("a quantifier with nothing before it to repeat"), + '{' => { + if self.brace_quantifier()?.is_some() { + return self.refuse("a quantifier with nothing before it to repeat"); + } + self.refuse("a `{` that is no quantifier; write `\\{` for the character") + } + '^' | '$' => { + self.at += 1; + Ok(Atom::ASSERTION) + } + '\\' => { + self.at += 1; + self.escape() + } + _ => { + self.at += 1; + Ok(Atom::CHARACTER) + } + } + } + + fn group(&mut self, ignore_case: bool) -> Read { + let start = self.at; + if self.starts_with("(?P<") { + self.at += 4; + let from = self.at; + if !self.peek(0).is_some_and(|c| c.is_ascii_alphabetic() || c == '_') { + return self.refuse_at( + "a group name that is not a letter or `_` followed by letters, digits or `_`", + start, + ); + } + while self.peek(0).is_some_and(|c| c.is_ascii_alphanumeric() || c == '_') { + self.at += 1; + } + if self.peek(0) != Some('>') { + return self.refuse_at( + "a group name that is not a letter or `_` followed by letters, digits or `_`", + start, + ); + } + let name: String = self.chars[from..self.at].iter().collect(); + if self.names.contains(&name) { + return self.refuse_at(format!("the group name `{name}` written twice"), start); + } + self.names.push(name); + self.at += 1; + return self.closed(ignore_case, start).map(Atom::group); + } + for opener in ["(?=", "(?!", "(?<=", "(?") { + return self.refuse("a back-reference to a named group, which the Rust regex crate does not read"); + } + if self.starts_with("(?#") { + return self.refuse("a comment group, which the Rust regex crate does not read"); + } + if self.starts_with("(?>") { + return self.refuse("an atomic group, which the Rust regex crate does not read"); + } + if self.starts_with("(?(") { + return self.refuse("a conditional group, which neither the Rust regex crate nor the PACT dialect reads"); + } + if self.starts_with("(?<") { + return self.refuse( + "a named group written `(?...)`, which Python's re refuses; write `(?P...)`", + ); + } + if self.starts_with("(?:") { + self.at += 3; + return self.closed(ignore_case, start).map(Atom::group); + } + if self.starts_with("(?") { + let mut i = self.at + 2; + while self.chars.get(i).is_some_and(|c| c.is_ascii_alphabetic() || *c == '-') { + i += 1; + } + let end = self.chars.get(i).copied(); + if !matches!(end, Some(':' | ')')) { + return self.refuse("a `(?` that opens no group the dialect reads"); + } + let letters: String = self.chars[self.at + 2..i].iter().collect(); + if end == Some(')') { + return self.refuse( + "a flag for the whole pattern, which the reference adapter cannot read inside a detector; write `(?i:...)` around the part it applies to", + ); + } + if letters.contains('-') { + return self.refuse("a group that turns a flag off, which the PACT dialect does not read"); + } + if let Some(other) = letters.chars().find(|c| !matches!(c, 'i' | 'm' | 's')) { + return self.refuse(format!( + "the flag `{other}`, which the PACT dialect does not read; it reads `i`, `m` and `s`" + )); + } + self.at = i + 1; + return self.closed(ignore_case || letters.contains('i'), start).map(Atom::group); + } + self.at += 1; + self.closed(ignore_case, start).map(Atom::group) + } + + /// A group's alternatives and its `)`; `true` when it can match an empty value. + fn closed(&mut self, ignore_case: bool, start: usize) -> Read { + let empty = self.alternation(ignore_case)?; + if self.peek(0) != Some(')') { + return self.refuse_at("a group that is never closed", start); + } + self.at += 1; + Ok(empty) + } + + /// The character a character escape names, past the `\`; `None` when the + /// escape names no character. + fn escaped_char(&mut self, letter: char) -> Read> { + if let Some(code) = match letter { + 'n' => Some(0x0a), + 't' => Some(0x09), + 'r' => Some(0x0d), + 'f' => Some(0x0c), + 'v' => Some(0x0b), + 'a' => Some(0x07), + _ => None, + } { + self.at += 1; + return Ok(Some(code)); + } + let digits = match letter { + 'x' => 2, + 'u' => 4, + 'U' => 8, + _ => 0, + }; + if digits > 0 { + let hex: String = self.chars.iter().skip(self.at + 1).take(digits).collect(); + if hex.chars().count() != digits || !hex.chars().all(|c| c.is_ascii_hexdigit()) { + return self.refuse(format!("`\\{letter}` followed by other than {digits} hexadecimal digits")); + } + let code = u32::from_str_radix(&hex, 16).unwrap_or(u32::MAX); + if code > 0x0010_ffff { + return self.refuse(format!("`\\{letter}{hex}`, which is no character")); + } + self.at += 1 + digits; + return Ok(Some(code)); + } + if letter.is_ascii_punctuation() { + self.at += 1; + return Ok(Some(u32::from(letter))); + } + Ok(None) + } + + fn refuse_escape(&self, letter: Option) -> Read { + match letter { + None => self.refuse("a `\\` that ends the pattern"), + Some(d) if d.is_ascii_digit() => self.refuse(format!( + "`\\{d}`, a back-reference or an octal escape, which the Rust regex crate does not read" + )), + Some(other) => self.refuse(format!( + "the escape `\\{other}`, which Python's re and the Rust regex crate do not read alike" + )), + } + } + + /// An escape outside a class, past the `\`. + fn escape(&mut self) -> Read { + let letter = self.peek(0); + match letter { + Some('b' | 'B' | 'A' | 'Z') => { + self.at += 1; + Ok(Atom::ASSERTION) + } + Some('d' | 'D' | 'w' | 'W' | 's' | 'S') => { + self.at += 1; + Ok(Atom::CHARACTER) + } + Some(l) => match self.escaped_char(l)? { + Some(_) => Ok(Atom::CHARACTER), + None => self.refuse_escape(letter), + }, + None => self.refuse_escape(None), + } + } + + fn class_item(&mut self) -> Read { + let Some(c) = self.peek(0) else { + return self.refuse("a class `[` that is never closed"); + }; + if c == '[' { + return self.refuse( + "a `[` inside a class, which the Rust regex crate reads as a nested class; write `\\[`", + ); + } + if c == '\\' { + self.at += 1; + let letter = self.peek(0); + if matches!(letter, Some('d' | 'D' | 'w' | 'W' | 's' | 'S')) { + self.at += 1; + return Ok(Item::Set); + } + if letter == Some('b') { + return self.refuse( + "`\\b` inside a class, which Python reads as a backspace and the Rust regex crate refuses", + ); + } + return match letter { + Some(l) => match self.escaped_char(l)? { + Some(code) => Ok(Item::Char(code)), + None => self.refuse_escape(letter), + }, + None => self.refuse_escape(None), + }; + } + for operation in ["&&", "--", "~~"] { + if self.starts_with(operation) { + return self.refuse(format!( + "`{operation}` inside a class, which the Rust regex crate reads as a set operation; escape one of the two" + )); + } + } + self.at += 1; + Ok(Item::Char(u32::from(c))) + } + + fn class(&mut self, ignore_case: bool) -> Read<()> { + let start = self.at; + self.at += 1; + if self.peek(0) == Some('^') { + self.at += 1; + } + let mut first = true; + loop { + let Some(c) = self.peek(0) else { + return self.refuse_at("a class `[` that is never closed", start); + }; + if c == ']' && !first { + break; + } + first = false; + if c == ']' { + self.at += 1; + continue; + } + let item = self.class_item()?; + if self.starts_with("--") { + return self.refuse( + "`--` inside a class, which the Rust regex crate reads as a set operation; escape one of the two", + ); + } + let dash = self.peek(0) == Some('-') && !matches!(self.peek(1), Some(']') | None); + if !dash { + continue; + } + let dash_at = self.at; + self.at += 1; + let end = self.class_item()?; + let (Item::Char(from), Item::Char(to)) = (item, end) else { + return self.refuse_at("a range whose end is a class such as `\\d`", dash_at); + }; + if to < from { + return self.refuse_at("a range whose end comes before its start", dash_at); + } + if ignore_case && to > 0x7f { + return self.refuse( + "a range of letters beyond ASCII inside `(?i:...)`, which the PACT dialect does not read; list the letters", + ); + } + } + self.at += 1; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn the_shipped_example_pattern_is_in_the_dialect() { + assert_eq!(outside("ORD-[0-9]{8}"), None); + assert_eq!(outside(&joined(&["ORD-[0-9]{8}", " ", "R-\\d+"])), None); + } + + #[test] + fn a_lookbehind_is_refused_where_it_starts() { + let refused = outside("ab(?<=x)y").expect("outside"); + assert_eq!(refused.at, 2); + assert!(refused.reason.contains("lookaround"), "{}", refused.reason); + } + + #[test] + fn a_pattern_that_can_match_nothing_is_refused() { + for empty in ["x*?", "a?", "(?:ab)*|c", "^$", "\\b", "(?:a|)", "a{0,3}"] { + let refused = outside(empty).unwrap_or_else(|| panic!("{empty} is outside")); + assert!(refused.reason.contains("empty value"), "{empty}: {}", refused.reason); + } + for some in ["a*b", "\\bfoo\\b", "(?:a|b)+", "x{1,}?", "^line"] { + assert_eq!(outside(some), None, "{some}"); + } + } + + #[test] + fn a_position_counts_characters_not_bytes() { + assert_eq!(outside("é(?=x)").expect("outside").at, 1); + } +} diff --git a/crates/pact-loader/src/lib.rs b/crates/pact-loader/src/lib.rs index 05de6a2..bf53a97 100644 --- a/crates/pact-loader/src/lib.rs +++ b/crates/pact-loader/src/lib.rs @@ -148,6 +148,7 @@ pub mod currency; pub mod deciding; pub mod derive; pub mod detecting; +pub mod dialect; pub mod effects; pub mod exactly_once; pub mod failures; diff --git a/crates/pact-loader/tests/detector_dialect_cases.rs b/crates/pact-loader/tests/detector_dialect_cases.rs new file mode 100644 index 0000000..9402949 --- /dev/null +++ b/crates/pact-loader/tests/detector_dialect_cases.rs @@ -0,0 +1,37 @@ +//! The detector dialect held to the shared cases +//! (`tests/conformance/detectors.json`): `pact check` refuses exactly the +//! patterns every other port refuses, with the same reason, so a tree that +//! passes the checker detects the same values on every runtime. + +use pact_loader::dialect::outside; +use serde_json::Value; + +fn cases() -> Vec { + let path = concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../tests/conformance/detectors.json" + ); + let held: Value = + serde_json::from_str(&std::fs::read_to_string(path).expect("detectors.json")) + .expect("detectors.json is JSON"); + held["cases"].as_array().expect("cases").clone() +} + +#[test] +fn every_shared_case_is_in_or_outside_the_dialect_for_the_same_reason() { + let mut wrong = Vec::new(); + let all = cases(); + for case in &all { + let pattern = case["looks-like"].as_str().expect("looks-like"); + let expected = case["outside"] + .as_bool() + .expect("outside") + .then(|| case["reason"].as_str().expect("reason").to_string()); + let got = outside(pattern).map(|refused| refused.reason); + if got != expected { + wrong.push(format!("`{pattern}`: expected {expected:?}, read {got:?}")); + } + } + assert!(all.len() > 80, "the shared cases are missing"); + assert!(wrong.is_empty(), "{}", wrong.join("\n")); +} diff --git a/docs/90-REVIEW.md b/docs/90-REVIEW.md index 463b8e6..6e0ef06 100644 --- a/docs/90-REVIEW.md +++ b/docs/90-REVIEW.md @@ -80,8 +80,8 @@ them and changes nothing. | | | |---|---| | Schema | **43 groups, 262 field entries, 207 distinct field names** (core 123, expert 69, both 15), 40 closed enums, 27 cross-reference constraints, **0 fields missing `tier:` or `surface:`** | -| Rust | 5 crates, **1722 tests**, `unsafe_code = forbid`, clippy-deny, edition 2024 | -| Python | **47 modules** (`find adapters/python/src -name "*.py" \| wc -l`), **3609 tests**, **nine transports** — seven model-bound (`anthropic`, `autogen`, `langchain`, `langgraph`, `ollama`, `openai_agents`, `pydantic_ai`), one bound to a remote *agent* (`a2a`), one deterministic mock; `_metering.py`, `_summarise.py` and `_tool_choice.py` are shared code the transports import, which is what the `_` says — offline by default | +| Rust | 5 crates, **1727 tests**, `unsafe_code = forbid`, clippy-deny, edition 2024 | +| Python | **47 modules** (`find adapters/python/src -name "*.py" \| wc -l`), **3613 tests**, **nine transports** — seven model-bound (`anthropic`, `autogen`, `langchain`, `langgraph`, `ollama`, `openai_agents`, `pydantic_ai`), one bound to a remote *agent* (`a2a`), one deterministic mock; `_metering.py`, `_summarise.py` and `_tool_choice.py` are shared code the transports import, which is what the `_` says — offline by default | | TypeScript | 5 modules, 2,305 lines, a second port of **the stepping, the ceilings and the stage path** (`harness.ts:15-21`: *"AC-5.3's bar is the stage path"*) — **not** of the loop entire: no interceptor chain, no durable suspension record, no ledger (`notDoneHere`; a park returns `halted: "suspended"` and writes nothing down). This row is load-bearing for the Phase 3 pricing below (E4) | | CLI | **6 verbs**: `check`, `show`, `waits`, `discover`, `card`, `help` | | Worked example | 42 files, 1128 lines, **132 distinct authored keys**, `pact check` → OK (498 settings) | diff --git a/site-docs/index.md b/site-docs/index.md index 5b8e95b..8f0acde 100644 --- a/site-docs/index.md +++ b/site-docs/index.md @@ -47,7 +47,7 @@ so plainly rather than leaving it to be discovered. | | | |---|---| -| Tests | **5,331** — 1722 Rust, 3609 adapter | +| Tests | **5,340** — 1727 Rust, 3613 adapter | | Schema kinds | **70** | | Framework targets | **7**, over 2 runtimes | | Eve capabilities accounted for | **101 of 101** | diff --git a/site-docs/status/verified.md b/site-docs/status/verified.md index e1a97ef..2aa8c85 100644 --- a/site-docs/status/verified.md +++ b/site-docs/status/verified.md @@ -12,9 +12,9 @@ from an earlier document. | Claim | Value | How to check | |---|---|---| -| Rust tests | **1722** | `cargo test --workspace` | -| Adapter tests | **3609** | `cd adapters/python && uv run pytest tests/ -q` | -| Total | **5,331** | both of the above | +| Rust tests | **1727** | `cargo test --workspace` | +| Adapter tests | **3613** | `cd adapters/python && uv run pytest tests/ -q` | +| Total | **5,340** | both of the above | | TypeScript type-checks | clean | `cd adapters/typescript && npx tsc --noEmit` | | Lints | clean | `cargo clippy --all-targets` | | Worked example loads | 498 settings | `cargo run -p pact-cli -- check examples/refund-desk` | diff --git a/spec/schema.yaml b/spec/schema.yaml index d49a183..5f59ef0 100644 --- a/spec/schema.yaml +++ b/spec/schema.yaml @@ -3468,7 +3468,16 @@ groups: kernel-op: check.detector help: > the patterns it matches, as regular expressions — `ORD-[0-9]{8}`. Any - one matching is enough. + one matching is enough. Each is written in the detector dialect, the + part of regular expressions every runtime reads alike: literals, `.`, + `^`, `$`, `\A`, `\Z`, `\b`, `\B`, `\d \D \w \W \s \S`, `[...]` + with ranges, the escapes `\n \t \r \f \v \a \xHH \uHHHH + \UHHHHHHHH` and escaped punctuation, `(...)`, `(?:...)`, + `(?P...)`, `(?i:...)`, `(?m:...)`, `(?s:...)`, `|`, and `* + ? + {n} {n,} {n,m}` with their lazy forms. A pattern that can match an + empty value, or writes anything else (lookaround, back-references, + `(?...)`, flags for the whole pattern, `{,m}`, nested classes, + `\p{...}`), is refused, naming what it writes. examples: type: list of text surface: S-GEN diff --git a/tests/conformance/detectors.json b/tests/conformance/detectors.json new file mode 100644 index 0000000..f4e512a --- /dev/null +++ b/tests/conformance/detectors.json @@ -0,0 +1,7033 @@ +{ + "about": "The detector dialect (spec/schema.yaml, `detectors`): which `looks-like:` patterns every runtime reads alike, and what each finds. A case with `outside: true` writes something the dialect does not read: `pact check` refuses it (`loader/looks-like-outside-the-dialect`) with `reason`, and so does every port; every other case is in the dialect, and `finds` lists, for each text (by its index in `texts`) where the pattern finds anything, every match Python's `re.finditer` yields, in order. A text not listed finds nothing. Every port reads every case: `crates/pact-loader/tests/detector_dialect_cases.rs` (in or outside), `adapters/python/tests/test_every_port_reads_one_detector_dialect.py` (Python's `re`, and the TypeScript port through `adapters/typescript/read-detectors.mts`).", + "texts": [ + "", + " ", + "plain words only", + "Order ORD-12345678 shipped", + "ORD-1234567", + "ord-12345678", + "ORD-123456789", + "card 4111 1111 1111 1111 expires 09/27", + "card 4111-1111-1111-1111", + "card 4111111111111111", + "4111 1111 1111 1111", + "4111 1111 1111 1111", + "4111.1111.1111.1111", + "amount 1234.56", + "version 1.2.3", + "6011 0009 9013 9424 123", + "IBAN GB82 WEST 1234 5698 7654 32", + "iban gb82west12345698765432", + "sort code 12-34-56", + "account 12345678", + "acct 000123456789", + "hash 3f2a9c1b8e7d6a5f4e3d2c1b0a9f8e7d", + "mail jane.doe+desk@example.co.uk", + "mail jörg@bücher.de", + "not@mail", + "call +1 (555) 123-4567", + "call 020 7946 0958", + "date 2026-07-15", + "at 2026-10-05 09:00", + "ssn 123-45-6789", + "ssn 123 45 6789", + "ssn 123456789", + "id 1234567890123", + "١٢٣٤٥٦٧٨", + "digits 123", + "Straße 12", + "STRASSE 12", + "café au lait", + "CAFÉ", + "naïve", + "Σσς", + "line one\nline two", + "trailing newline\n", + "tab\tseparated", + "unit\u001fseparator", + "next…line", + "emoji 😀 face", + "under_score_word", + "Ⅷ roman", + "x́ combining", + "a.b", + "a\nb", + "a\rb", + "ab", + "AB", + "aB", + "foo bar", + "foobar", + "{\"ref\": \"ORD-12345678\"}", + "[1, 2, 3]", + "refund this order", + "REFUND THIS ORDER", + "the end", + "end\n", + "\nstart", + "k", + "K", + "K" + ], + "cases": [ + { + "looks-like": "ORD-[0-9]{8}", + "outside": false, + "finds": [ + { + "in": 3, + "found": [ + "ORD-12345678" + ] + }, + { + "in": 6, + "found": [ + "ORD-12345678" + ] + }, + { + "in": 58, + "found": [ + "ORD-12345678" + ] + } + ] + }, + { + "looks-like": "\\d+", + "outside": false, + "finds": [ + { + "in": 3, + "found": [ + "12345678" + ] + }, + { + "in": 4, + "found": [ + "1234567" + ] + }, + { + "in": 5, + "found": [ + "12345678" + ] + }, + { + "in": 6, + "found": [ + "123456789" + ] + }, + { + "in": 7, + "found": [ + "4111", + "1111", + "1111", + "1111", + "09", + "27" + ] + }, + { + "in": 8, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 9, + "found": [ + "4111111111111111" + ] + }, + { + "in": 10, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 11, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 12, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 13, + "found": [ + "1234", + "56" + ] + }, + { + "in": 14, + "found": [ + "1", + "2", + "3" + ] + }, + { + "in": 15, + "found": [ + "6011", + "0009", + "9013", + "9424", + "123" + ] + }, + { + "in": 16, + "found": [ + "82", + "1234", + "5698", + "7654", + "32" + ] + }, + { + "in": 17, + "found": [ + "82", + "12345698765432" + ] + }, + { + "in": 18, + "found": [ + "12", + "34", + "56" + ] + }, + { + "in": 19, + "found": [ + "12345678" + ] + }, + { + "in": 20, + "found": [ + "000123456789" + ] + }, + { + "in": 21, + "found": [ + "3", + "2", + "9", + "1", + "8", + "7", + "6", + "5", + "4", + "3", + "2", + "1", + "0", + "9", + "8", + "7" + ] + }, + { + "in": 25, + "found": [ + "1", + "555", + "123", + "4567" + ] + }, + { + "in": 26, + "found": [ + "020", + "7946", + "0958" + ] + }, + { + "in": 27, + "found": [ + "2026", + "07", + "15" + ] + }, + { + "in": 28, + "found": [ + "2026", + "10", + "05", + "09", + "00" + ] + }, + { + "in": 29, + "found": [ + "123", + "45", + "6789" + ] + }, + { + "in": 30, + "found": [ + "123", + "45", + "6789" + ] + }, + { + "in": 31, + "found": [ + "123456789" + ] + }, + { + "in": 32, + "found": [ + "1234567890123" + ] + }, + { + "in": 33, + "found": [ + "١٢٣٤٥٦٧٨" + ] + }, + { + "in": 34, + "found": [ + "123" + ] + }, + { + "in": 35, + "found": [ + "12" + ] + }, + { + "in": 36, + "found": [ + "12" + ] + }, + { + "in": 58, + "found": [ + "12345678" + ] + }, + { + "in": 59, + "found": [ + "1", + "2", + "3" + ] + } + ] + }, + { + "looks-like": "\\D+", + "outside": false, + "finds": [ + { + "in": 1, + "found": [ + " " + ] + }, + { + "in": 2, + "found": [ + "plain words only" + ] + }, + { + "in": 3, + "found": [ + "Order ORD-", + " shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD-" + ] + }, + { + "in": 5, + "found": [ + "ord-" + ] + }, + { + "in": 6, + "found": [ + "ORD-" + ] + }, + { + "in": 7, + "found": [ + "card ", + " ", + " ", + " ", + " expires ", + "/" + ] + }, + { + "in": 8, + "found": [ + "card ", + "-", + "-", + "-" + ] + }, + { + "in": 9, + "found": [ + "card " + ] + }, + { + "in": 10, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 11, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 12, + "found": [ + ".", + ".", + "." + ] + }, + { + "in": 13, + "found": [ + "amount ", + "." + ] + }, + { + "in": 14, + "found": [ + "version ", + ".", + "." + ] + }, + { + "in": 15, + "found": [ + " ", + " ", + " ", + " " + ] + }, + { + "in": 16, + "found": [ + "IBAN GB", + " WEST ", + " ", + " ", + " " + ] + }, + { + "in": 17, + "found": [ + "iban gb", + "west" + ] + }, + { + "in": 18, + "found": [ + "sort code ", + "-", + "-" + ] + }, + { + "in": 19, + "found": [ + "account " + ] + }, + { + "in": 20, + "found": [ + "acct " + ] + }, + { + "in": 21, + "found": [ + "hash ", + "f", + "a", + "c", + "b", + "e", + "d", + "a", + "f", + "e", + "d", + "c", + "b", + "a", + "f", + "e", + "d" + ] + }, + { + "in": 22, + "found": [ + "mail jane.doe+desk@example.co.uk" + ] + }, + { + "in": 23, + "found": [ + "mail jörg@bücher.de" + ] + }, + { + "in": 24, + "found": [ + "not@mail" + ] + }, + { + "in": 25, + "found": [ + "call +", + " (", + ") ", + "-" + ] + }, + { + "in": 26, + "found": [ + "call ", + " ", + " " + ] + }, + { + "in": 27, + "found": [ + "date ", + "-", + "-" + ] + }, + { + "in": 28, + "found": [ + "at ", + "-", + "-", + " ", + ":" + ] + }, + { + "in": 29, + "found": [ + "ssn ", + "-", + "-" + ] + }, + { + "in": 30, + "found": [ + "ssn ", + " ", + " " + ] + }, + { + "in": 31, + "found": [ + "ssn " + ] + }, + { + "in": 32, + "found": [ + "id " + ] + }, + { + "in": 34, + "found": [ + "digits " + ] + }, + { + "in": 35, + "found": [ + "Straße " + ] + }, + { + "in": 36, + "found": [ + "STRASSE " + ] + }, + { + "in": 37, + "found": [ + "café au lait" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + }, + { + "in": 39, + "found": [ + "naïve" + ] + }, + { + "in": 40, + "found": [ + "Σσς" + ] + }, + { + "in": 41, + "found": [ + "line one\nline two" + ] + }, + { + "in": 42, + "found": [ + "trailing newline\n" + ] + }, + { + "in": 43, + "found": [ + "tab\tseparated" + ] + }, + { + "in": 44, + "found": [ + "unit\u001fseparator" + ] + }, + { + "in": 45, + "found": [ + "next…line" + ] + }, + { + "in": 46, + "found": [ + "emoji 😀 face" + ] + }, + { + "in": 47, + "found": [ + "under_score_word" + ] + }, + { + "in": 48, + "found": [ + "Ⅷ roman" + ] + }, + { + "in": 49, + "found": [ + "x́ combining" + ] + }, + { + "in": 50, + "found": [ + "a.b" + ] + }, + { + "in": 51, + "found": [ + "a\nb" + ] + }, + { + "in": 52, + "found": [ + "a\rb" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "{\"ref\": \"ORD-", + "\"}" + ] + }, + { + "in": 59, + "found": [ + "[", + ", ", + ", ", + "]" + ] + }, + { + "in": 60, + "found": [ + "refund this order" + ] + }, + { + "in": 61, + "found": [ + "REFUND THIS ORDER" + ] + }, + { + "in": 62, + "found": [ + "the end" + ] + }, + { + "in": 63, + "found": [ + "end\n" + ] + }, + { + "in": 64, + "found": [ + "\nstart" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "\\w+", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "plain", + "words", + "only" + ] + }, + { + "in": 3, + "found": [ + "Order", + "ORD", + "12345678", + "shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD", + "1234567" + ] + }, + { + "in": 5, + "found": [ + "ord", + "12345678" + ] + }, + { + "in": 6, + "found": [ + "ORD", + "123456789" + ] + }, + { + "in": 7, + "found": [ + "card", + "4111", + "1111", + "1111", + "1111", + "expires", + "09", + "27" + ] + }, + { + "in": 8, + "found": [ + "card", + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 9, + "found": [ + "card", + "4111111111111111" + ] + }, + { + "in": 10, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 11, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 12, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 13, + "found": [ + "amount", + "1234", + "56" + ] + }, + { + "in": 14, + "found": [ + "version", + "1", + "2", + "3" + ] + }, + { + "in": 15, + "found": [ + "6011", + "0009", + "9013", + "9424", + "123" + ] + }, + { + "in": 16, + "found": [ + "IBAN", + "GB82", + "WEST", + "1234", + "5698", + "7654", + "32" + ] + }, + { + "in": 17, + "found": [ + "iban", + "gb82west12345698765432" + ] + }, + { + "in": 18, + "found": [ + "sort", + "code", + "12", + "34", + "56" + ] + }, + { + "in": 19, + "found": [ + "account", + "12345678" + ] + }, + { + "in": 20, + "found": [ + "acct", + "000123456789" + ] + }, + { + "in": 21, + "found": [ + "hash", + "3f2a9c1b8e7d6a5f4e3d2c1b0a9f8e7d" + ] + }, + { + "in": 22, + "found": [ + "mail", + "jane", + "doe", + "desk", + "example", + "co", + "uk" + ] + }, + { + "in": 23, + "found": [ + "mail", + "jörg", + "bücher", + "de" + ] + }, + { + "in": 24, + "found": [ + "not", + "mail" + ] + }, + { + "in": 25, + "found": [ + "call", + "1", + "555", + "123", + "4567" + ] + }, + { + "in": 26, + "found": [ + "call", + "020", + "7946", + "0958" + ] + }, + { + "in": 27, + "found": [ + "date", + "2026", + "07", + "15" + ] + }, + { + "in": 28, + "found": [ + "at", + "2026", + "10", + "05", + "09", + "00" + ] + }, + { + "in": 29, + "found": [ + "ssn", + "123", + "45", + "6789" + ] + }, + { + "in": 30, + "found": [ + "ssn", + "123", + "45", + "6789" + ] + }, + { + "in": 31, + "found": [ + "ssn", + "123456789" + ] + }, + { + "in": 32, + "found": [ + "id", + "1234567890123" + ] + }, + { + "in": 33, + "found": [ + "١٢٣٤٥٦٧٨" + ] + }, + { + "in": 34, + "found": [ + "digits", + "123" + ] + }, + { + "in": 35, + "found": [ + "Straße", + "12" + ] + }, + { + "in": 36, + "found": [ + "STRASSE", + "12" + ] + }, + { + "in": 37, + "found": [ + "café", + "au", + "lait" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + }, + { + "in": 39, + "found": [ + "naïve" + ] + }, + { + "in": 40, + "found": [ + "Σσς" + ] + }, + { + "in": 41, + "found": [ + "line", + "one", + "line", + "two" + ] + }, + { + "in": 42, + "found": [ + "trailing", + "newline" + ] + }, + { + "in": 43, + "found": [ + "tab", + "separated" + ] + }, + { + "in": 44, + "found": [ + "unit", + "separator" + ] + }, + { + "in": 45, + "found": [ + "next", + "line" + ] + }, + { + "in": 46, + "found": [ + "emoji", + "face" + ] + }, + { + "in": 47, + "found": [ + "under_score_word" + ] + }, + { + "in": 48, + "found": [ + "Ⅷ", + "roman" + ] + }, + { + "in": 49, + "found": [ + "x", + "combining" + ] + }, + { + "in": 50, + "found": [ + "a", + "b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "ref", + "ORD", + "12345678" + ] + }, + { + "in": 59, + "found": [ + "1", + "2", + "3" + ] + }, + { + "in": 60, + "found": [ + "refund", + "this", + "order" + ] + }, + { + "in": 61, + "found": [ + "REFUND", + "THIS", + "ORDER" + ] + }, + { + "in": 62, + "found": [ + "the", + "end" + ] + }, + { + "in": 63, + "found": [ + "end" + ] + }, + { + "in": 64, + "found": [ + "start" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "\\W", + "outside": false, + "finds": [ + { + "in": 1, + "found": [ + " " + ] + }, + { + "in": 2, + "found": [ + " ", + " " + ] + }, + { + "in": 3, + "found": [ + " ", + "-", + " " + ] + }, + { + "in": 4, + "found": [ + "-" + ] + }, + { + "in": 5, + "found": [ + "-" + ] + }, + { + "in": 6, + "found": [ + "-" + ] + }, + { + "in": 7, + "found": [ + " ", + " ", + " ", + " ", + " ", + " ", + "/" + ] + }, + { + "in": 8, + "found": [ + " ", + "-", + "-", + "-" + ] + }, + { + "in": 9, + "found": [ + " " + ] + }, + { + "in": 10, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 11, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 12, + "found": [ + ".", + ".", + "." + ] + }, + { + "in": 13, + "found": [ + " ", + "." + ] + }, + { + "in": 14, + "found": [ + " ", + ".", + "." + ] + }, + { + "in": 15, + "found": [ + " ", + " ", + " ", + " " + ] + }, + { + "in": 16, + "found": [ + " ", + " ", + " ", + " ", + " ", + " " + ] + }, + { + "in": 17, + "found": [ + " " + ] + }, + { + "in": 18, + "found": [ + " ", + " ", + "-", + "-" + ] + }, + { + "in": 19, + "found": [ + " " + ] + }, + { + "in": 20, + "found": [ + " " + ] + }, + { + "in": 21, + "found": [ + " " + ] + }, + { + "in": 22, + "found": [ + " ", + ".", + "+", + "@", + ".", + "." + ] + }, + { + "in": 23, + "found": [ + " ", + "@", + "." + ] + }, + { + "in": 24, + "found": [ + "@" + ] + }, + { + "in": 25, + "found": [ + " ", + "+", + " ", + "(", + ")", + " ", + "-" + ] + }, + { + "in": 26, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 27, + "found": [ + " ", + "-", + "-" + ] + }, + { + "in": 28, + "found": [ + " ", + "-", + "-", + " ", + ":" + ] + }, + { + "in": 29, + "found": [ + " ", + "-", + "-" + ] + }, + { + "in": 30, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 31, + "found": [ + " " + ] + }, + { + "in": 32, + "found": [ + " " + ] + }, + { + "in": 34, + "found": [ + " " + ] + }, + { + "in": 35, + "found": [ + " " + ] + }, + { + "in": 36, + "found": [ + " " + ] + }, + { + "in": 37, + "found": [ + " ", + " " + ] + }, + { + "in": 41, + "found": [ + " ", + "\n", + " " + ] + }, + { + "in": 42, + "found": [ + " ", + "\n" + ] + }, + { + "in": 43, + "found": [ + "\t" + ] + }, + { + "in": 44, + "found": [ + "\u001f" + ] + }, + { + "in": 45, + "found": [ + "…" + ] + }, + { + "in": 46, + "found": [ + " ", + "😀", + " " + ] + }, + { + "in": 48, + "found": [ + " " + ] + }, + { + "in": 49, + "found": [ + "́", + " " + ] + }, + { + "in": 50, + "found": [ + "." + ] + }, + { + "in": 51, + "found": [ + "\n" + ] + }, + { + "in": 52, + "found": [ + "\r" + ] + }, + { + "in": 56, + "found": [ + " " + ] + }, + { + "in": 58, + "found": [ + "{", + "\"", + "\"", + ":", + " ", + "\"", + "-", + "\"", + "}" + ] + }, + { + "in": 59, + "found": [ + "[", + ",", + " ", + ",", + " ", + "]" + ] + }, + { + "in": 60, + "found": [ + " ", + " " + ] + }, + { + "in": 61, + "found": [ + " ", + " " + ] + }, + { + "in": 62, + "found": [ + " " + ] + }, + { + "in": 63, + "found": [ + "\n" + ] + }, + { + "in": 64, + "found": [ + "\n" + ] + } + ] + }, + { + "looks-like": "\\s", + "outside": false, + "finds": [ + { + "in": 1, + "found": [ + " " + ] + }, + { + "in": 2, + "found": [ + " ", + " " + ] + }, + { + "in": 3, + "found": [ + " ", + " " + ] + }, + { + "in": 7, + "found": [ + " ", + " ", + " ", + " ", + " ", + " " + ] + }, + { + "in": 8, + "found": [ + " " + ] + }, + { + "in": 9, + "found": [ + " " + ] + }, + { + "in": 10, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 11, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 13, + "found": [ + " " + ] + }, + { + "in": 14, + "found": [ + " " + ] + }, + { + "in": 15, + "found": [ + " ", + " ", + " ", + " " + ] + }, + { + "in": 16, + "found": [ + " ", + " ", + " ", + " ", + " ", + " " + ] + }, + { + "in": 17, + "found": [ + " " + ] + }, + { + "in": 18, + "found": [ + " ", + " " + ] + }, + { + "in": 19, + "found": [ + " " + ] + }, + { + "in": 20, + "found": [ + " " + ] + }, + { + "in": 21, + "found": [ + " " + ] + }, + { + "in": 22, + "found": [ + " " + ] + }, + { + "in": 23, + "found": [ + " " + ] + }, + { + "in": 25, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 26, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 27, + "found": [ + " " + ] + }, + { + "in": 28, + "found": [ + " ", + " " + ] + }, + { + "in": 29, + "found": [ + " " + ] + }, + { + "in": 30, + "found": [ + " ", + " ", + " " + ] + }, + { + "in": 31, + "found": [ + " " + ] + }, + { + "in": 32, + "found": [ + " " + ] + }, + { + "in": 34, + "found": [ + " " + ] + }, + { + "in": 35, + "found": [ + " " + ] + }, + { + "in": 36, + "found": [ + " " + ] + }, + { + "in": 37, + "found": [ + " ", + " " + ] + }, + { + "in": 41, + "found": [ + " ", + "\n", + " " + ] + }, + { + "in": 42, + "found": [ + " ", + "\n" + ] + }, + { + "in": 43, + "found": [ + "\t" + ] + }, + { + "in": 44, + "found": [ + "\u001f" + ] + }, + { + "in": 45, + "found": [ + "…" + ] + }, + { + "in": 46, + "found": [ + " ", + " " + ] + }, + { + "in": 48, + "found": [ + " " + ] + }, + { + "in": 49, + "found": [ + " " + ] + }, + { + "in": 51, + "found": [ + "\n" + ] + }, + { + "in": 52, + "found": [ + "\r" + ] + }, + { + "in": 56, + "found": [ + " " + ] + }, + { + "in": 58, + "found": [ + " " + ] + }, + { + "in": 59, + "found": [ + " ", + " " + ] + }, + { + "in": 60, + "found": [ + " ", + " " + ] + }, + { + "in": 61, + "found": [ + " ", + " " + ] + }, + { + "in": 62, + "found": [ + " " + ] + }, + { + "in": 63, + "found": [ + "\n" + ] + }, + { + "in": 64, + "found": [ + "\n" + ] + } + ] + }, + { + "looks-like": "\\S+", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "plain", + "words", + "only" + ] + }, + { + "in": 3, + "found": [ + "Order", + "ORD-12345678", + "shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD-1234567" + ] + }, + { + "in": 5, + "found": [ + "ord-12345678" + ] + }, + { + "in": 6, + "found": [ + "ORD-123456789" + ] + }, + { + "in": 7, + "found": [ + "card", + "4111", + "1111", + "1111", + "1111", + "expires", + "09/27" + ] + }, + { + "in": 8, + "found": [ + "card", + "4111-1111-1111-1111" + ] + }, + { + "in": 9, + "found": [ + "card", + "4111111111111111" + ] + }, + { + "in": 10, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 11, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 12, + "found": [ + "4111.1111.1111.1111" + ] + }, + { + "in": 13, + "found": [ + "amount", + "1234.56" + ] + }, + { + "in": 14, + "found": [ + "version", + "1.2.3" + ] + }, + { + "in": 15, + "found": [ + "6011", + "0009", + "9013", + "9424", + "123" + ] + }, + { + "in": 16, + "found": [ + "IBAN", + "GB82", + "WEST", + "1234", + "5698", + "7654", + "32" + ] + }, + { + "in": 17, + "found": [ + "iban", + "gb82west12345698765432" + ] + }, + { + "in": 18, + "found": [ + "sort", + "code", + "12-34-56" + ] + }, + { + "in": 19, + "found": [ + "account", + "12345678" + ] + }, + { + "in": 20, + "found": [ + "acct", + "000123456789" + ] + }, + { + "in": 21, + "found": [ + "hash", + "3f2a9c1b8e7d6a5f4e3d2c1b0a9f8e7d" + ] + }, + { + "in": 22, + "found": [ + "mail", + "jane.doe+desk@example.co.uk" + ] + }, + { + "in": 23, + "found": [ + "mail", + "jörg@bücher.de" + ] + }, + { + "in": 24, + "found": [ + "not@mail" + ] + }, + { + "in": 25, + "found": [ + "call", + "+1", + "(555)", + "123-4567" + ] + }, + { + "in": 26, + "found": [ + "call", + "020", + "7946", + "0958" + ] + }, + { + "in": 27, + "found": [ + "date", + "2026-07-15" + ] + }, + { + "in": 28, + "found": [ + "at", + "2026-10-05", + "09:00" + ] + }, + { + "in": 29, + "found": [ + "ssn", + "123-45-6789" + ] + }, + { + "in": 30, + "found": [ + "ssn", + "123", + "45", + "6789" + ] + }, + { + "in": 31, + "found": [ + "ssn", + "123456789" + ] + }, + { + "in": 32, + "found": [ + "id", + "1234567890123" + ] + }, + { + "in": 33, + "found": [ + "١٢٣٤٥٦٧٨" + ] + }, + { + "in": 34, + "found": [ + "digits", + "123" + ] + }, + { + "in": 35, + "found": [ + "Straße", + "12" + ] + }, + { + "in": 36, + "found": [ + "STRASSE", + "12" + ] + }, + { + "in": 37, + "found": [ + "café", + "au", + "lait" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + }, + { + "in": 39, + "found": [ + "naïve" + ] + }, + { + "in": 40, + "found": [ + "Σσς" + ] + }, + { + "in": 41, + "found": [ + "line", + "one", + "line", + "two" + ] + }, + { + "in": 42, + "found": [ + "trailing", + "newline" + ] + }, + { + "in": 43, + "found": [ + "tab", + "separated" + ] + }, + { + "in": 44, + "found": [ + "unit", + "separator" + ] + }, + { + "in": 45, + "found": [ + "next", + "line" + ] + }, + { + "in": 46, + "found": [ + "emoji", + "😀", + "face" + ] + }, + { + "in": 47, + "found": [ + "under_score_word" + ] + }, + { + "in": 48, + "found": [ + "Ⅷ", + "roman" + ] + }, + { + "in": 49, + "found": [ + "x́", + "combining" + ] + }, + { + "in": 50, + "found": [ + "a.b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "{\"ref\":", + "\"ORD-12345678\"}" + ] + }, + { + "in": 59, + "found": [ + "[1,", + "2,", + "3]" + ] + }, + { + "in": 60, + "found": [ + "refund", + "this", + "order" + ] + }, + { + "in": 61, + "found": [ + "REFUND", + "THIS", + "ORDER" + ] + }, + { + "in": 62, + "found": [ + "the", + "end" + ] + }, + { + "in": 63, + "found": [ + "end" + ] + }, + { + "in": 64, + "found": [ + "start" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "\\bfoo\\b", + "outside": false, + "finds": [ + { + "in": 56, + "found": [ + "foo" + ] + } + ] + }, + { + "looks-like": "\\Bbar", + "outside": false, + "finds": [ + { + "in": 57, + "found": [ + "bar" + ] + } + ] + }, + { + "looks-like": "^line", + "outside": false, + "finds": [ + { + "in": 41, + "found": [ + "line" + ] + } + ] + }, + { + "looks-like": "two$", + "outside": false, + "finds": [ + { + "in": 41, + "found": [ + "two" + ] + } + ] + }, + { + "looks-like": "newline$", + "outside": false, + "finds": [ + { + "in": 42, + "found": [ + "newline" + ] + } + ] + }, + { + "looks-like": "(?m:^line two$)", + "outside": false, + "finds": [ + { + "in": 41, + "found": [ + "line two" + ] + } + ] + }, + { + "looks-like": "(?m:one$)", + "outside": false, + "finds": [ + { + "in": 41, + "found": [ + "one" + ] + } + ] + }, + { + "looks-like": "(?s:a.b)", + "outside": false, + "finds": [ + { + "in": 50, + "found": [ + "a.b" + ] + }, + { + "in": 51, + "found": [ + "a\nb" + ] + }, + { + "in": 52, + "found": [ + "a\rb" + ] + } + ] + }, + { + "looks-like": "a.b", + "outside": false, + "finds": [ + { + "in": 50, + "found": [ + "a.b" + ] + }, + { + "in": 52, + "found": [ + "a\rb" + ] + } + ] + }, + { + "looks-like": "\\Aend", + "outside": false, + "finds": [ + { + "in": 63, + "found": [ + "end" + ] + } + ] + }, + { + "looks-like": "end\\Z", + "outside": false, + "finds": [ + { + "in": 62, + "found": [ + "end" + ] + } + ] + }, + { + "looks-like": "(?i:straße)", + "outside": false, + "finds": [ + { + "in": 35, + "found": [ + "Straße" + ] + } + ] + }, + { + "looks-like": "(?i:café)", + "outside": false, + "finds": [ + { + "in": 37, + "found": [ + "café" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + } + ] + }, + { + "looks-like": "(?i:k)", + "outside": false, + "finds": [ + { + "in": 22, + "found": [ + "k", + "k" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "(?i:[a-z]+)", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "plain", + "words", + "only" + ] + }, + { + "in": 3, + "found": [ + "Order", + "ORD", + "shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD" + ] + }, + { + "in": 5, + "found": [ + "ord" + ] + }, + { + "in": 6, + "found": [ + "ORD" + ] + }, + { + "in": 7, + "found": [ + "card", + "expires" + ] + }, + { + "in": 8, + "found": [ + "card" + ] + }, + { + "in": 9, + "found": [ + "card" + ] + }, + { + "in": 13, + "found": [ + "amount" + ] + }, + { + "in": 14, + "found": [ + "version" + ] + }, + { + "in": 16, + "found": [ + "IBAN", + "GB", + "WEST" + ] + }, + { + "in": 17, + "found": [ + "iban", + "gb", + "west" + ] + }, + { + "in": 18, + "found": [ + "sort", + "code" + ] + }, + { + "in": 19, + "found": [ + "account" + ] + }, + { + "in": 20, + "found": [ + "acct" + ] + }, + { + "in": 21, + "found": [ + "hash", + "f", + "a", + "c", + "b", + "e", + "d", + "a", + "f", + "e", + "d", + "c", + "b", + "a", + "f", + "e", + "d" + ] + }, + { + "in": 22, + "found": [ + "mail", + "jane", + "doe", + "desk", + "example", + "co", + "uk" + ] + }, + { + "in": 23, + "found": [ + "mail", + "j", + "rg", + "b", + "cher", + "de" + ] + }, + { + "in": 24, + "found": [ + "not", + "mail" + ] + }, + { + "in": 25, + "found": [ + "call" + ] + }, + { + "in": 26, + "found": [ + "call" + ] + }, + { + "in": 27, + "found": [ + "date" + ] + }, + { + "in": 28, + "found": [ + "at" + ] + }, + { + "in": 29, + "found": [ + "ssn" + ] + }, + { + "in": 30, + "found": [ + "ssn" + ] + }, + { + "in": 31, + "found": [ + "ssn" + ] + }, + { + "in": 32, + "found": [ + "id" + ] + }, + { + "in": 34, + "found": [ + "digits" + ] + }, + { + "in": 35, + "found": [ + "Stra", + "e" + ] + }, + { + "in": 36, + "found": [ + "STRASSE" + ] + }, + { + "in": 37, + "found": [ + "caf", + "au", + "lait" + ] + }, + { + "in": 38, + "found": [ + "CAF" + ] + }, + { + "in": 39, + "found": [ + "na", + "ve" + ] + }, + { + "in": 41, + "found": [ + "line", + "one", + "line", + "two" + ] + }, + { + "in": 42, + "found": [ + "trailing", + "newline" + ] + }, + { + "in": 43, + "found": [ + "tab", + "separated" + ] + }, + { + "in": 44, + "found": [ + "unit", + "separator" + ] + }, + { + "in": 45, + "found": [ + "next", + "line" + ] + }, + { + "in": 46, + "found": [ + "emoji", + "face" + ] + }, + { + "in": 47, + "found": [ + "under", + "score", + "word" + ] + }, + { + "in": 48, + "found": [ + "roman" + ] + }, + { + "in": 49, + "found": [ + "x", + "combining" + ] + }, + { + "in": 50, + "found": [ + "a", + "b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "ref", + "ORD" + ] + }, + { + "in": 60, + "found": [ + "refund", + "this", + "order" + ] + }, + { + "in": 61, + "found": [ + "REFUND", + "THIS", + "ORDER" + ] + }, + { + "in": 62, + "found": [ + "the", + "end" + ] + }, + { + "in": 63, + "found": [ + "end" + ] + }, + { + "in": 64, + "found": [ + "start" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "(?i:ab)", + "outside": false, + "finds": [ + { + "in": 43, + "found": [ + "ab" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + } + ] + }, + { + "looks-like": "[^\\W\\d]+", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "plain", + "words", + "only" + ] + }, + { + "in": 3, + "found": [ + "Order", + "ORD", + "shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD" + ] + }, + { + "in": 5, + "found": [ + "ord" + ] + }, + { + "in": 6, + "found": [ + "ORD" + ] + }, + { + "in": 7, + "found": [ + "card", + "expires" + ] + }, + { + "in": 8, + "found": [ + "card" + ] + }, + { + "in": 9, + "found": [ + "card" + ] + }, + { + "in": 13, + "found": [ + "amount" + ] + }, + { + "in": 14, + "found": [ + "version" + ] + }, + { + "in": 16, + "found": [ + "IBAN", + "GB", + "WEST" + ] + }, + { + "in": 17, + "found": [ + "iban", + "gb", + "west" + ] + }, + { + "in": 18, + "found": [ + "sort", + "code" + ] + }, + { + "in": 19, + "found": [ + "account" + ] + }, + { + "in": 20, + "found": [ + "acct" + ] + }, + { + "in": 21, + "found": [ + "hash", + "f", + "a", + "c", + "b", + "e", + "d", + "a", + "f", + "e", + "d", + "c", + "b", + "a", + "f", + "e", + "d" + ] + }, + { + "in": 22, + "found": [ + "mail", + "jane", + "doe", + "desk", + "example", + "co", + "uk" + ] + }, + { + "in": 23, + "found": [ + "mail", + "jörg", + "bücher", + "de" + ] + }, + { + "in": 24, + "found": [ + "not", + "mail" + ] + }, + { + "in": 25, + "found": [ + "call" + ] + }, + { + "in": 26, + "found": [ + "call" + ] + }, + { + "in": 27, + "found": [ + "date" + ] + }, + { + "in": 28, + "found": [ + "at" + ] + }, + { + "in": 29, + "found": [ + "ssn" + ] + }, + { + "in": 30, + "found": [ + "ssn" + ] + }, + { + "in": 31, + "found": [ + "ssn" + ] + }, + { + "in": 32, + "found": [ + "id" + ] + }, + { + "in": 34, + "found": [ + "digits" + ] + }, + { + "in": 35, + "found": [ + "Straße" + ] + }, + { + "in": 36, + "found": [ + "STRASSE" + ] + }, + { + "in": 37, + "found": [ + "café", + "au", + "lait" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + }, + { + "in": 39, + "found": [ + "naïve" + ] + }, + { + "in": 40, + "found": [ + "Σσς" + ] + }, + { + "in": 41, + "found": [ + "line", + "one", + "line", + "two" + ] + }, + { + "in": 42, + "found": [ + "trailing", + "newline" + ] + }, + { + "in": 43, + "found": [ + "tab", + "separated" + ] + }, + { + "in": 44, + "found": [ + "unit", + "separator" + ] + }, + { + "in": 45, + "found": [ + "next", + "line" + ] + }, + { + "in": 46, + "found": [ + "emoji", + "face" + ] + }, + { + "in": 47, + "found": [ + "under_score_word" + ] + }, + { + "in": 48, + "found": [ + "Ⅷ", + "roman" + ] + }, + { + "in": 49, + "found": [ + "x", + "combining" + ] + }, + { + "in": 50, + "found": [ + "a", + "b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "ref", + "ORD" + ] + }, + { + "in": 60, + "found": [ + "refund", + "this", + "order" + ] + }, + { + "in": 61, + "found": [ + "REFUND", + "THIS", + "ORDER" + ] + }, + { + "in": 62, + "found": [ + "the", + "end" + ] + }, + { + "in": 63, + "found": [ + "end" + ] + }, + { + "in": 64, + "found": [ + "start" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "[\\S]+", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "plain", + "words", + "only" + ] + }, + { + "in": 3, + "found": [ + "Order", + "ORD-12345678", + "shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD-1234567" + ] + }, + { + "in": 5, + "found": [ + "ord-12345678" + ] + }, + { + "in": 6, + "found": [ + "ORD-123456789" + ] + }, + { + "in": 7, + "found": [ + "card", + "4111", + "1111", + "1111", + "1111", + "expires", + "09/27" + ] + }, + { + "in": 8, + "found": [ + "card", + "4111-1111-1111-1111" + ] + }, + { + "in": 9, + "found": [ + "card", + "4111111111111111" + ] + }, + { + "in": 10, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 11, + "found": [ + "4111", + "1111", + "1111", + "1111" + ] + }, + { + "in": 12, + "found": [ + "4111.1111.1111.1111" + ] + }, + { + "in": 13, + "found": [ + "amount", + "1234.56" + ] + }, + { + "in": 14, + "found": [ + "version", + "1.2.3" + ] + }, + { + "in": 15, + "found": [ + "6011", + "0009", + "9013", + "9424", + "123" + ] + }, + { + "in": 16, + "found": [ + "IBAN", + "GB82", + "WEST", + "1234", + "5698", + "7654", + "32" + ] + }, + { + "in": 17, + "found": [ + "iban", + "gb82west12345698765432" + ] + }, + { + "in": 18, + "found": [ + "sort", + "code", + "12-34-56" + ] + }, + { + "in": 19, + "found": [ + "account", + "12345678" + ] + }, + { + "in": 20, + "found": [ + "acct", + "000123456789" + ] + }, + { + "in": 21, + "found": [ + "hash", + "3f2a9c1b8e7d6a5f4e3d2c1b0a9f8e7d" + ] + }, + { + "in": 22, + "found": [ + "mail", + "jane.doe+desk@example.co.uk" + ] + }, + { + "in": 23, + "found": [ + "mail", + "jörg@bücher.de" + ] + }, + { + "in": 24, + "found": [ + "not@mail" + ] + }, + { + "in": 25, + "found": [ + "call", + "+1", + "(555)", + "123-4567" + ] + }, + { + "in": 26, + "found": [ + "call", + "020", + "7946", + "0958" + ] + }, + { + "in": 27, + "found": [ + "date", + "2026-07-15" + ] + }, + { + "in": 28, + "found": [ + "at", + "2026-10-05", + "09:00" + ] + }, + { + "in": 29, + "found": [ + "ssn", + "123-45-6789" + ] + }, + { + "in": 30, + "found": [ + "ssn", + "123", + "45", + "6789" + ] + }, + { + "in": 31, + "found": [ + "ssn", + "123456789" + ] + }, + { + "in": 32, + "found": [ + "id", + "1234567890123" + ] + }, + { + "in": 33, + "found": [ + "١٢٣٤٥٦٧٨" + ] + }, + { + "in": 34, + "found": [ + "digits", + "123" + ] + }, + { + "in": 35, + "found": [ + "Straße", + "12" + ] + }, + { + "in": 36, + "found": [ + "STRASSE", + "12" + ] + }, + { + "in": 37, + "found": [ + "café", + "au", + "lait" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + }, + { + "in": 39, + "found": [ + "naïve" + ] + }, + { + "in": 40, + "found": [ + "Σσς" + ] + }, + { + "in": 41, + "found": [ + "line", + "one", + "line", + "two" + ] + }, + { + "in": 42, + "found": [ + "trailing", + "newline" + ] + }, + { + "in": 43, + "found": [ + "tab", + "separated" + ] + }, + { + "in": 44, + "found": [ + "unit", + "separator" + ] + }, + { + "in": 45, + "found": [ + "next", + "line" + ] + }, + { + "in": 46, + "found": [ + "emoji", + "😀", + "face" + ] + }, + { + "in": 47, + "found": [ + "under_score_word" + ] + }, + { + "in": 48, + "found": [ + "Ⅷ", + "roman" + ] + }, + { + "in": 49, + "found": [ + "x́", + "combining" + ] + }, + { + "in": 50, + "found": [ + "a.b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "{\"ref\":", + "\"ORD-12345678\"}" + ] + }, + { + "in": 59, + "found": [ + "[1,", + "2,", + "3]" + ] + }, + { + "in": 60, + "found": [ + "refund", + "this", + "order" + ] + }, + { + "in": 61, + "found": [ + "REFUND", + "THIS", + "ORDER" + ] + }, + { + "in": 62, + "found": [ + "the", + "end" + ] + }, + { + "in": 63, + "found": [ + "end" + ] + }, + { + "in": 64, + "found": [ + "start" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "[\\W\\d]", + "outside": false, + "finds": [ + { + "in": 1, + "found": [ + " " + ] + }, + { + "in": 2, + "found": [ + " ", + " " + ] + }, + { + "in": 3, + "found": [ + " ", + "-", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + " " + ] + }, + { + "in": 4, + "found": [ + "-", + "1", + "2", + "3", + "4", + "5", + "6", + "7" + ] + }, + { + "in": 5, + "found": [ + "-", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "in": 6, + "found": [ + "-", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9" + ] + }, + { + "in": 7, + "found": [ + " ", + "4", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + " ", + "0", + "9", + "/", + "2", + "7" + ] + }, + { + "in": 8, + "found": [ + " ", + "4", + "1", + "1", + "1", + "-", + "1", + "1", + "1", + "1", + "-", + "1", + "1", + "1", + "1", + "-", + "1", + "1", + "1", + "1" + ] + }, + { + "in": 9, + "found": [ + " ", + "4", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1", + "1" + ] + }, + { + "in": 10, + "found": [ + "4", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1" + ] + }, + { + "in": 11, + "found": [ + "4", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1", + " ", + "1", + "1", + "1", + "1" + ] + }, + { + "in": 12, + "found": [ + "4", + "1", + "1", + "1", + ".", + "1", + "1", + "1", + "1", + ".", + "1", + "1", + "1", + "1", + ".", + "1", + "1", + "1", + "1" + ] + }, + { + "in": 13, + "found": [ + " ", + "1", + "2", + "3", + "4", + ".", + "5", + "6" + ] + }, + { + "in": 14, + "found": [ + " ", + "1", + ".", + "2", + ".", + "3" + ] + }, + { + "in": 15, + "found": [ + "6", + "0", + "1", + "1", + " ", + "0", + "0", + "0", + "9", + " ", + "9", + "0", + "1", + "3", + " ", + "9", + "4", + "2", + "4", + " ", + "1", + "2", + "3" + ] + }, + { + "in": 16, + "found": [ + " ", + "8", + "2", + " ", + " ", + "1", + "2", + "3", + "4", + " ", + "5", + "6", + "9", + "8", + " ", + "7", + "6", + "5", + "4", + " ", + "3", + "2" + ] + }, + { + "in": 17, + "found": [ + " ", + "8", + "2", + "1", + "2", + "3", + "4", + "5", + "6", + "9", + "8", + "7", + "6", + "5", + "4", + "3", + "2" + ] + }, + { + "in": 18, + "found": [ + " ", + " ", + "1", + "2", + "-", + "3", + "4", + "-", + "5", + "6" + ] + }, + { + "in": 19, + "found": [ + " ", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "in": 20, + "found": [ + " ", + "0", + "0", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9" + ] + }, + { + "in": 21, + "found": [ + " ", + "3", + "2", + "9", + "1", + "8", + "7", + "6", + "5", + "4", + "3", + "2", + "1", + "0", + "9", + "8", + "7" + ] + }, + { + "in": 22, + "found": [ + " ", + ".", + "+", + "@", + ".", + "." + ] + }, + { + "in": 23, + "found": [ + " ", + "@", + "." + ] + }, + { + "in": 24, + "found": [ + "@" + ] + }, + { + "in": 25, + "found": [ + " ", + "+", + "1", + " ", + "(", + "5", + "5", + "5", + ")", + " ", + "1", + "2", + "3", + "-", + "4", + "5", + "6", + "7" + ] + }, + { + "in": 26, + "found": [ + " ", + "0", + "2", + "0", + " ", + "7", + "9", + "4", + "6", + " ", + "0", + "9", + "5", + "8" + ] + }, + { + "in": 27, + "found": [ + " ", + "2", + "0", + "2", + "6", + "-", + "0", + "7", + "-", + "1", + "5" + ] + }, + { + "in": 28, + "found": [ + " ", + "2", + "0", + "2", + "6", + "-", + "1", + "0", + "-", + "0", + "5", + " ", + "0", + "9", + ":", + "0", + "0" + ] + }, + { + "in": 29, + "found": [ + " ", + "1", + "2", + "3", + "-", + "4", + "5", + "-", + "6", + "7", + "8", + "9" + ] + }, + { + "in": 30, + "found": [ + " ", + "1", + "2", + "3", + " ", + "4", + "5", + " ", + "6", + "7", + "8", + "9" + ] + }, + { + "in": 31, + "found": [ + " ", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9" + ] + }, + { + "in": 32, + "found": [ + " ", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "0", + "1", + "2", + "3" + ] + }, + { + "in": 33, + "found": [ + "١", + "٢", + "٣", + "٤", + "٥", + "٦", + "٧", + "٨" + ] + }, + { + "in": 34, + "found": [ + " ", + "1", + "2", + "3" + ] + }, + { + "in": 35, + "found": [ + " ", + "1", + "2" + ] + }, + { + "in": 36, + "found": [ + " ", + "1", + "2" + ] + }, + { + "in": 37, + "found": [ + " ", + " " + ] + }, + { + "in": 41, + "found": [ + " ", + "\n", + " " + ] + }, + { + "in": 42, + "found": [ + " ", + "\n" + ] + }, + { + "in": 43, + "found": [ + "\t" + ] + }, + { + "in": 44, + "found": [ + "\u001f" + ] + }, + { + "in": 45, + "found": [ + "…" + ] + }, + { + "in": 46, + "found": [ + " ", + "😀", + " " + ] + }, + { + "in": 48, + "found": [ + " " + ] + }, + { + "in": 49, + "found": [ + "́", + " " + ] + }, + { + "in": 50, + "found": [ + "." + ] + }, + { + "in": 51, + "found": [ + "\n" + ] + }, + { + "in": 52, + "found": [ + "\r" + ] + }, + { + "in": 56, + "found": [ + " " + ] + }, + { + "in": 58, + "found": [ + "{", + "\"", + "\"", + ":", + " ", + "\"", + "-", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "\"", + "}" + ] + }, + { + "in": 59, + "found": [ + "[", + "1", + ",", + " ", + "2", + ",", + " ", + "3", + "]" + ] + }, + { + "in": 60, + "found": [ + " ", + " " + ] + }, + { + "in": 61, + "found": [ + " ", + " " + ] + }, + { + "in": 62, + "found": [ + " " + ] + }, + { + "in": 63, + "found": [ + "\n" + ] + }, + { + "in": 64, + "found": [ + "\n" + ] + } + ] + }, + { + "looks-like": "[^\\s\\d]+", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "plain", + "words", + "only" + ] + }, + { + "in": 3, + "found": [ + "Order", + "ORD-", + "shipped" + ] + }, + { + "in": 4, + "found": [ + "ORD-" + ] + }, + { + "in": 5, + "found": [ + "ord-" + ] + }, + { + "in": 6, + "found": [ + "ORD-" + ] + }, + { + "in": 7, + "found": [ + "card", + "expires", + "/" + ] + }, + { + "in": 8, + "found": [ + "card", + "-", + "-", + "-" + ] + }, + { + "in": 9, + "found": [ + "card" + ] + }, + { + "in": 12, + "found": [ + ".", + ".", + "." + ] + }, + { + "in": 13, + "found": [ + "amount", + "." + ] + }, + { + "in": 14, + "found": [ + "version", + ".", + "." + ] + }, + { + "in": 16, + "found": [ + "IBAN", + "GB", + "WEST" + ] + }, + { + "in": 17, + "found": [ + "iban", + "gb", + "west" + ] + }, + { + "in": 18, + "found": [ + "sort", + "code", + "-", + "-" + ] + }, + { + "in": 19, + "found": [ + "account" + ] + }, + { + "in": 20, + "found": [ + "acct" + ] + }, + { + "in": 21, + "found": [ + "hash", + "f", + "a", + "c", + "b", + "e", + "d", + "a", + "f", + "e", + "d", + "c", + "b", + "a", + "f", + "e", + "d" + ] + }, + { + "in": 22, + "found": [ + "mail", + "jane.doe+desk@example.co.uk" + ] + }, + { + "in": 23, + "found": [ + "mail", + "jörg@bücher.de" + ] + }, + { + "in": 24, + "found": [ + "not@mail" + ] + }, + { + "in": 25, + "found": [ + "call", + "+", + "(", + ")", + "-" + ] + }, + { + "in": 26, + "found": [ + "call" + ] + }, + { + "in": 27, + "found": [ + "date", + "-", + "-" + ] + }, + { + "in": 28, + "found": [ + "at", + "-", + "-", + ":" + ] + }, + { + "in": 29, + "found": [ + "ssn", + "-", + "-" + ] + }, + { + "in": 30, + "found": [ + "ssn" + ] + }, + { + "in": 31, + "found": [ + "ssn" + ] + }, + { + "in": 32, + "found": [ + "id" + ] + }, + { + "in": 34, + "found": [ + "digits" + ] + }, + { + "in": 35, + "found": [ + "Straße" + ] + }, + { + "in": 36, + "found": [ + "STRASSE" + ] + }, + { + "in": 37, + "found": [ + "café", + "au", + "lait" + ] + }, + { + "in": 38, + "found": [ + "CAFÉ" + ] + }, + { + "in": 39, + "found": [ + "naïve" + ] + }, + { + "in": 40, + "found": [ + "Σσς" + ] + }, + { + "in": 41, + "found": [ + "line", + "one", + "line", + "two" + ] + }, + { + "in": 42, + "found": [ + "trailing", + "newline" + ] + }, + { + "in": 43, + "found": [ + "tab", + "separated" + ] + }, + { + "in": 44, + "found": [ + "unit", + "separator" + ] + }, + { + "in": 45, + "found": [ + "next", + "line" + ] + }, + { + "in": 46, + "found": [ + "emoji", + "😀", + "face" + ] + }, + { + "in": 47, + "found": [ + "under_score_word" + ] + }, + { + "in": 48, + "found": [ + "Ⅷ", + "roman" + ] + }, + { + "in": 49, + "found": [ + "x́", + "combining" + ] + }, + { + "in": 50, + "found": [ + "a.b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "ab" + ] + }, + { + "in": 54, + "found": [ + "AB" + ] + }, + { + "in": 55, + "found": [ + "aB" + ] + }, + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + }, + { + "in": 58, + "found": [ + "{\"ref\":", + "\"ORD-", + "\"}" + ] + }, + { + "in": 59, + "found": [ + "[", + ",", + ",", + "]" + ] + }, + { + "in": 60, + "found": [ + "refund", + "this", + "order" + ] + }, + { + "in": 61, + "found": [ + "REFUND", + "THIS", + "ORDER" + ] + }, + { + "in": 62, + "found": [ + "the", + "end" + ] + }, + { + "in": 63, + "found": [ + "end" + ] + }, + { + "in": 64, + "found": [ + "start" + ] + }, + { + "in": 65, + "found": [ + "k" + ] + }, + { + "in": 66, + "found": [ + "K" + ] + }, + { + "in": 67, + "found": [ + "K" + ] + } + ] + }, + { + "looks-like": "(?PORD)-\\d{3}", + "outside": false, + "finds": [ + { + "in": 3, + "found": [ + "ORD-123" + ] + }, + { + "in": 4, + "found": [ + "ORD-123" + ] + }, + { + "in": 6, + "found": [ + "ORD-123" + ] + }, + { + "in": 58, + "found": [ + "ORD-123" + ] + } + ] + }, + { + "looks-like": "a{2,}", + "outside": false, + "finds": [] + }, + { + "looks-like": "o{1,2}?", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "o", + "o" + ] + }, + { + "in": 5, + "found": [ + "o" + ] + }, + { + "in": 13, + "found": [ + "o" + ] + }, + { + "in": 14, + "found": [ + "o" + ] + }, + { + "in": 18, + "found": [ + "o", + "o" + ] + }, + { + "in": 19, + "found": [ + "o" + ] + }, + { + "in": 22, + "found": [ + "o", + "o" + ] + }, + { + "in": 24, + "found": [ + "o" + ] + }, + { + "in": 41, + "found": [ + "o", + "o" + ] + }, + { + "in": 44, + "found": [ + "o" + ] + }, + { + "in": 46, + "found": [ + "o" + ] + }, + { + "in": 47, + "found": [ + "o", + "o" + ] + }, + { + "in": 48, + "found": [ + "o" + ] + }, + { + "in": 49, + "found": [ + "o" + ] + }, + { + "in": 56, + "found": [ + "o", + "o" + ] + }, + { + "in": 57, + "found": [ + "o", + "o" + ] + }, + { + "in": 60, + "found": [ + "o" + ] + } + ] + }, + { + "looks-like": "x*?", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "\\x41", + "outside": false, + "finds": [ + { + "in": 16, + "found": [ + "A" + ] + }, + { + "in": 36, + "found": [ + "A" + ] + }, + { + "in": 38, + "found": [ + "A" + ] + }, + { + "in": 54, + "found": [ + "A" + ] + } + ] + }, + { + "looks-like": "\\u00e9", + "outside": false, + "finds": [ + { + "in": 37, + "found": [ + "é" + ] + } + ] + }, + { + "looks-like": "\\U0001F600", + "outside": false, + "finds": [ + { + "in": 46, + "found": [ + "😀" + ] + } + ] + }, + { + "looks-like": "\\.", + "outside": false, + "finds": [ + { + "in": 12, + "found": [ + ".", + ".", + "." + ] + }, + { + "in": 13, + "found": [ + "." + ] + }, + { + "in": 14, + "found": [ + ".", + "." + ] + }, + { + "in": 22, + "found": [ + ".", + ".", + "." + ] + }, + { + "in": 23, + "found": [ + "." + ] + }, + { + "in": 50, + "found": [ + "." + ] + } + ] + }, + { + "looks-like": "\\-", + "outside": false, + "finds": [ + { + "in": 3, + "found": [ + "-" + ] + }, + { + "in": 4, + "found": [ + "-" + ] + }, + { + "in": 5, + "found": [ + "-" + ] + }, + { + "in": 6, + "found": [ + "-" + ] + }, + { + "in": 8, + "found": [ + "-", + "-", + "-" + ] + }, + { + "in": 18, + "found": [ + "-", + "-" + ] + }, + { + "in": 25, + "found": [ + "-" + ] + }, + { + "in": 27, + "found": [ + "-", + "-" + ] + }, + { + "in": 28, + "found": [ + "-", + "-" + ] + }, + { + "in": 29, + "found": [ + "-", + "-" + ] + }, + { + "in": 58, + "found": [ + "-" + ] + } + ] + }, + { + "looks-like": "\\}", + "outside": false, + "finds": [ + { + "in": 58, + "found": [ + "}" + ] + } + ] + }, + { + "looks-like": "a|b|c", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "a" + ] + }, + { + "in": 7, + "found": [ + "c", + "a" + ] + }, + { + "in": 8, + "found": [ + "c", + "a" + ] + }, + { + "in": 9, + "found": [ + "c", + "a" + ] + }, + { + "in": 13, + "found": [ + "a" + ] + }, + { + "in": 17, + "found": [ + "b", + "a", + "b" + ] + }, + { + "in": 18, + "found": [ + "c" + ] + }, + { + "in": 19, + "found": [ + "a", + "c", + "c" + ] + }, + { + "in": 20, + "found": [ + "a", + "c", + "c" + ] + }, + { + "in": 21, + "found": [ + "a", + "a", + "c", + "b", + "a", + "c", + "b", + "a" + ] + }, + { + "in": 22, + "found": [ + "a", + "a", + "a", + "c" + ] + }, + { + "in": 23, + "found": [ + "a", + "b", + "c" + ] + }, + { + "in": 24, + "found": [ + "a" + ] + }, + { + "in": 25, + "found": [ + "c", + "a" + ] + }, + { + "in": 26, + "found": [ + "c", + "a" + ] + }, + { + "in": 27, + "found": [ + "a" + ] + }, + { + "in": 28, + "found": [ + "a" + ] + }, + { + "in": 35, + "found": [ + "a" + ] + }, + { + "in": 37, + "found": [ + "c", + "a", + "a", + "a" + ] + }, + { + "in": 39, + "found": [ + "a" + ] + }, + { + "in": 42, + "found": [ + "a" + ] + }, + { + "in": 43, + "found": [ + "a", + "b", + "a", + "a" + ] + }, + { + "in": 44, + "found": [ + "a", + "a" + ] + }, + { + "in": 46, + "found": [ + "a", + "c" + ] + }, + { + "in": 47, + "found": [ + "c" + ] + }, + { + "in": 48, + "found": [ + "a" + ] + }, + { + "in": 49, + "found": [ + "c", + "b" + ] + }, + { + "in": 50, + "found": [ + "a", + "b" + ] + }, + { + "in": 51, + "found": [ + "a", + "b" + ] + }, + { + "in": 52, + "found": [ + "a", + "b" + ] + }, + { + "in": 53, + "found": [ + "a", + "b" + ] + }, + { + "in": 55, + "found": [ + "a" + ] + }, + { + "in": 56, + "found": [ + "b", + "a" + ] + }, + { + "in": 57, + "found": [ + "b", + "a" + ] + }, + { + "in": 64, + "found": [ + "a" + ] + } + ] + }, + { + "looks-like": "(?:foo|bar)+", + "outside": false, + "finds": [ + { + "in": 56, + "found": [ + "foo", + "bar" + ] + }, + { + "in": 57, + "found": [ + "foobar" + ] + } + ] + }, + { + "looks-like": "[]a]", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "a" + ] + }, + { + "in": 7, + "found": [ + "a" + ] + }, + { + "in": 8, + "found": [ + "a" + ] + }, + { + "in": 9, + "found": [ + "a" + ] + }, + { + "in": 13, + "found": [ + "a" + ] + }, + { + "in": 17, + "found": [ + "a" + ] + }, + { + "in": 19, + "found": [ + "a" + ] + }, + { + "in": 20, + "found": [ + "a" + ] + }, + { + "in": 21, + "found": [ + "a", + "a", + "a", + "a" + ] + }, + { + "in": 22, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 23, + "found": [ + "a" + ] + }, + { + "in": 24, + "found": [ + "a" + ] + }, + { + "in": 25, + "found": [ + "a" + ] + }, + { + "in": 26, + "found": [ + "a" + ] + }, + { + "in": 27, + "found": [ + "a" + ] + }, + { + "in": 28, + "found": [ + "a" + ] + }, + { + "in": 35, + "found": [ + "a" + ] + }, + { + "in": 37, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 39, + "found": [ + "a" + ] + }, + { + "in": 42, + "found": [ + "a" + ] + }, + { + "in": 43, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 44, + "found": [ + "a", + "a" + ] + }, + { + "in": 46, + "found": [ + "a" + ] + }, + { + "in": 48, + "found": [ + "a" + ] + }, + { + "in": 50, + "found": [ + "a" + ] + }, + { + "in": 51, + "found": [ + "a" + ] + }, + { + "in": 52, + "found": [ + "a" + ] + }, + { + "in": 53, + "found": [ + "a" + ] + }, + { + "in": 55, + "found": [ + "a" + ] + }, + { + "in": 56, + "found": [ + "a" + ] + }, + { + "in": 57, + "found": [ + "a" + ] + }, + { + "in": 59, + "found": [ + "]" + ] + }, + { + "in": 64, + "found": [ + "a" + ] + } + ] + }, + { + "looks-like": "[a-]", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "a" + ] + }, + { + "in": 3, + "found": [ + "-" + ] + }, + { + "in": 4, + "found": [ + "-" + ] + }, + { + "in": 5, + "found": [ + "-" + ] + }, + { + "in": 6, + "found": [ + "-" + ] + }, + { + "in": 7, + "found": [ + "a" + ] + }, + { + "in": 8, + "found": [ + "a", + "-", + "-", + "-" + ] + }, + { + "in": 9, + "found": [ + "a" + ] + }, + { + "in": 13, + "found": [ + "a" + ] + }, + { + "in": 17, + "found": [ + "a" + ] + }, + { + "in": 18, + "found": [ + "-", + "-" + ] + }, + { + "in": 19, + "found": [ + "a" + ] + }, + { + "in": 20, + "found": [ + "a" + ] + }, + { + "in": 21, + "found": [ + "a", + "a", + "a", + "a" + ] + }, + { + "in": 22, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 23, + "found": [ + "a" + ] + }, + { + "in": 24, + "found": [ + "a" + ] + }, + { + "in": 25, + "found": [ + "a", + "-" + ] + }, + { + "in": 26, + "found": [ + "a" + ] + }, + { + "in": 27, + "found": [ + "a", + "-", + "-" + ] + }, + { + "in": 28, + "found": [ + "a", + "-", + "-" + ] + }, + { + "in": 29, + "found": [ + "-", + "-" + ] + }, + { + "in": 35, + "found": [ + "a" + ] + }, + { + "in": 37, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 39, + "found": [ + "a" + ] + }, + { + "in": 42, + "found": [ + "a" + ] + }, + { + "in": 43, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 44, + "found": [ + "a", + "a" + ] + }, + { + "in": 46, + "found": [ + "a" + ] + }, + { + "in": 48, + "found": [ + "a" + ] + }, + { + "in": 50, + "found": [ + "a" + ] + }, + { + "in": 51, + "found": [ + "a" + ] + }, + { + "in": 52, + "found": [ + "a" + ] + }, + { + "in": 53, + "found": [ + "a" + ] + }, + { + "in": 55, + "found": [ + "a" + ] + }, + { + "in": 56, + "found": [ + "a" + ] + }, + { + "in": 57, + "found": [ + "a" + ] + }, + { + "in": 58, + "found": [ + "-" + ] + }, + { + "in": 64, + "found": [ + "a" + ] + } + ] + }, + { + "looks-like": "[-a]", + "outside": false, + "finds": [ + { + "in": 2, + "found": [ + "a" + ] + }, + { + "in": 3, + "found": [ + "-" + ] + }, + { + "in": 4, + "found": [ + "-" + ] + }, + { + "in": 5, + "found": [ + "-" + ] + }, + { + "in": 6, + "found": [ + "-" + ] + }, + { + "in": 7, + "found": [ + "a" + ] + }, + { + "in": 8, + "found": [ + "a", + "-", + "-", + "-" + ] + }, + { + "in": 9, + "found": [ + "a" + ] + }, + { + "in": 13, + "found": [ + "a" + ] + }, + { + "in": 17, + "found": [ + "a" + ] + }, + { + "in": 18, + "found": [ + "-", + "-" + ] + }, + { + "in": 19, + "found": [ + "a" + ] + }, + { + "in": 20, + "found": [ + "a" + ] + }, + { + "in": 21, + "found": [ + "a", + "a", + "a", + "a" + ] + }, + { + "in": 22, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 23, + "found": [ + "a" + ] + }, + { + "in": 24, + "found": [ + "a" + ] + }, + { + "in": 25, + "found": [ + "a", + "-" + ] + }, + { + "in": 26, + "found": [ + "a" + ] + }, + { + "in": 27, + "found": [ + "a", + "-", + "-" + ] + }, + { + "in": 28, + "found": [ + "a", + "-", + "-" + ] + }, + { + "in": 29, + "found": [ + "-", + "-" + ] + }, + { + "in": 35, + "found": [ + "a" + ] + }, + { + "in": 37, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 39, + "found": [ + "a" + ] + }, + { + "in": 42, + "found": [ + "a" + ] + }, + { + "in": 43, + "found": [ + "a", + "a", + "a" + ] + }, + { + "in": 44, + "found": [ + "a", + "a" + ] + }, + { + "in": 46, + "found": [ + "a" + ] + }, + { + "in": 48, + "found": [ + "a" + ] + }, + { + "in": 50, + "found": [ + "a" + ] + }, + { + "in": 51, + "found": [ + "a" + ] + }, + { + "in": 52, + "found": [ + "a" + ] + }, + { + "in": 53, + "found": [ + "a" + ] + }, + { + "in": 55, + "found": [ + "a" + ] + }, + { + "in": 56, + "found": [ + "a" + ] + }, + { + "in": 57, + "found": [ + "a" + ] + }, + { + "in": 58, + "found": [ + "-" + ] + }, + { + "in": 64, + "found": [ + "a" + ] + } + ] + }, + { + "looks-like": "[\\]]", + "outside": false, + "finds": [ + { + "in": 59, + "found": [ + "]" + ] + } + ] + }, + { + "looks-like": "[\\\\]", + "outside": false, + "finds": [] + }, + { + "looks-like": "refund (this|that) order", + "outside": false, + "finds": [ + { + "in": 60, + "found": [ + "refund this order" + ] + } + ] + }, + { + "looks-like": "\\t", + "outside": false, + "finds": [ + { + "in": 43, + "found": [ + "\t" + ] + } + ] + }, + { + "looks-like": "\\n", + "outside": false, + "finds": [ + { + "in": 41, + "found": [ + "\n" + ] + }, + { + "in": 42, + "found": [ + "\n" + ] + }, + { + "in": 51, + "found": [ + "\n" + ] + }, + { + "in": 63, + "found": [ + "\n" + ] + }, + { + "in": 64, + "found": [ + "\n" + ] + } + ] + }, + { + "looks-like": "(?<=x)y", + "outside": true, + "reason": "a lookaround `(?<=...)`, which the Rust regex crate does not read" + }, + { + "looks-like": "(?=a)", + "outside": true, + "reason": "a lookaround `(?=...)`, which the Rust regex crate does not read" + }, + { + "looks-like": "(a)\\1", + "outside": true, + "reason": "`\\1`, a back-reference or an octal escape, which the Rust regex crate does not read" + }, + { + "looks-like": "a{,3}", + "outside": true, + "reason": "a `{,m}` quantifier with no lower bound, which the Rust regex crate does not read; write `{0,m}`" + }, + { + "looks-like": "(?i)foo", + "outside": true, + "reason": "a flag for the whole pattern, which the reference adapter cannot read inside a detector; write `(?i:...)` around the part it applies to" + }, + { + "looks-like": "a++", + "outside": true, + "reason": "a possessive quantifier, which the Rust regex crate does not read" + }, + { + "looks-like": "[[:alpha:]]", + "outside": true, + "reason": "a `[` inside a class, which the Rust regex crate reads as a nested class; write `\\[`" + }, + { + "looks-like": "[a&&b]", + "outside": true, + "reason": "`&&` inside a class, which the Rust regex crate reads as a set operation; escape one of the two" + }, + { + "looks-like": "\\p{L}", + "outside": true, + "reason": "the escape `\\p`, which Python's re and the Rust regex crate do not read alike" + }, + { + "looks-like": "\\z", + "outside": true, + "reason": "the escape `\\z`, which Python's re and the Rust regex crate do not read alike" + }, + { + "looks-like": "(?#note)a", + "outside": true, + "reason": "a comment group, which the Rust regex crate does not read" + }, + { + "looks-like": "(?>a)", + "outside": true, + "reason": "an atomic group, which the Rust regex crate does not read" + }, + { + "looks-like": "(?a)", + "outside": true, + "reason": "a named group written `(?...)`, which Python's re refuses; write `(?P...)`" + }, + { + "looks-like": "a{", + "outside": true, + "reason": "a `{` that is no quantifier; write `\\{` for the character" + }, + { + "looks-like": "{2}", + "outside": true, + "reason": "a quantifier with nothing before it to repeat" + }, + { + "looks-like": "*a", + "outside": true, + "reason": "a quantifier with nothing before it to repeat" + }, + { + "looks-like": "(a", + "outside": true, + "reason": "a group that is never closed" + }, + { + "looks-like": "a)", + "outside": true, + "reason": "a `)` that closes no group; write `\\)` for the character" + }, + { + "looks-like": "[a", + "outside": true, + "reason": "a class `[` that is never closed" + }, + { + "looks-like": "\\0", + "outside": true, + "reason": "`\\0`, a back-reference or an octal escape, which the Rust regex crate does not read" + }, + { + "looks-like": "(?x:a b)", + "outside": true, + "reason": "the flag `x`, which the PACT dialect does not read; it reads `i`, `m` and `s`" + }, + { + "looks-like": "(?-i:a)", + "outside": true, + "reason": "a group that turns a flag off, which the PACT dialect does not read" + }, + { + "looks-like": "[\\d-z]", + "outside": true, + "reason": "a range whose end is a class such as `\\d`" + }, + { + "looks-like": "[z-a]", + "outside": true, + "reason": "a range whose end comes before its start" + }, + { + "looks-like": "[\\b]", + "outside": true, + "reason": "`\\b` inside a class, which Python reads as a backspace and the Rust regex crate refuses" + }, + { + "looks-like": "a**", + "outside": true, + "reason": "two quantifiers in a row; put the first in a group `(?:...)`" + }, + { + "looks-like": "a{4294967295}", + "outside": true, + "reason": "a quantifier `{4294967295}` above the largest repetition count Python's re reads" + }, + { + "looks-like": "(?i:[à-ÿ])", + "outside": true, + "reason": "a range of letters beyond ASCII inside `(?i:...)`, which the PACT dialect does not read; list the letters" + }, + { + "looks-like": "(?Pa)(?Pb)", + "outside": true, + "reason": "the group name `n` written twice" + }, + { + "looks-like": "é+", + "outside": false, + "finds": [ + { + "in": 37, + "found": [ + "é" + ] + } + ] + }, + { + "looks-like": "😀", + "outside": false, + "finds": [ + { + "in": 46, + "found": [ + "😀" + ] + } + ] + }, + { + "looks-like": "a?", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "^$", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "\\b", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "(?:a|)", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "a{0,3}", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "(?:ab)*|c", + "outside": true, + "reason": "a pattern that can match an empty value, so it finds something in every text and runtimes disagree on what; make every branch need at least one character" + }, + { + "looks-like": "(?i:ORD)-\\d{8}", + "outside": false, + "finds": [ + { + "in": 3, + "found": [ + "ORD-12345678" + ] + }, + { + "in": 5, + "found": [ + "ord-12345678" + ] + }, + { + "in": 6, + "found": [ + "ORD-12345678" + ] + }, + { + "in": 58, + "found": [ + "ORD-12345678" + ] + } + ] + }, + { + "looks-like": "[A-Z]{2}\\d{6}", + "outside": false, + "finds": [] + }, + { + "looks-like": "\\bR-\\d+\\b", + "outside": false, + "finds": [] + } + ] +} From b880443c85b56ee06d509aafab17e01149e51e41 Mon Sep 17 00:00:00 2001 From: Jithin VG Date: Tue, 17 Nov 2026 10:42:32 +0530 Subject: [PATCH 2/3] Read starts_with as a zip, as newer clippy asks (explicit_counter_loop) Co-Authored-By: Claude Opus 5.5 --- crates/pact-loader/src/dialect.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/crates/pact-loader/src/dialect.rs b/crates/pact-loader/src/dialect.rs index f54c46a..e2a1040 100644 --- a/crates/pact-loader/src/dialect.rs +++ b/crates/pact-loader/src/dialect.rs @@ -116,14 +116,7 @@ impl Reader { } fn starts_with(&self, text: &str) -> bool { - let mut i = self.at; - for c in text.chars() { - if self.chars.get(i) != Some(&c) { - return false; - } - i += 1; - } - true + (self.at..).zip(text.chars()).all(|(i, c)| self.chars.get(i) == Some(&c)) } fn pattern(&mut self) -> Read<()> { From 9f6e3c949fd56d4029cd849c22a73efca751ede4 Mon Sep 17 00:00:00 2001 From: Jithin VG Date: Tue, 17 Nov 2026 14:45:16 +0530 Subject: [PATCH 3/3] Count the merged tests where the documents state them (scripts/sync-counts.sh) --- README.md | 4 ++-- docs/90-REVIEW.md | 4 ++-- site-docs/index.md | 2 +- site-docs/status/verified.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b9b854a..32aabaa 100644 --- a/README.md +++ b/README.md @@ -1001,11 +1001,11 @@ framework is an extra. |---|---| | **Design** | Thesis, 29 binding decisions, FRD (120 requirements), 60-row refusal ledger — complete | | **Research** | 14 source-grounded studies, ~15,750 lines, over 140 repos (~15 GB) + 57 papers | -| **Code** | Loader, diagnostics, schema engine, CLI, harness, resolver, evals, SLO — **5384 tests (1730 Rust + 3654 adapter), clippy clean, TypeScript type-checked** | +| **Code** | Loader, diagnostics, schema engine, CLI, harness, resolver, evals, SLO — **5392 tests (1733 Rust + 3659 adapter), clippy clean, TypeScript type-checked** | | **Adapters** | **All 7 named targets**, proven against one shared conformance suite | ```bash -./scripts/test-all.sh # 5384 tests, Rust + 7 adapters, fully offline +./scripts/test-all.sh # 5392 tests, Rust + 7 adapters, fully offline ``` **What is still owed** is not hidden — it lives in diff --git a/docs/90-REVIEW.md b/docs/90-REVIEW.md index 8867e11..3a717da 100644 --- a/docs/90-REVIEW.md +++ b/docs/90-REVIEW.md @@ -80,8 +80,8 @@ them and changes nothing. | | | |---|---| | Schema | **43 groups, 262 field entries, 207 distinct field names** (core 123, expert 69, both 15), 40 closed enums, 27 cross-reference constraints, **0 fields missing `tier:` or `surface:`** | -| Rust | 5 crates, **1730 tests**, `unsafe_code = forbid`, clippy-deny, edition 2024 | -| Python | **47 modules** (`find adapters/python/src -name "*.py" \| wc -l`), **3654 tests**, **nine transports** — seven model-bound (`anthropic`, `autogen`, `langchain`, `langgraph`, `ollama`, `openai_agents`, `pydantic_ai`), one bound to a remote *agent* (`a2a`), one deterministic mock; `_metering.py`, `_summarise.py` and `_tool_choice.py` are shared code the transports import, which is what the `_` says — offline by default | +| Rust | 5 crates, **1733 tests**, `unsafe_code = forbid`, clippy-deny, edition 2024 | +| Python | **47 modules** (`find adapters/python/src -name "*.py" \| wc -l`), **3659 tests**, **nine transports** — seven model-bound (`anthropic`, `autogen`, `langchain`, `langgraph`, `ollama`, `openai_agents`, `pydantic_ai`), one bound to a remote *agent* (`a2a`), one deterministic mock; `_metering.py`, `_summarise.py` and `_tool_choice.py` are shared code the transports import, which is what the `_` says — offline by default | | TypeScript | 5 modules, 2,305 lines, a second port of **the stepping, the ceilings and the stage path** (`harness.ts:15-21`: *"AC-5.3's bar is the stage path"*) — **not** of the loop entire: no interceptor chain, no durable suspension record, no ledger (`notDoneHere`; a park returns `halted: "suspended"` and writes nothing down). This row is load-bearing for the Phase 3 pricing below (E4) | | CLI | **6 verbs**: `check`, `show`, `waits`, `discover`, `card`, `help` | | Worked example | 42 files, 1128 lines, **132 distinct authored keys**, `pact check` → OK (498 settings) | diff --git a/site-docs/index.md b/site-docs/index.md index 64f594c..2d159a6 100644 --- a/site-docs/index.md +++ b/site-docs/index.md @@ -47,7 +47,7 @@ so plainly rather than leaving it to be discovered. | | | |---|---| -| Tests | **5,384** — 1730 Rust, 3654 adapter | +| Tests | **5,392** — 1733 Rust, 3659 adapter | | Schema kinds | **72** | | Framework targets | **7**, over 2 runtimes | | Eve capabilities accounted for | **101 of 101** | diff --git a/site-docs/status/verified.md b/site-docs/status/verified.md index f1c59b7..d654566 100644 --- a/site-docs/status/verified.md +++ b/site-docs/status/verified.md @@ -12,9 +12,9 @@ from an earlier document. | Claim | Value | How to check | |---|---|---| -| Rust tests | **1730** | `cargo test --workspace` | -| Adapter tests | **3654** | `cd adapters/python && uv run pytest tests/ -q` | -| Total | **5,384** | both of the above | +| Rust tests | **1733** | `cargo test --workspace` | +| Adapter tests | **3659** | `cd adapters/python && uv run pytest tests/ -q` | +| Total | **5,392** | both of the above | | TypeScript type-checks | clean | `cd adapters/typescript && npx tsc --noEmit` | | Lints | clean | `cargo clippy --all-targets` | | Worked example loads | 498 settings | `cargo run -p pact-cli -- check examples/refund-desk` |