foldkit-entity 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["NUL","chosen"],"sources":["../../src/conformance/operator.ts","../../src/conformance/index.ts"],"sourcesContent":["/**\n * An operator held to what it declares (expr-operations-DESIGN §10.4): its\n * laws tested against an implementation, and one set of calls run through\n * every implementation given, their answers and refusals compared.\n *\n * Cases are drawn from a fixed sample of each kind of value (text with the\n * empty string, mixed case, non-ASCII and an astral character; numbers with\n * zero, negatives and a fraction; both booleans), kept where the operator's\n * input schema and the law's domain decode them, and chosen by a seeded\n * shuffle when there are more than asked for, so a run is repeatable.\n */\nimport { Data, Option, Schema, SchemaAST } from 'effect'\nimport {\n Collation,\n Evidence,\n Expr,\n Law,\n Operators,\n QueryEvaluateError,\n valueOfOperand,\n type LawDescription,\n type MemoryOperators,\n type Operandish,\n type Operator,\n type TestedEvidence,\n} from '../index.js'\n\ntype AnyOperator = Operator<ReadonlyArray<Schema.Top>, Schema.Top>\n\n/** What an implementation said of one call: a value, or that it refused it. */\nexport type Outcome = Data.TaggedEnum<{\n Value: { readonly value: unknown }\n Refused: { readonly reason: string }\n}>\nexport const Outcome = Data.taggedEnum<Outcome>()\n\n/** What `Conformance.laws` found: every law held, with the evidence, or the first case one did not. */\nexport type LawsVerdict = Data.TaggedEnum<{\n Holds: { readonly evidence: ReadonlyArray<TestedEvidence> }\n Counterexample: {\n readonly law: LawDescription\n readonly args: ReadonlyArray<unknown>\n readonly left: Outcome\n readonly right: Outcome\n }\n}>\nexport const LawsVerdict = Data.taggedEnum<LawsVerdict>()\n\n/**\n * One way to run a call: its value, or a throw for a call it refuses. A call\n * of a predicate answers its truth, unknown as `null`.\n */\nexport type Runner = (call: Operandish) => unknown\n\n/** A call the implementations did not agree on, with what each said. */\nexport interface Disagreement {\n readonly args: ReadonlyArray<unknown>\n readonly collation: Option.Option<Collation>\n readonly outcomes: Readonly<Record<string, Outcome>>\n}\n\nexport interface OperatorReport {\n /** How many calls ran, each through every implementation. */\n readonly cases: number\n readonly disagreements: ReadonlyArray<Disagreement>\n}\n\nconst NUL = String.fromCharCode(0)\n// 'B' sorts before 'a' by code point and after it folded: what tells the collations apart.\nconst texts = ['', 'a', 'A', 'ab', 'aB', 'b', 'B', 'é', 'É', String.fromCodePoint(0x1f600)]\nconst numbers = [-2, -1, 0, 1, 2, 7, 0.5, -0.5, 1e6]\nconst booleans = [true, false]\n\n/** The sample values of a stored kind, before any schema narrows them. */\nconst candidates = (ast: SchemaAST.AST): ReadonlyArray<unknown> => {\n if (SchemaAST.isString(ast) || SchemaAST.isTemplateLiteral(ast)) return texts\n if (SchemaAST.isNumber(ast)) return numbers\n if (SchemaAST.isBoolean(ast)) return booleans\n if (SchemaAST.isLiteral(ast)) return [ast.literal]\n if (SchemaAST.isUnion(ast)) return ast.types.flatMap(candidates)\n return []\n}\n\n/** Whether a stored value is one `schema` stores. */\nconst decodes = (schema: Schema.Top) => (value: unknown) =>\n Schema.is(Schema.toEncoded(schema))(value)\n\n/** The non-null samples every schema of `schemas` decodes, and the domain too when one is given. */\nconst samplesOf = (\n schemas: ReadonlyArray<Schema.Top>,\n domain: Option.Option<Schema.Top>,\n): ReadonlyArray<unknown> =>\n [...new Set(candidates(Schema.toEncoded(schemas[0]!).ast))].filter(\n value =>\n value !== null &&\n schemas.every(schema => decodes(schema)(value)) &&\n Option.match(domain, { onNone: () => true, onSome: within => decodes(within)(value) }),\n )\n\n/** Every tuple of one value from each list. */\nconst product = (\n lists: ReadonlyArray<ReadonlyArray<unknown>>,\n): ReadonlyArray<ReadonlyArray<unknown>> =>\n lists.reduce<ReadonlyArray<ReadonlyArray<unknown>>>(\n (tuples, list) => tuples.flatMap(tuple => list.map(value => [...tuple, value])),\n [[]],\n )\n\n/** A small seeded generator (mulberry32), so a chosen subset is the same on every run. */\nconst random = (seed: number) => {\n let state = seed >>> 0\n return () => {\n state = (state + 0x6d2b79f5) >>> 0\n let t = state\n t = Math.imul(t ^ (t >>> 15), t | 1)\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61)\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n }\n}\n\n/** At most `limit` of the tuples, a seeded shuffle choosing which when there are more. */\nconst chosen = <A>(tuples: ReadonlyArray<A>, limit: number, seed: number): ReadonlyArray<A> => {\n if (tuples.length <= limit) return tuples\n const next = random(seed)\n const shuffled = [...tuples]\n for (let i = shuffled.length - 1; i > 0; i--) {\n const j = Math.floor(next() * (i + 1))\n ;[shuffled[i], shuffled[j]] = [shuffled[j]!, shuffled[i]!]\n }\n return shuffled.slice(0, limit)\n}\n\n/** Two outcomes alike: equal values as stored, or both refusals. */\nconst same = (left: Outcome, right: Outcome): boolean =>\n left._tag === 'Refused' || right._tag === 'Refused'\n ? left._tag === right._tag\n : JSON.stringify(left.value) === JSON.stringify(right.value)\n\n/** Two values of one kind in order: numbers, booleans, text by code point. */\nconst order = (left: unknown, right: unknown): number =>\n typeof left === 'string' && typeof right === 'string'\n ? left < right\n ? -1\n : left > right\n ? 1\n : 0\n : Number(left) - Number(right)\n\n/** A call of `op`, given `collation` when its rule takes one. */\nconst callOf = (\n op: AnyOperator,\n args: ReadonlyArray<unknown>,\n collation: Option.Option<Collation>,\n): Operandish =>\n Option.match(collation, {\n onNone: () => op(...args),\n onSome: each => op(...args, { collation: each }),\n })\n\n/** One equation's two sides for one tuple, and whether they keep the law. */\ninterface Check {\n readonly args: ReadonlyArray<unknown>\n readonly left: Outcome\n readonly right: Outcome\n readonly holds: boolean\n}\n\nconst foldText = (value: unknown): unknown =>\n typeof value === 'string' ? Collation.foldAscii(value) : value\n\nexport const Conformance = {\n /** A runner of calls through a memory table: `Conformance.operator`'s for the in-memory interpreter. */\n memory:\n (operators: MemoryOperators): Runner =>\n call =>\n valueOfOperand(call, { operators }),\n\n /**\n * Tests every law `op` declares against `operators`' implementation of it,\n * up to `cases` tuples a law (200 by default), chosen by `seed` (0); a law\n * of both sides checks each tuple from each. Holds\n * with a `Tested` record a law, which `Operators.withEvidence` keeps; or the\n * first case a law fails, with both sides.\n */\n laws: <In extends ReadonlyArray<Schema.Top>, Out extends Schema.Top>(\n op: Operator<In, Out>,\n operators: MemoryOperators,\n options: {\n readonly implementation?: string | undefined\n readonly cases?: number | undefined\n readonly seed?: number | undefined\n } = {},\n ): LawsVerdict => {\n const operator: AnyOperator = op\n const { descriptor } = operator\n const limit = options.cases ?? 200\n const seed = options.seed ?? 0\n const name = descriptor.version === 1 ? descriptor.id : `${descriptor.id}@${descriptor.version}`\n // The kernel compares text only under a collation, and literals bring none.\n const collation =\n descriptor.collation === 'none' ? Option.none<Collation>() : Option.some(Collation.binary)\n const outcome = (node: Operandish): Outcome => {\n try {\n return Outcome.Value({ value: valueOfOperand(node, { operators }) })\n } catch (error) {\n if (error instanceof QueryEvaluateError) return Outcome.Refused({ reason: error.message })\n throw error\n }\n }\n const call = (...args: ReadonlyArray<unknown>) => callOf(operator, args, collation)\n const check = (args: ReadonlyArray<unknown>, left: Outcome, right: Outcome): Check => ({\n args,\n left,\n right,\n holds: same(left, right),\n })\n const evidence: Array<TestedEvidence> = []\n for (const law of descriptor.laws) {\n const shared = samplesOf(descriptor.input, law.domain)\n const tuples = (arity: number) =>\n chosen(product(Array.from({ length: arity }, () => shared)), limit, seed)\n const sided = (\n value: unknown,\n side: 'left' | 'right' | 'both',\n answer: (a: unknown) => unknown,\n ) =>\n tuples(1).flatMap(([a]) => [\n ...(side === 'right'\n ? []\n : [check([value, a], outcome(call(value, a)), Outcome.Value({ value: answer(a) }))]),\n ...(side === 'left'\n ? []\n : [check([a, value], outcome(call(a, value)), Outcome.Value({ value: answer(a) }))]),\n ])\n const checks: ReadonlyArray<Check> = Law.$match(law, {\n Associative: () =>\n tuples(3).map(([a, b, c]) =>\n check([a, b, c], outcome(call(call(a, b), c)), outcome(call(a, call(b, c)))),\n ),\n Commutative: () =>\n tuples(2).map(([a, b]) => check([a, b], outcome(call(a, b)), outcome(call(b, a)))),\n Idempotent: () =>\n tuples(1).map(([a]) => check([a], outcome(call(a, a)), Outcome.Value({ value: a }))),\n Identity: ({ value, side }) => sided(value, side, a => a),\n Absorbing: ({ value, side }) => sided(value, side, () => value),\n Inverse: ({ other, identity }) =>\n tuples(1).map(([a]) =>\n check([a], outcome(call(a, other(a))), Outcome.Value({ value: identity })),\n ),\n Distributes: ({ over }) =>\n tuples(3).map(([a, b, c]) =>\n check([a, b, c], outcome(call(a, over(b, c))), outcome(over(call(a, b), call(a, c)))),\n ),\n Monotonic: ({ direction, position }) => {\n const each = descriptor.input.map(schema => samplesOf([schema], law.domain))\n const pairs = each[position]!.flatMap(low =>\n each[position]!.filter(high => order(low, high) < 0).map(high => [low, high] as const),\n )\n const rest = product(each.filter((_, index) => index !== position))\n return chosen(product([pairs, rest]), limit, seed).map(([pair, others]) => {\n const [low, high] = pair as readonly [unknown, unknown]\n const at = (value: unknown) => {\n const args = [...(others as ReadonlyArray<unknown>)]\n args.splice(position, 0, value)\n return args\n }\n const left = outcome(call(...at(low)))\n const right = outcome(call(...at(high)))\n const sign = direction === 'increasing' ? 1 : -1\n return {\n args: at(low),\n left,\n right,\n holds:\n left._tag === 'Value' &&\n right._tag === 'Value' &&\n sign * order(left.value, right.value) <= 0,\n }\n })\n },\n PreservesCollation: () =>\n tuples(2).map(([a, b]) => {\n const folded = (node: Operandish) =>\n Outcome.$match(outcome(node), {\n Value: ({ value }) => Outcome.Value({ value: foldText(value) }),\n Refused: refused => refused,\n })\n const under = (x: unknown, y: unknown) =>\n callOf(operator, [x, y], Option.some(Collation.asciiFold))\n return check([a, b], folded(under(a, b)), folded(under(foldText(a), foldText(b))))\n }),\n })\n if (checks.length === 0) {\n throw new Error(\n `[foldkit-entity] Conformance.laws: no sample of ${name}'s arguments is in ${Law.describe(law).kind}'s domain`,\n )\n }\n const failed = checks.find(each => !each.holds)\n if (failed !== undefined) {\n return LawsVerdict.Counterexample({\n law: Law.describe(law),\n args: failed.args,\n left: failed.left,\n right: failed.right,\n })\n }\n evidence.push(\n Evidence.Tested({\n operator: name,\n law: Law.describe(law),\n implementation: options.implementation ?? 'memory',\n cases: checks.length,\n seed,\n }),\n )\n }\n return LawsVerdict.Holds({ evidence })\n },\n\n /**\n * Runs one set of calls of `op` through every implementation and compares\n * what each answered or refused. The calls are `cases` (argument tuples, as\n * stored), or generated: each argument a sample of its kind, null where its\n * schema admits one, and text holding NUL, under `binary` and `asciiFold` where the operator compares\n * text, up to `limit` (300) chosen by `seed` (0). A defined operator's\n * expansion is run beside the others, as `expansion`, by `expansionTable`\n * (the kernel's when not given).\n */\n operator: async <In extends ReadonlyArray<Schema.Top>, Out extends Schema.Top>(\n op: Operator<In, Out>,\n options: {\n readonly implementations: Readonly<Record<string, Runner>>\n readonly cases?: ReadonlyArray<ReadonlyArray<unknown>> | undefined\n readonly limit?: number | undefined\n readonly seed?: number | undefined\n readonly expansionTable?: MemoryOperators | undefined\n },\n ): Promise<OperatorReport> => {\n const operator: AnyOperator = op\n const { descriptor } = operator\n const runners: Record<string, Runner> = { ...options.implementations }\n if (Option.isSome(descriptor.definedAs)) {\n const table = options.expansionTable ?? Operators.kernel\n runners.expansion = call => valueOfOperand(Expr.expanded(call), { operators: table })\n }\n const generated = () =>\n chosen(\n product(\n descriptor.input.map(schema => {\n const text = candidates(Schema.toEncoded(schema).ast).some(\n value => typeof value === 'string',\n )\n // Null only where the schema admits it: a call refuses a null literal otherwise.\n const nulls = decodes(schema)(null) ? [null] : []\n return [...nulls, ...samplesOf([schema], Option.none()), ...(text ? [`a${NUL}`] : [])]\n }),\n ),\n options.limit ?? 300,\n options.seed ?? 0,\n )\n const collations =\n descriptor.collation === 'none'\n ? [Option.none<Collation>()]\n : [Option.some(Collation.binary), Option.some(Collation.asciiFold)]\n const disagreements: Array<Disagreement> = []\n let cases = 0\n for (const args of options.cases ?? generated()) {\n for (const collation of collations) {\n cases += 1\n const call = callOf(operator, args, collation)\n const outcomes: Record<string, Outcome> = {}\n for (const [name, run] of Object.entries(runners)) {\n try {\n outcomes[name] = Outcome.Value({ value: await run(call) })\n } catch (error) {\n outcomes[name] = Outcome.Refused({ reason: String(error) })\n }\n }\n const [first, ...others] = Object.values(outcomes)\n if (first !== undefined && others.some(each => !same(first, each))) {\n disagreements.push({ args, collation, outcomes })\n }\n }\n }\n return { cases, disagreements }\n },\n}\n","/**\n * The conformance suite for a query body: what\n * [data-query-DESIGN §6.0.1](../../../../docs/design/data-query-DESIGN.md) says\n * each operator means, as cases an interpreter can be run against.\n *\n * Exported rather than kept in this repository's tests, because the interpreter\n * most worth checking against it is one written elsewhere: run every case\n * through yours and compare the ids, in order, against `expected`.\n *\n * §18 names portable-kernel conformance as what the reference interpreter is\n * for. This is that, extracted: one set of cases, run against every interpreter\n * rather than each interpreter having its own tests that happen to agree.\n * `foldkit-remote-server` runs them over rows in memory;\n * `foldkit-remote-drizzle` compiles them to SQL and runs them against a real\n * SQLite. A body that means two things fails in whichever is wrong.\n *\n * The cases are chosen to make interpreters *disagree*, which is the only kind\n * that tests anything. A fixture whose values are all lowercase cannot tell a\n * case-sensitive `contains` from a case-insensitive one — that is not a\n * hypothetical, it is how `contains` reached a released package meaning three\n * different things.\n */\nimport { Schema, SchemaGetter } from 'effect'\nimport { Collation, Entity, Expr, Order, Query, Text, type AnyQuery } from '../index.js'\n\n/**\n * A `Date` on the way in, an ISO string on the wire — the one fixture whose\n * **encoded form differs from its decoded form**.\n *\n * Every other column here encodes to itself, which is why the suite could not\n * previously see an interpreter comparing a decoded value against an encoded\n * row. That is not a hypothetical bug: a store holds wire values and decodes at\n * read, while a `QueryRef`'s input and a body's literals are written in domain\n * terms, so anything that runs a body over stored rows has to reconcile the two\n * and nothing was checking that it did.\n */\nconst Timestamp = Schema.Date.pipe(\n Schema.encodeTo(Schema.String, {\n decode: SchemaGetter.transform((iso: string) => new Date(iso)),\n encode: SchemaGetter.transform((at: Date) => at.toISOString()),\n }),\n)\n\n/** The one Entity every case reads, with a column of each kind that matters. */\nexport const Subject = Entity.define(\n 'Subject',\n Schema.Struct({\n id: Schema.String,\n /** Mixed case on purpose: a case-blind `contains` must be caught. */\n label: Schema.String,\n rank: Schema.Number,\n /** Nullable on purpose: three-valued logic has to be exercised. */\n tag: Schema.String,\n /** Encoded and decoded forms differ on purpose: see `Timestamp`. */\n at: Timestamp,\n }),\n)\n\n/**\n * How a row looks to an interpreter reading values, and to SQL as a table. The\n * index signature is what lets one be read by key without a cast, which is how\n * an interpreter over plain rows reads one.\n */\nexport interface ConformanceRow {\n readonly id: string\n readonly label: string\n readonly rank: number\n readonly tag: string | null\n /** The **encoded** form: what a store holds and an interpreter compares. */\n readonly at: string\n readonly [key: string]: unknown\n}\n\nexport const rows: ReadonlyArray<ConformanceRow> = [\n { id: 'a', label: 'Intro', rank: 2, tag: null, at: '2026-01-01T00:00:00.000Z' },\n { id: 'b', label: 'intro to sql', rank: 1, tag: 'x', at: '2026-01-02T00:00:00.000Z' },\n { id: 'c', label: 'Other', rank: 3, tag: null, at: '2026-01-02T00:00:00.000Z' },\n { id: 'd', label: '100% cotton', rank: 3, tag: 'x', at: '2026-01-03T00:00:00.000Z' },\n { id: 'e', label: 'snake_case', rank: 4, tag: 'y', at: '2026-01-04T00:00:00.000Z' },\n]\n\nexport interface ConformanceCase {\n /** What the case pins, as a sentence an interpreter fails by name. */\n readonly what: string\n readonly body: AnyQuery\n /**\n * The inputs, **encoded** — the space a store's rows are in, not the domain\n * space the body's types describe. For every column but `at` the two are the\n * same value, which is exactly why this has to be said rather than inferred\n * from the fixtures.\n */\n readonly input: Readonly<Record<string, unknown>>\n /** The ids the body matches, in the order it asks for. */\n readonly expected: ReadonlyArray<string>\n}\n\nconst from = Query.from(Subject)\nconst byId = Query.orderBy(Order.asc(Subject.fields.id))\nconst label = Expr.input('label', Schema.String)\nconst text = Expr.input('text', Schema.String)\nconst tag = Expr.input('tag', Schema.String)\nconst present = Expr.input('present', Schema.Boolean)\nconst labels = Expr.input('labels', Schema.Array(Schema.String))\nconst at = Expr.input('at', Timestamp)\n/** An optional filter's input: none chosen is null. */\nconst maybeTag = Expr.input('maybeTag', Schema.NullOr(Schema.String))\nconst below = Expr.input('below', Schema.Number)\nconst from_ = Expr.input('from', Timestamp)\nconst until = Expr.input('until', Timestamp)\nconst binary = { collation: Collation.binary }\n/** A list sorted by what its reader picked: `Order.chosen`'s input. */\nconst sort = Expr.input(\n 'sort',\n Schema.NullOr(\n Schema.Struct({ by: Schema.Literals(['rank']), direction: Schema.Literals(['asc', 'desc']) }),\n ),\n)\n/** Defined operators: an interpreter runs what each means, and needs nothing of its own. */\nconst tagged = Expr.operator('conformance.tagged', {\n input: [Schema.Unknown],\n output: Schema.Boolean,\n definedAs: value => Expr.isNotNull(value),\n})\nconst rankOf = Expr.operator('conformance.rankOf', {\n input: [Schema.Number],\n output: Schema.Number,\n definedAs: rank => rank,\n})\nconst chosen = Query.orderBy(\n Order.chosen(sort, { rank: Subject.fields.rank }),\n Order.asc(Subject.fields.id),\n)\n\nexport const cases: ReadonlyArray<ConformanceCase> = [\n // ---- eq ------------------------------------------------------------------\n {\n what: 'eq matches a field against a literal',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n {\n what: 'eq matches a field against the value the request supplies',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'Other' },\n expected: ['c'],\n },\n {\n what: 'eq is exact: a value that differs only by case does not match',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'other' },\n expected: [],\n },\n {\n what: 'eq against null matches nothing, not even the rows that are null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, tag)), byId),\n input: { tag: null },\n expected: [],\n },\n {\n what: 'eq against a value skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, 'x')), byId),\n input: {},\n expected: ['b', 'd'],\n },\n\n // ---- isNull / isNotNull --------------------------------------------------\n {\n what: 'isNull finds exactly the rows with no value',\n body: from.pipe(Query.where(Expr.isNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'isNotNull finds exactly the rest',\n body: from.pipe(Query.where(Expr.isNotNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a true input is that predicate',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: true },\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a false input is its negation',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: false },\n expected: ['a', 'c'],\n },\n ...[true, false].map(value => ({\n what: `a ${value} input compared to a predicate works in reverse order`,\n body: from.pipe(Query.where(Expr.eq(present, Expr.isNotNull(Subject.fields.tag))), byId),\n input: { present: value },\n expected: value ? ['b', 'd', 'e'] : ['a', 'c'],\n })),\n ...[true, false].map(value => ({\n what: `an unknown equality compared to ${value} stays unknown`,\n body: from.pipe(Query.where(Expr.eq(Expr.eq(Subject.fields.tag, tag), present)), byId),\n input: { tag: null, present: value },\n expected: [],\n })),\n\n // ---- contains ------------------------------------------------------------\n {\n what: 'contains ignores case, which is stated rather than left to the backend',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'INTRO' },\n expected: ['a', 'b'],\n },\n {\n what: 'contains matches anywhere in the value, not only at the start',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'to sql' },\n expected: ['b'],\n },\n {\n what: 'containing the empty string is everything',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a percent is searched for literally, not as a wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '%' },\n expected: ['d'],\n },\n {\n what: 'an underscore is searched for literally, not as a single-character wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '_' },\n expected: ['e'],\n },\n {\n what: 'contains over a null column drops those rows, so it is not the same as no filter',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.tag, label)), byId),\n input: { label: '' },\n expected: ['b', 'd', 'e'],\n },\n // The text searched is an input here so the fixture rows stay ASCII: each\n // case asks the same of every row, so it matches all of them or none.\n {\n what: 'contains folds ASCII letters only: an accented capital does not match its lowercase',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'é' },\n expected: [],\n },\n {\n what: 'contains still matches a non-ASCII letter written the same way',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'Él' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'contains with a null search is unknown for every row',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: null },\n expected: [],\n },\n {\n what: 'an unknown containment compared to false stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.contains(Subject.fields.label, label), false)), byId),\n input: { label: null },\n expected: [],\n },\n\n // ---- in ------------------------------------------------------------------\n {\n what: 'in matches a field against a list written out',\n body: from.pipe(Query.where(Expr.in(Subject.fields.rank, [1, 4])), byId),\n input: {},\n expected: ['b', 'e'],\n },\n {\n what: 'in matches a field against the list the request supplies, exactly',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: ['Other', 'intro'] },\n expected: ['c'],\n },\n {\n what: 'in against an empty list matches nothing',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: [] },\n expected: [],\n },\n {\n what: 'in skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.in(Subject.fields.tag, ['x', 'y'])), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'in compared to false is its negation, and a null column stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, ['x']), present)), byId),\n input: { present: false },\n expected: ['e'],\n },\n {\n what: 'in against an empty list compared to false matches every row, null or not',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, labels), present)), byId),\n input: { labels: [], present: false },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n {\n what: 'in asks of an input as of a field: every row, when the input is listed',\n body: from.pipe(Query.where(Expr.in(text, ['x', 'y'])), byId),\n input: { text: 'y' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'in asks of an input against an empty list: no row',\n body: from.pipe(Query.where(Expr.in(text, labels)), byId),\n input: { text: 'y', labels: [] },\n expected: [],\n },\n\n // ---- conjunction, which is the list rather than an operator ---------------\n {\n what: 'two predicates conjoin: every one must hold',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.rank, 3), Expr.isNotNull(Subject.fields.tag)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'no predicate at all is every row',\n body: from.pipe(byId),\n input: {},\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n // ---- and, or, not: SQL's three values -----------------------------------\n // `tag` is null on a and c, so a comparison of it is unknown there, and a\n // row is kept only on true.\n {\n what: 'or holds where one operand does, true beating unknown',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 2))),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'an and inside an or groups as written',\n body: from.pipe(\n Query.where(\n Expr.or(\n Expr.and(Expr.eq(Subject.fields.rank, 3), Expr.eq(Subject.fields.tag, 'x')),\n Expr.eq(Subject.fields.label, 'Intro'),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'd'],\n },\n {\n what: 'not of an unknown stays unknown, so a null matches neither side',\n body: from.pipe(Query.where(Expr.not(Expr.eq(Subject.fields.tag, 'x'))), byId),\n input: {},\n expected: ['e'],\n },\n {\n what: 'not of an and that is false, false beating unknown, holds',\n body: from.pipe(\n Query.where(\n Expr.not(Expr.and(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 1))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'd', 'e'],\n },\n {\n what: 'everything but one value, nulls included, is said with isNull',\n body: from.pipe(\n Query.where(\n Expr.or(Expr.isNull(Subject.fields.tag), Expr.not(Expr.eq(Subject.fields.tag, 'x'))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'e'],\n },\n {\n what: 'an optional filter with nothing chosen matches every row',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'an optional filter with a value chosen is that filter',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: 'x' },\n expected: ['b', 'd'],\n },\n {\n what: 'an operand decided by the input alone settles an or either way',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(present, true), Expr.eq(Subject.fields.rank, 1))),\n byId,\n ),\n input: { present: false },\n expected: ['b'],\n },\n // ---- comparisons -----------------------------------------------------------\n // Ranks are a 2, b 1, c 3, d 3, e 4; text only under a collation every\n // interpreter agrees on, and a date by its encoded ISO string.\n {\n what: 'lt holds where a number orders before the other',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'gte holds where a number orders after the other, or with it',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd', 'e'],\n },\n {\n what: 'a field written second compares the same: the input is above the rank',\n body: from.pipe(Query.where(Expr.gt(below, Expr.field(Subject.fields.rank))), byId),\n input: { below: 3 },\n expected: ['a', 'b'],\n },\n {\n what: 'a comparison that reads no field orders numbers as numbers: 9 is below 10',\n body: from.pipe(Query.where(Expr.lt(below, 10)), byId),\n input: { below: 9 },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a range of dates compares their encoded ISO strings under binary',\n body: from.pipe(\n Query.where(\n Expr.and(\n Expr.gte(Subject.fields.at, from_, binary),\n Expr.lt(Subject.fields.at, until, binary),\n ),\n ),\n byId,\n ),\n input: { from: '2026-01-02T00:00:00.000Z', until: '2026-01-04T00:00:00.000Z' },\n expected: ['b', 'c', 'd'],\n },\n {\n what: 'text under binary orders by code point: capitals and digits before lower case',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.label, 'a', binary)), byId),\n input: {},\n expected: ['a', 'c', 'd'],\n },\n {\n what: 'text under asciiFold orders with ASCII case folded',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, 'j', { collation: Collation.asciiFold })),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'a null compared is unknown, so it matches neither the comparison nor its not',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.tag, 'x', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'not of a comparison leaves a null out too',\n body: from.pipe(Query.where(Expr.not(Expr.gte(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: [],\n },\n // ---- encoded values ------------------------------------------------------\n // The body's types say `Date`; a store's rows and a request's inputs are ISO\n // strings. An interpreter compares in the **encoded** space, and these are the\n // cases that say so — for every other column the two spaces hold the same\n // value, so nothing here could previously tell them apart.\n //\n // What happens when a caller passes a *decoded* value is deliberately not a\n // case, because the interpreters do not agree: the reference one matches\n // nothing, SQLite raises `datatype mismatch`, and a local engine does\n // whatever its own comparison does. `cases` are what interpreters must agree\n // about. The consequence is pinned in `packages/entity/test/encoding.test.ts`\n // instead, and it is the one that matters: **a runtime error cannot be relied\n // on to catch the mistake**, because one of the three answers is an empty\n // result that reads exactly like a correct one.\n {\n what: 'an input whose encoded form differs from its decoded one matches on the encoded one',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.at, at)), byId),\n input: { at: '2026-01-02T00:00:00.000Z' },\n expected: ['b', 'c'],\n },\n {\n what: 'a literal is encoded too, or it has the same problem as an input',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.at, '2026-01-03T00:00:00.000Z' as never)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n\n // ---- ordering ------------------------------------------------------------\n {\n what: 'orders ascending by a number',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders descending, and a later term breaks the tie',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'puts rows without a value last ascending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag))),\n input: {},\n expected: ['b', 'd', 'e', 'a', 'c'],\n },\n {\n what: 'puts rows without a value first descending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag))),\n input: {},\n expected: ['a', 'c', 'e', 'b', 'd'],\n },\n {\n what: 'puts rows without a value first ascending when the term says so',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag, { nulls: 'first' }))),\n input: {},\n expected: ['a', 'c', 'b', 'd', 'e'],\n },\n {\n what: 'puts rows without a value last descending when the term says so',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag, { nulls: 'last' }))),\n input: {},\n expected: ['e', 'b', 'd', 'a', 'c'],\n },\n {\n what: 'breaks a tie by the id where the order does not say how',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the field the input chose, ascending',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'asc' } },\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders by the field the input chose, descending, the next term breaking the tie',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'desc' } },\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the terms after a chosen order when the input chose none',\n body: from.pipe(chosen),\n input: { sort: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n // ---- text, ordered by a declared collation -------------------------------\n {\n what: 'orders text by code point under a binary collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.binary })),\n ),\n input: {},\n expected: ['d', 'a', 'c', 'b', 'e'],\n },\n {\n what: 'orders text with ASCII case folded under an asciiFold collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.asciiFold })),\n ),\n input: {},\n expected: ['d', 'a', 'b', 'c', 'e'],\n },\n // Ordering by text with no declared collation is deliberately not here. How text compares is the\n // backend's — SQLite by code point, TanStack by locale, Postgres by whatever\n // the database was created with — and §6.0.1 puts it outside the conformant\n // subset rather than pretending one of them is the rule. A case asserting an\n // order would only pin whichever engine was written first.\n\n // ---- defined operators -----------------------------------------------------\n {\n what: 'a defined operator matches the rows what it means does',\n body: from.pipe(Query.where(tagged(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a defined operator under not is the negation of what it means',\n body: from.pipe(Query.where(Expr.not(tagged(Subject.fields.tag))), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'a defined operator over an input only is decided by the request',\n body: from.pipe(Query.where(Expr.or(tagged(maybeTag), Expr.eq(Subject.fields.rank, 3))), byId),\n input: { maybeTag: null },\n expected: ['c', 'd'],\n },\n {\n what: 'a defined scalar operator compares as what it means',\n body: from.pipe(Query.where(Expr.eq(rankOf(Subject.fields.rank), 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n]\n\nconst prefix = Expr.input('prefix', Schema.NullOr(Schema.String))\nconst asciiFold = { collation: Collation.asciiFold }\n\n/**\n * Bodies calling the kernel's primitive operators (`Text.startsWith`). An\n * interpreter runs these once it implements them: the in-memory one through\n * `Operators.kernel`, a compiler through its own table.\n */\nexport const primitiveCases: ReadonlyArray<ConformanceCase> = [\n {\n what: 'startsWith under binary is exact about case',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'In', binary)), byId),\n input: {},\n expected: ['a'],\n },\n {\n what: 'startsWith under asciiFold folds ASCII case on both sides',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'IN', asciiFold)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'startsWith the empty prefix holds for every row with text',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'startsWith over null text is unknown, so its rows are not matched',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.tag, '', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'startsWith a null prefix is unknown for every row',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: null },\n expected: [],\n },\n {\n what: 'startsWith reads % and _ as characters, never as like wildcards',\n body: from.pipe(\n Query.where(\n Expr.or(\n Text.startsWith(Subject.fields.label, '100%', binary),\n Text.startsWith(Subject.fields.label, 'sn_', binary),\n Text.startsWith(Subject.fields.label, 'O%', binary),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'startsWith under not keeps a null unknown',\n body: from.pipe(Query.where(Expr.not(Text.startsWith(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: ['e'],\n },\n]\n\n/**\n * A body whose answer no two interpreters agree on, so every interpreter must\n * refuse it rather than answer. Run each through yours and expect a failure.\n */\nexport interface ConformanceRefusal {\n readonly what: string\n readonly body: AnyQuery\n /** The inputs, encoded, as in `ConformanceCase`. */\n readonly input: Readonly<Record<string, unknown>>\n}\n\nconst NUL = String.fromCharCode(0)\n\nexport const refusals: ReadonlyArray<ConformanceRefusal> = [\n // Postgres text cannot hold NUL and SQLite's `like` stops at it.\n {\n what: 'contains refuses a search holding NUL',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: `in${NUL}` },\n },\n {\n what: 'a comparison refuses text holding NUL',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, label, { collation: Collation.binary })),\n byId,\n ),\n input: { label: `b${NUL}` },\n },\n {\n what: 'contains refuses searched text holding NUL',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: `a${NUL}b`, label: 'b' },\n },\n]\n\n/** As `refusals`, for bodies calling the kernel's primitive operators. */\nexport const primitiveRefusals: ReadonlyArray<ConformanceRefusal> = [\n {\n what: 'startsWith refuses a prefix holding NUL',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: `In${NUL}` },\n },\n]\nexport * from './operator.js'\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAa,UAAU,KAAK,WAAoB;AAYhD,MAAa,cAAc,KAAK,WAAwB;AAqBxD,MAAMA,QAAM,OAAO,aAAa,CAAC;AAEjC,MAAM,QAAQ;CAAC;CAAI;CAAK;CAAK;CAAM;CAAM;CAAK;CAAK;CAAK;CAAK,OAAO,cAAc,MAAO;AAAC;AAC1F,MAAM,UAAU;CAAC;CAAI;CAAI;CAAG;CAAG;CAAG;CAAG;CAAK;CAAM;AAAG;AACnD,MAAM,WAAW,CAAC,MAAM,KAAK;;AAG7B,MAAM,cAAc,QAA+C;CACjE,IAAI,UAAU,SAAS,GAAG,KAAK,UAAU,kBAAkB,GAAG,GAAG,OAAO;CACxE,IAAI,UAAU,SAAS,GAAG,GAAG,OAAO;CACpC,IAAI,UAAU,UAAU,GAAG,GAAG,OAAO;CACrC,IAAI,UAAU,UAAU,GAAG,GAAG,OAAO,CAAC,IAAI,OAAO;CACjD,IAAI,UAAU,QAAQ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C,GAAG,IAAI;EAC7F,OAAO,CAAC;EACR,UAAU,CAAC,GAAG;CAChB;AACF;AAaA,MAAM,MAAM,OAAO,aAAa,CAAC;AAEjC,MAAa,WAA8C;CAEzD;EACE,MAAM;EACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,SAAS,QAAQ,OAAO,OAAO,KAAK,CAAC,GAAG,IAAI;EAC7E,OAAO,EAAE,OAAO,KAAK,MAAM;CAC7B;CACA;EACE,MAAM;EACN,MAAM,KAAK,KACT,MAAM,MAAM,KAAK,GAAG,QAAQ,OAAO,OAAO,OAAO,EAAE,WAAW,UAAU,OAAO,CAAC,CAAC,GACjF,IACF;EACA,OAAO,EAAE,OAAO,IAAI,MAAM;CAC5B;CACA;EACE,MAAM;EACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,SAAS,MAAM,KAAK,CAAC,GAAG,IAAI;EAC7D,OAAO;GAAE,MAAM,IAAI,IAAI;GAAI,OAAO;EAAI;CACxC;AACF;;AAGA,MAAa,oBAAuD,CAClE;CACE,MAAM;CACN,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,WAAW,QAAQ,OAAO,OAAO,QAAQ,MAAM,CAAC,GAAG,IAAI;CACxF,OAAO,EAAE,QAAQ,KAAK,MAAM;AAC9B,CACF"}
1
+ {"version":3,"file":"index.mjs","names":["NUL","chosen"],"sources":["../../src/conformance/operator.ts","../../src/conformance/index.ts"],"sourcesContent":["/**\n * An operator held to what it declares (expr-operations-DESIGN §10.4): its\n * laws tested against an implementation, and one set of calls run through\n * every implementation given, their answers and refusals compared.\n *\n * Cases are drawn from a fixed sample of each kind of value (text with the\n * empty string, mixed case, non-ASCII and an astral character; numbers with\n * zero, negatives and a fraction; both booleans), kept where the operator's\n * input schema and the law's domain decode them, and chosen by a seeded\n * shuffle when there are more than asked for, so a run is repeatable.\n */\nimport { Data, Option, Schema, SchemaAST } from 'effect'\nimport {\n Collation,\n Evidence,\n Expr,\n Law,\n Operators,\n QueryEvaluateError,\n valueOfOperand,\n type LawDescription,\n type MemoryOperators,\n type Operandish,\n type Operator,\n type TestedEvidence,\n} from '../index.js'\nimport { stampRun, stampTested } from '../tested.js'\n\ntype AnyOperator = Operator<ReadonlyArray<Schema.Top>, Schema.Top>\n\n/** What an implementation said of one call: a value, or that it refused it. */\nexport type Outcome = Data.TaggedEnum<{\n Value: { readonly value: unknown }\n Refused: { readonly reason: string }\n}>\nexport const Outcome = Data.taggedEnum<Outcome>()\n\n/** What `Conformance.laws` found: every law held, with the evidence, or the first case one did not. */\nexport type LawsVerdict = Data.TaggedEnum<{\n Holds: { readonly evidence: ReadonlyArray<TestedEvidence> }\n Counterexample: {\n readonly law: LawDescription\n readonly args: ReadonlyArray<unknown>\n /** The collation the calls were made under, for an operator that compares text. */\n readonly collation: Option.Option<Collation>\n readonly left: Outcome\n readonly right: Outcome\n }\n}>\nexport const LawsVerdict = Data.taggedEnum<LawsVerdict>()\n\n/**\n * One way to run a call: its value, or a throw for a call it refuses. A call\n * of a predicate answers its truth, unknown as `null`.\n */\nexport type Runner = (call: Operandish) => unknown\n\n/** A call the implementations did not agree on, with what each said. */\nexport interface Disagreement {\n readonly args: ReadonlyArray<unknown>\n readonly collation: Option.Option<Collation>\n readonly outcomes: Readonly<Record<string, Outcome>>\n}\n\nexport interface OperatorReport {\n /** How many calls ran, each through every implementation. */\n readonly cases: number\n readonly disagreements: ReadonlyArray<Disagreement>\n}\n\nconst NUL = String.fromCharCode(0)\n// 'B' sorts before 'a' by code point and after it folded: what tells the collations apart.\nconst texts = ['', 'a', 'A', 'ab', 'aB', 'b', 'B', 'é', 'É', String.fromCodePoint(0x1f600)]\nconst numbers = [-2, -1, 0, 1, 2, 7, 0.5, -0.5, 1e6]\nconst booleans = [true, false]\n\n/** The sample values of a stored kind, before any schema narrows them. */\nconst candidates = (ast: SchemaAST.AST): ReadonlyArray<unknown> => {\n if (SchemaAST.isString(ast) || SchemaAST.isTemplateLiteral(ast)) return texts\n if (SchemaAST.isNumber(ast)) return numbers\n if (SchemaAST.isBoolean(ast)) return booleans\n if (SchemaAST.isLiteral(ast)) return [ast.literal]\n if (SchemaAST.isUnion(ast)) return ast.types.flatMap(candidates)\n return []\n}\n\n/** Whether a stored value is one `schema` stores. */\nconst decodes = (schema: Schema.Top) => (value: unknown) =>\n Schema.is(Schema.toEncoded(schema))(value)\n\n/** The non-null samples every schema of `schemas` decodes, and the domain too when one is given. */\nconst samplesOf = (\n schemas: ReadonlyArray<Schema.Top>,\n domain: Option.Option<Schema.Top>,\n): ReadonlyArray<unknown> =>\n [...new Set(candidates(Schema.toEncoded(schemas[0]!).ast))].filter(\n value =>\n value !== null &&\n schemas.every(schema => decodes(schema)(value)) &&\n Option.match(domain, { onNone: () => true, onSome: within => decodes(within)(value) }),\n )\n\n/** Every tuple of one value from each list. */\nconst product = (\n lists: ReadonlyArray<ReadonlyArray<unknown>>,\n): ReadonlyArray<ReadonlyArray<unknown>> =>\n lists.reduce<ReadonlyArray<ReadonlyArray<unknown>>>(\n (tuples, list) => tuples.flatMap(tuple => list.map(value => [...tuple, value])),\n [[]],\n )\n\n/** A small seeded generator (mulberry32), so a chosen subset is the same on every run. */\nconst random = (seed: number) => {\n let state = seed >>> 0\n return () => {\n state = (state + 0x6d2b79f5) >>> 0\n let t = state\n t = Math.imul(t ^ (t >>> 15), t | 1)\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61)\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n }\n}\n\n/** At most `limit` of the tuples, a seeded shuffle choosing which when there are more. */\nconst chosen = <A>(tuples: ReadonlyArray<A>, limit: number, seed: number): ReadonlyArray<A> => {\n if (tuples.length <= limit) return tuples\n const next = random(seed)\n const shuffled = [...tuples]\n for (let i = shuffled.length - 1; i > 0; i--) {\n const j = Math.floor(next() * (i + 1))\n ;[shuffled[i], shuffled[j]] = [shuffled[j]!, shuffled[i]!]\n }\n return shuffled.slice(0, limit)\n}\n\n/** A plain object: what JSON makes, and nothing whose data sits in a prototype. */\nconst isRecord = (value: unknown): value is Readonly<Record<string, unknown>> => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\n/** A plain object's keys holding a value: one holding `undefined` is as absent, as JSON writes it. */\nconst keysOf = (record: Readonly<Record<string, unknown>>): ReadonlyArray<string> =>\n Object.keys(record).filter(key => record[key] !== undefined)\n\n/**\n * Two stored values alike, structurally. Not by their JSON, which writes\n * `Infinity` and `NaN` as `null`: a division by zero answering `Infinity` in\n * memory and null in SQL would read as agreeing. An object that is not plain\n * (its data in a prototype: a Date) is compared by its JSON, a Date's its time.\n */\nconst sameValue = (left: unknown, right: unknown): boolean => {\n if (typeof left === 'number' && typeof right === 'number') {\n return left === right || (Number.isNaN(left) && Number.isNaN(right))\n }\n if (Array.isArray(left) && Array.isArray(right)) {\n return left.length === right.length && left.every((each, i) => sameValue(each, right[i]))\n }\n if (isRecord(left) && isRecord(right)) {\n const keys = keysOf(left)\n return (\n keys.length === keysOf(right).length &&\n keys.every(key => Object.hasOwn(right, key) && sameValue(left[key], right[key]))\n )\n }\n if (typeof left === 'object' && left !== null && typeof right === 'object' && right !== null) {\n return JSON.stringify(left) === JSON.stringify(right)\n }\n return left === right\n}\n\n/** Two outcomes alike: equal values as stored, or both refusals. */\nconst same = (left: Outcome, right: Outcome): boolean =>\n left._tag === 'Refused' || right._tag === 'Refused'\n ? left._tag === right._tag\n : sameValue(left.value, right.value)\n\n/** Text by code point, as every interpreter's `binary` orders it; `<` compares UTF-16 units. */\nconst byCodePoint = (left: string, right: string): number => {\n const [a, b] = [[...left], [...right]]\n for (let i = 0; i < Math.min(a.length, b.length); i++) {\n const sign = a[i]!.codePointAt(0)! - b[i]!.codePointAt(0)!\n if (sign !== 0) return sign\n }\n return a.length - b.length\n}\n\n/** Two values of one kind in order: numbers, booleans, text by code point. */\nconst orderOf = (left: unknown, right: unknown): number =>\n typeof left === 'string' && typeof right === 'string'\n ? byCodePoint(left, right)\n : Number(left) - Number(right)\n\n/** A call of `op`, given `collation` when its rule takes one. */\nconst callOf = (\n op: AnyOperator,\n args: ReadonlyArray<unknown>,\n collation: Option.Option<Collation>,\n): Operandish =>\n Option.match(collation, {\n onNone: () => op(...args),\n onSome: each => op(...args, { collation: each }),\n })\n\n/** One side of an equation: a call to run (its text folded first, for a collation law), or a value. */\ntype Side = { readonly node: Operandish; readonly fold: boolean } | { readonly value: unknown }\n\n/** One equation for one tuple: its two sides, and what makes their outcomes keep the law. */\ninterface Plan {\n readonly args: ReadonlyArray<unknown>\n readonly collation: Option.Option<Collation>\n readonly left: Side\n readonly right: Side\n readonly holds: (left: Outcome, right: Outcome) => boolean\n}\n\n/** Each law `op` declares, with its equations: what `laws` and `lawsBy` evaluate. */\ninterface LawPlans {\n readonly law: LawDescription\n readonly plans: ReadonlyArray<Plan>\n}\n\nconst foldText = (value: unknown): unknown =>\n typeof value === 'string' ? Collation.foldAscii(value) : value\n\nconst nameOf = (op: AnyOperator): string =>\n op.descriptor.version === 1 ? op.descriptor.id : `${op.descriptor.id}@${op.descriptor.version}`\n\n/**\n * The equations of every law `op` declares, over up to `limit` tuples a law\n * chosen by `seed`. Nothing is run: a memory table and an SQL runner\n * evaluate the same plans.\n */\nconst lawPlans = (op: AnyOperator, limit: number, seed: number): ReadonlyArray<LawPlans> => {\n const { descriptor } = op\n const comparesText = (each: AnyOperator) => each.descriptor.collation !== 'none'\n // Each operator is called under a collation only where it compares text.\n const under = (each: AnyOperator, collation: Option.Option<Collation>) =>\n comparesText(each) ? collation : Option.none<Collation>()\n const run = (node: Operandish): Side => ({ node, fold: false })\n const value = (held: unknown): Side => ({ value: held })\n return descriptor.laws.map(law => {\n const shared = samplesOf(descriptor.input, law.domain)\n const tuples = (arity: number) =>\n chosen(product(Array.from({ length: arity }, () => shared)), limit, seed)\n // The kernel compares text only under a collation, and literals bring none. An\n // implementation is told the collation, and may answer differently under each:\n // a pass under each where `op`, or a witness the law calls, compares text.\n const witnesses = Law.$match(law, {\n Inverse: ({ other }) => [other],\n Distributes: ({ over }) => [over],\n Associative: () => [],\n Commutative: () => [],\n Idempotent: () => [],\n Identity: () => [],\n Absorbing: () => [],\n Monotonic: () => [],\n PreservesCollation: () => [],\n })\n const collations = [op, ...witnesses].some(comparesText)\n ? [Option.some(Collation.binary), Option.some(Collation.asciiFold)]\n : [Option.none<Collation>()]\n const plans = collations.flatMap((collation): ReadonlyArray<Plan> => {\n const call = (...args: ReadonlyArray<unknown>) => callOf(op, args, under(op, collation))\n // A witness operator is called as `op` is: under the collation when it compares text.\n const witness = (other: AnyOperator, ...args: ReadonlyArray<unknown>) =>\n callOf(other, args, under(other, collation))\n const equal = (args: ReadonlyArray<unknown>, left: Side, right: Side): Plan => ({\n args,\n collation,\n left,\n right,\n holds: same,\n })\n const sided = (\n witness: unknown,\n side: 'left' | 'right' | 'both',\n answer: (a: unknown) => unknown,\n ) =>\n tuples(1).flatMap(([a]) => [\n ...(side === 'right'\n ? []\n : [equal([witness, a], run(call(witness, a)), value(answer(a)))]),\n ...(side === 'left'\n ? []\n : [equal([a, witness], run(call(a, witness)), value(answer(a)))]),\n ])\n return Law.$match(law, {\n Associative: () =>\n tuples(3).map(([a, b, c]) =>\n equal([a, b, c], run(call(call(a, b), c)), run(call(a, call(b, c)))),\n ),\n Commutative: () =>\n tuples(2).map(([a, b]) => equal([a, b], run(call(a, b)), run(call(b, a)))),\n Idempotent: () => tuples(1).map(([a]) => equal([a], run(call(a, a)), value(a))),\n Identity: ({ value: witness, side }) => sided(witness, side, a => a),\n Absorbing: ({ value: witness, side }) => sided(witness, side, () => witness),\n Inverse: ({ other, identity }) =>\n tuples(1).map(([a]) => equal([a], run(call(a, witness(other, a))), value(identity))),\n Distributes: ({ over }) =>\n tuples(3).map(([a, b, c]) =>\n equal(\n [a, b, c],\n run(call(a, witness(over, b, c))),\n run(witness(over, call(a, b), call(a, c))),\n ),\n ),\n Monotonic: ({ direction, position }) => {\n // Text in order as the collation orders it, folded under asciiFold.\n const under = (held: unknown) =>\n Option.exists(collation, each => each._tag === 'AsciiFold') ? foldText(held) : held\n const order = (left: unknown, right: unknown) => orderOf(under(left), under(right))\n const each = descriptor.input.map(schema => samplesOf([schema], law.domain))\n const pairs = each[position]!.flatMap(low =>\n each[position]!.filter(high => order(low, high) < 0).map(high => [low, high] as const),\n )\n const rest = product(each.filter((_, index) => index !== position))\n const sign = direction === 'increasing' ? 1 : -1\n return chosen(product([pairs, rest]), limit, seed).map(([pair, others]) => {\n const [low, high] = pair as readonly [unknown, unknown]\n const at = (held: unknown) => {\n const args = [...(others as ReadonlyArray<unknown>)]\n args.splice(position, 0, held)\n return args\n }\n return {\n args: at(low),\n collation,\n left: run(call(...at(low))),\n right: run(call(...at(high))),\n holds: (left: Outcome, right: Outcome) =>\n left._tag === 'Value' &&\n right._tag === 'Value' &&\n sign * order(left.value, right.value) <= 0,\n }\n })\n },\n // A law about the fold itself: its equations are made once, in the asciiFold pass.\n PreservesCollation: () =>\n Option.exists(collation, each => each._tag === 'AsciiFold')\n ? tuples(2).map(([a, b]) =>\n equal(\n [a, b],\n { node: call(a, b), fold: true },\n { node: call(foldText(a), foldText(b)), fold: true },\n ),\n )\n : [],\n })\n })\n if (plans.length === 0) {\n throw new Error(\n `[foldkit-entity] Conformance.laws: no sample of ${nameOf(op)}'s arguments is in ${Law.describe(law).kind}'s domain`,\n )\n }\n return { law: Law.describe(law), plans }\n })\n}\n\n/**\n * The verdict over laws whose calls' outcomes `answered` gives: the first\n * failure, or evidence of each.\n */\nconst verdictOf = (\n op: AnyOperator,\n laws: ReadonlyArray<LawPlans>,\n answered: (node: Operandish) => Outcome,\n options: { readonly implementation: string; readonly seed: number },\n): LawsVerdict => {\n const outcomes = (side: Side): Outcome => {\n if ('value' in side) return Outcome.Value({ value: side.value })\n const outcome = answered(side.node)\n return side.fold\n ? Outcome.$match(outcome, {\n Value: ({ value }) => Outcome.Value({ value: foldText(value) }),\n Refused: refused => refused,\n })\n : outcome\n }\n const evidence: Array<TestedEvidence> = []\n for (const { law, plans } of laws) {\n for (const plan of plans) {\n const left = outcomes(plan.left)\n const right = outcomes(plan.right)\n if (!plan.holds(left, right)) {\n return LawsVerdict.Counterexample({\n law,\n args: plan.args,\n collation: plan.collation,\n left,\n right,\n })\n }\n }\n evidence.push(\n Evidence.Tested({\n operator: nameOf(op),\n law,\n implementation: options.implementation,\n cases: plans.length,\n seed: options.seed,\n }),\n )\n }\n return LawsVerdict.Holds({ evidence })\n}\n\nexport const Conformance = {\n /** A runner of calls through a memory table: `Conformance.operator`'s for the in-memory interpreter. */\n memory:\n (operators: MemoryOperators): Runner =>\n call =>\n valueOfOperand(call, { operators }),\n\n /**\n * Tests every law `op` declares against `operators`' implementation of it,\n * up to `cases` tuples a law (200 by default), chosen by `seed` (0); a law\n * of both sides checks each tuple from each. Holds with a `Tested` record a\n * law, which `Operators.withEvidence` keeps; or the first case a law fails,\n * with both sides.\n */\n laws: <In extends ReadonlyArray<Schema.Top>, Out extends Schema.Top>(\n op: Operator<In, Out>,\n operators: MemoryOperators,\n options: {\n readonly implementation?: string | undefined\n readonly cases?: number | undefined\n readonly seed?: number | undefined\n } = {},\n ): LawsVerdict => {\n const operator: AnyOperator = op\n const seed = options.seed ?? 0\n const outcome = (node: Operandish): Outcome => {\n try {\n return Outcome.Value({ value: valueOfOperand(node, { operators }) })\n } catch (error) {\n if (error instanceof QueryEvaluateError) return Outcome.Refused({ reason: error.message })\n throw error\n }\n }\n const verdict = verdictOf(operator, lawPlans(operator, options.cases ?? 200, seed), outcome, {\n implementation: options.implementation ?? 'memory',\n seed,\n })\n // Each record is of this table's implementation, which `withEvidence` checks.\n const tested = operators.implementations.find(each => each.operator === operator.descriptor)\n if (verdict._tag === 'Holds' && tested !== undefined) {\n verdict.evidence.forEach(record => stampTested(record, tested))\n }\n return verdict\n },\n\n /**\n * As `laws`, each call run by `run` instead of a memory table: an SQL\n * implementation selected from a database, say, whose evidence a binding's\n * SQL table records. A throw is a refusal.\n */\n lawsBy: async <In extends ReadonlyArray<Schema.Top>, Out extends Schema.Top>(\n op: Operator<In, Out>,\n run: Runner,\n options: {\n readonly implementation: string\n readonly cases?: number | undefined\n readonly seed?: number | undefined\n },\n ): Promise<LawsVerdict> => {\n const operator: AnyOperator = op\n const seed = options.seed ?? 0\n const laws = lawPlans(operator, options.cases ?? 200, seed)\n const answers = new Map<Operandish, Outcome>()\n for (const { plans } of laws) {\n for (const side of plans.flatMap(plan => [plan.left, plan.right])) {\n if (!('node' in side) || answers.has(side.node)) continue\n try {\n answers.set(side.node, Outcome.Value({ value: await run(side.node) }))\n } catch (error) {\n answers.set(side.node, Outcome.Refused({ reason: String(error) }))\n }\n }\n }\n // Every call was run above, so each has its answer.\n const verdict = verdictOf(operator, laws, node => answers.get(node)!, {\n implementation: options.implementation,\n seed,\n })\n // Each record is a runner's, which an SQL table's `withEvidence` checks.\n if (verdict._tag === 'Holds') verdict.evidence.forEach(stampRun)\n return verdict\n },\n\n /**\n * Runs one set of calls of `op` through every implementation and compares\n * what each answered or refused. The calls are `cases` (argument tuples, as\n * stored), or generated: each argument a sample of its kind, null where its\n * schema admits one, and text holding NUL, under `binary` and `asciiFold` where the operator compares\n * text, up to `limit` (300) chosen by `seed` (0). A defined operator's\n * expansion is run beside the others, as `expansion`, by `expansionTable`\n * (the kernel's when not given).\n */\n operator: async <In extends ReadonlyArray<Schema.Top>, Out extends Schema.Top>(\n op: Operator<In, Out>,\n options: {\n readonly implementations: Readonly<Record<string, Runner>>\n readonly cases?: ReadonlyArray<ReadonlyArray<unknown>> | undefined\n readonly limit?: number | undefined\n readonly seed?: number | undefined\n readonly expansionTable?: MemoryOperators | undefined\n },\n ): Promise<OperatorReport> => {\n const operator: AnyOperator = op\n const { descriptor } = operator\n const runners: Record<string, Runner> = { ...options.implementations }\n if (Option.isSome(descriptor.definedAs)) {\n const table = options.expansionTable ?? Operators.kernel\n runners.expansion = call => valueOfOperand(Expr.expanded(call), { operators: table })\n }\n const generated = () =>\n chosen(\n product(\n descriptor.input.map(schema => {\n const text = candidates(Schema.toEncoded(schema).ast).some(\n value => typeof value === 'string',\n )\n // Null only where the schema admits it: a call refuses a null literal otherwise.\n const nulls = decodes(schema)(null) ? [null] : []\n return [...nulls, ...samplesOf([schema], Option.none()), ...(text ? [`a${NUL}`] : [])]\n }),\n ),\n options.limit ?? 300,\n options.seed ?? 0,\n )\n const collations =\n descriptor.collation === 'none'\n ? [Option.none<Collation>()]\n : [Option.some(Collation.binary), Option.some(Collation.asciiFold)]\n const disagreements: Array<Disagreement> = []\n let cases = 0\n for (const args of options.cases ?? generated()) {\n for (const collation of collations) {\n cases += 1\n const call = callOf(operator, args, collation)\n const outcomes: Record<string, Outcome> = {}\n for (const [name, run] of Object.entries(runners)) {\n try {\n outcomes[name] = Outcome.Value({ value: await run(call) })\n } catch (error) {\n outcomes[name] = Outcome.Refused({ reason: String(error) })\n }\n }\n const [first, ...others] = Object.values(outcomes)\n if (first !== undefined && others.some(each => !same(first, each))) {\n disagreements.push({ args, collation, outcomes })\n }\n }\n }\n return { cases, disagreements }\n },\n}\n","/**\n * The conformance suite for a query body: what\n * [data-query-DESIGN §6.0.1](../../../../docs/design/data-query-DESIGN.md) says\n * each operator means, as cases an interpreter can be run against.\n *\n * Exported rather than kept in this repository's tests, because the interpreter\n * most worth checking against it is one written elsewhere: run every case\n * through yours and compare the ids, in order, against `expected`.\n *\n * §18 names portable-kernel conformance as what the reference interpreter is\n * for. This is that, extracted: one set of cases, run against every interpreter\n * rather than each interpreter having its own tests that happen to agree.\n * `foldkit-remote-server` runs them over rows in memory;\n * `foldkit-remote-drizzle` compiles them to SQL and runs them against a real\n * SQLite. A body that means two things fails in whichever is wrong.\n *\n * The cases are chosen to make interpreters *disagree*, which is the only kind\n * that tests anything. A fixture whose values are all lowercase cannot tell a\n * case-sensitive `contains` from a case-insensitive one — that is not a\n * hypothetical, it is how `contains` reached a released package meaning three\n * different things.\n */\nimport { Schema, SchemaGetter } from 'effect'\nimport { Collation, Entity, Expr, Order, Query, Text, type AnyQuery } from '../index.js'\n\n/**\n * A `Date` on the way in, an ISO string on the wire — the one fixture whose\n * **encoded form differs from its decoded form**.\n *\n * Every other column here encodes to itself, which is why the suite could not\n * previously see an interpreter comparing a decoded value against an encoded\n * row. That is not a hypothetical bug: a store holds wire values and decodes at\n * read, while a `QueryRef`'s input and a body's literals are written in domain\n * terms, so anything that runs a body over stored rows has to reconcile the two\n * and nothing was checking that it did.\n */\nconst Timestamp = Schema.Date.pipe(\n Schema.encodeTo(Schema.String, {\n decode: SchemaGetter.transform((iso: string) => new Date(iso)),\n encode: SchemaGetter.transform((at: Date) => at.toISOString()),\n }),\n)\n\n/** The one Entity every case reads, with a column of each kind that matters. */\nexport const Subject = Entity.define(\n 'Subject',\n Schema.Struct({\n id: Schema.String,\n /** Mixed case on purpose: a case-blind `contains` must be caught. */\n label: Schema.String,\n rank: Schema.Number,\n /** Nullable on purpose: three-valued logic has to be exercised. */\n tag: Schema.String,\n /** Encoded and decoded forms differ on purpose: see `Timestamp`. */\n at: Timestamp,\n }),\n)\n\n/**\n * How a row looks to an interpreter reading values, and to SQL as a table. The\n * index signature is what lets one be read by key without a cast, which is how\n * an interpreter over plain rows reads one.\n */\nexport interface ConformanceRow {\n readonly id: string\n readonly label: string\n readonly rank: number\n readonly tag: string | null\n /** The **encoded** form: what a store holds and an interpreter compares. */\n readonly at: string\n readonly [key: string]: unknown\n}\n\nexport const rows: ReadonlyArray<ConformanceRow> = [\n { id: 'a', label: 'Intro', rank: 2, tag: null, at: '2026-01-01T00:00:00.000Z' },\n { id: 'b', label: 'intro to sql', rank: 1, tag: 'x', at: '2026-01-02T00:00:00.000Z' },\n { id: 'c', label: 'Other', rank: 3, tag: null, at: '2026-01-02T00:00:00.000Z' },\n { id: 'd', label: '100% cotton', rank: 3, tag: 'x', at: '2026-01-03T00:00:00.000Z' },\n { id: 'e', label: 'snake_case', rank: 4, tag: 'y', at: '2026-01-04T00:00:00.000Z' },\n]\n\nexport interface ConformanceCase {\n /** What the case pins, as a sentence an interpreter fails by name. */\n readonly what: string\n readonly body: AnyQuery\n /**\n * The inputs, **encoded** — the space a store's rows are in, not the domain\n * space the body's types describe. For every column but `at` the two are the\n * same value, which is exactly why this has to be said rather than inferred\n * from the fixtures.\n */\n readonly input: Readonly<Record<string, unknown>>\n /** The ids the body matches, in the order it asks for. */\n readonly expected: ReadonlyArray<string>\n}\n\nconst from = Query.from(Subject)\nconst byId = Query.orderBy(Order.asc(Subject.fields.id))\nconst label = Expr.input('label', Schema.String)\nconst text = Expr.input('text', Schema.String)\nconst tag = Expr.input('tag', Schema.String)\nconst present = Expr.input('present', Schema.Boolean)\nconst labels = Expr.input('labels', Schema.Array(Schema.String))\nconst at = Expr.input('at', Timestamp)\n/** An optional filter's input: none chosen is null. */\nconst maybeTag = Expr.input('maybeTag', Schema.NullOr(Schema.String))\nconst below = Expr.input('below', Schema.Number)\nconst from_ = Expr.input('from', Timestamp)\nconst until = Expr.input('until', Timestamp)\nconst binary = { collation: Collation.binary }\n/** A list sorted by what its reader picked: `Order.chosen`'s input. */\nconst sort = Expr.input(\n 'sort',\n Schema.NullOr(\n Schema.Struct({ by: Schema.Literals(['rank']), direction: Schema.Literals(['asc', 'desc']) }),\n ),\n)\n/** Defined operators: an interpreter runs what each means, and needs nothing of its own. */\nconst tagged = Expr.operator('conformance.tagged', {\n input: [Schema.Unknown],\n output: Schema.Boolean,\n definedAs: value => Expr.isNotNull(value),\n})\nconst rankOf = Expr.operator('conformance.rankOf', {\n input: [Schema.Number],\n output: Schema.Number,\n definedAs: rank => rank,\n})\nconst chosen = Query.orderBy(\n Order.chosen(sort, { rank: Subject.fields.rank }),\n Order.asc(Subject.fields.id),\n)\n\nexport const cases: ReadonlyArray<ConformanceCase> = [\n // ---- eq ------------------------------------------------------------------\n {\n what: 'eq matches a field against a literal',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n {\n what: 'eq matches a field against the value the request supplies',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'Other' },\n expected: ['c'],\n },\n {\n what: 'eq is exact: a value that differs only by case does not match',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.label, label)), byId),\n input: { label: 'other' },\n expected: [],\n },\n {\n what: 'eq against null matches nothing, not even the rows that are null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, tag)), byId),\n input: { tag: null },\n expected: [],\n },\n {\n what: 'eq against a value skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.tag, 'x')), byId),\n input: {},\n expected: ['b', 'd'],\n },\n\n // ---- isNull / isNotNull --------------------------------------------------\n {\n what: 'isNull finds exactly the rows with no value',\n body: from.pipe(Query.where(Expr.isNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'isNotNull finds exactly the rest',\n body: from.pipe(Query.where(Expr.isNotNull(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a true input is that predicate',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: true },\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a predicate compared to a false input is its negation',\n body: from.pipe(Query.where(Expr.eq(Expr.isNotNull(Subject.fields.tag), present)), byId),\n input: { present: false },\n expected: ['a', 'c'],\n },\n ...[true, false].map(value => ({\n what: `a ${value} input compared to a predicate works in reverse order`,\n body: from.pipe(Query.where(Expr.eq(present, Expr.isNotNull(Subject.fields.tag))), byId),\n input: { present: value },\n expected: value ? ['b', 'd', 'e'] : ['a', 'c'],\n })),\n ...[true, false].map(value => ({\n what: `an unknown equality compared to ${value} stays unknown`,\n body: from.pipe(Query.where(Expr.eq(Expr.eq(Subject.fields.tag, tag), present)), byId),\n input: { tag: null, present: value },\n expected: [],\n })),\n\n // ---- contains ------------------------------------------------------------\n {\n what: 'contains ignores case, which is stated rather than left to the backend',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'INTRO' },\n expected: ['a', 'b'],\n },\n {\n what: 'contains matches anywhere in the value, not only at the start',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: 'to sql' },\n expected: ['b'],\n },\n {\n what: 'containing the empty string is everything',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a percent is searched for literally, not as a wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '%' },\n expected: ['d'],\n },\n {\n what: 'an underscore is searched for literally, not as a single-character wildcard',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: '_' },\n expected: ['e'],\n },\n {\n what: 'contains over a null column drops those rows, so it is not the same as no filter',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.tag, label)), byId),\n input: { label: '' },\n expected: ['b', 'd', 'e'],\n },\n // The text searched is an input here so the fixture rows stay ASCII: each\n // case asks the same of every row, so it matches all of them or none.\n {\n what: 'contains folds ASCII letters only: an accented capital does not match its lowercase',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'é' },\n expected: [],\n },\n {\n what: 'contains still matches a non-ASCII letter written the same way',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: 'Élan', label: 'Él' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'contains with a null search is unknown for every row',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: null },\n expected: [],\n },\n {\n what: 'an unknown containment compared to false stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.contains(Subject.fields.label, label), false)), byId),\n input: { label: null },\n expected: [],\n },\n\n // ---- in ------------------------------------------------------------------\n {\n what: 'in matches a field against a list written out',\n body: from.pipe(Query.where(Expr.in(Subject.fields.rank, [1, 4])), byId),\n input: {},\n expected: ['b', 'e'],\n },\n {\n what: 'in matches a field against the list the request supplies, exactly',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: ['Other', 'intro'] },\n expected: ['c'],\n },\n {\n what: 'in against an empty list matches nothing',\n body: from.pipe(Query.where(Expr.in(Subject.fields.label, labels)), byId),\n input: { labels: [] },\n expected: [],\n },\n {\n what: 'in skips the rows whose column is null',\n body: from.pipe(Query.where(Expr.in(Subject.fields.tag, ['x', 'y'])), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'in compared to false is its negation, and a null column stays unknown',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, ['x']), present)), byId),\n input: { present: false },\n expected: ['e'],\n },\n {\n what: 'in against an empty list compared to false matches every row, null or not',\n body: from.pipe(Query.where(Expr.eq(Expr.in(Subject.fields.tag, labels), present)), byId),\n input: { labels: [], present: false },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n {\n what: 'in asks of an input as of a field: every row, when the input is listed',\n body: from.pipe(Query.where(Expr.in(text, ['x', 'y'])), byId),\n input: { text: 'y' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'in asks of an input against an empty list: no row',\n body: from.pipe(Query.where(Expr.in(text, labels)), byId),\n input: { text: 'y', labels: [] },\n expected: [],\n },\n\n // ---- conjunction, which is the list rather than an operator ---------------\n {\n what: 'two predicates conjoin: every one must hold',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.rank, 3), Expr.isNotNull(Subject.fields.tag)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'no predicate at all is every row',\n body: from.pipe(byId),\n input: {},\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n\n // ---- and, or, not: SQL's three values -----------------------------------\n // `tag` is null on a and c, so a comparison of it is unknown there, and a\n // row is kept only on true.\n {\n what: 'or holds where one operand does, true beating unknown',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 2))),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'an and inside an or groups as written',\n body: from.pipe(\n Query.where(\n Expr.or(\n Expr.and(Expr.eq(Subject.fields.rank, 3), Expr.eq(Subject.fields.tag, 'x')),\n Expr.eq(Subject.fields.label, 'Intro'),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'd'],\n },\n {\n what: 'not of an unknown stays unknown, so a null matches neither side',\n body: from.pipe(Query.where(Expr.not(Expr.eq(Subject.fields.tag, 'x'))), byId),\n input: {},\n expected: ['e'],\n },\n {\n what: 'not of an and that is false, false beating unknown, holds',\n body: from.pipe(\n Query.where(\n Expr.not(Expr.and(Expr.eq(Subject.fields.tag, 'x'), Expr.eq(Subject.fields.rank, 1))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'd', 'e'],\n },\n {\n what: 'everything but one value, nulls included, is said with isNull',\n body: from.pipe(\n Query.where(\n Expr.or(Expr.isNull(Subject.fields.tag), Expr.not(Expr.eq(Subject.fields.tag, 'x'))),\n ),\n byId,\n ),\n input: {},\n expected: ['a', 'c', 'e'],\n },\n {\n what: 'an optional filter with nothing chosen matches every row',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'an optional filter with a value chosen is that filter',\n body: from.pipe(\n Query.where(Expr.whenGiven(maybeTag, given => Expr.eq(Subject.fields.tag, given))),\n byId,\n ),\n input: { maybeTag: 'x' },\n expected: ['b', 'd'],\n },\n {\n what: 'an operand decided by the input alone settles an or either way',\n body: from.pipe(\n Query.where(Expr.or(Expr.eq(present, true), Expr.eq(Subject.fields.rank, 1))),\n byId,\n ),\n input: { present: false },\n expected: ['b'],\n },\n // ---- comparisons -----------------------------------------------------------\n // Ranks are a 2, b 1, c 3, d 3, e 4; text only under a collation every\n // interpreter agrees on, and a date by its encoded ISO string.\n {\n what: 'lt holds where a number orders before the other',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'gte holds where a number orders after the other, or with it',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.rank, 3)), byId),\n input: {},\n expected: ['c', 'd', 'e'],\n },\n {\n what: 'a field written second compares the same: the input is above the rank',\n body: from.pipe(Query.where(Expr.gt(below, Expr.field(Subject.fields.rank))), byId),\n input: { below: 3 },\n expected: ['a', 'b'],\n },\n {\n what: 'a comparison that reads no field orders numbers as numbers: 9 is below 10',\n body: from.pipe(Query.where(Expr.lt(below, 10)), byId),\n input: { below: 9 },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'a range of dates compares their encoded ISO strings under binary',\n body: from.pipe(\n Query.where(\n Expr.and(\n Expr.gte(Subject.fields.at, from_, binary),\n Expr.lt(Subject.fields.at, until, binary),\n ),\n ),\n byId,\n ),\n input: { from: '2026-01-02T00:00:00.000Z', until: '2026-01-04T00:00:00.000Z' },\n expected: ['b', 'c', 'd'],\n },\n {\n what: 'text under binary orders by code point: capitals and digits before lower case',\n body: from.pipe(Query.where(Expr.lt(Subject.fields.label, 'a', binary)), byId),\n input: {},\n expected: ['a', 'c', 'd'],\n },\n {\n what: 'text under asciiFold orders with ASCII case folded',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, 'j', { collation: Collation.asciiFold })),\n byId,\n ),\n input: {},\n expected: ['a', 'b', 'd'],\n },\n {\n what: 'a null compared is unknown, so it matches neither the comparison nor its not',\n body: from.pipe(Query.where(Expr.gte(Subject.fields.tag, 'x', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'not of a comparison leaves a null out too',\n body: from.pipe(Query.where(Expr.not(Expr.gte(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: [],\n },\n // ---- encoded values ------------------------------------------------------\n // The body's types say `Date`; a store's rows and a request's inputs are ISO\n // strings. An interpreter compares in the **encoded** space, and these are the\n // cases that say so — for every other column the two spaces hold the same\n // value, so nothing here could previously tell them apart.\n //\n // What happens when a caller passes a *decoded* value is deliberately not a\n // case, because the interpreters do not agree: the reference one matches\n // nothing, SQLite raises `datatype mismatch`, and a local engine does\n // whatever its own comparison does. `cases` are what interpreters must agree\n // about. The consequence is pinned in `packages/entity/test/encoding.test.ts`\n // instead, and it is the one that matters: **a runtime error cannot be relied\n // on to catch the mistake**, because one of the three answers is an empty\n // result that reads exactly like a correct one.\n {\n what: 'an input whose encoded form differs from its decoded one matches on the encoded one',\n body: from.pipe(Query.where(Expr.eq(Subject.fields.at, at)), byId),\n input: { at: '2026-01-02T00:00:00.000Z' },\n expected: ['b', 'c'],\n },\n {\n what: 'a literal is encoded too, or it has the same problem as an input',\n body: from.pipe(\n Query.where(Expr.eq(Subject.fields.at, '2026-01-03T00:00:00.000Z' as never)),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n\n // ---- ordering ------------------------------------------------------------\n {\n what: 'orders ascending by a number',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders descending, and a later term breaks the tie',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank), Order.asc(Subject.fields.id))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'puts rows without a value last ascending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag))),\n input: {},\n expected: ['b', 'd', 'e', 'a', 'c'],\n },\n {\n what: 'puts rows without a value first descending, unless told otherwise',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag))),\n input: {},\n expected: ['a', 'c', 'e', 'b', 'd'],\n },\n {\n what: 'puts rows without a value first ascending when the term says so',\n body: from.pipe(Query.orderBy(Order.asc(Subject.fields.tag, { nulls: 'first' }))),\n input: {},\n expected: ['a', 'c', 'b', 'd', 'e'],\n },\n {\n what: 'puts rows without a value last descending when the term says so',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.tag, { nulls: 'last' }))),\n input: {},\n expected: ['e', 'b', 'd', 'a', 'c'],\n },\n {\n what: 'breaks a tie by the id where the order does not say how',\n body: from.pipe(Query.orderBy(Order.desc(Subject.fields.rank))),\n input: {},\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the field the input chose, ascending',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'asc' } },\n expected: ['b', 'a', 'c', 'd', 'e'],\n },\n {\n what: 'orders by the field the input chose, descending, the next term breaking the tie',\n body: from.pipe(chosen),\n input: { sort: { by: 'rank', direction: 'desc' } },\n expected: ['e', 'c', 'd', 'a', 'b'],\n },\n {\n what: 'orders by the terms after a chosen order when the input chose none',\n body: from.pipe(chosen),\n input: { sort: null },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n // ---- text, ordered by a declared collation -------------------------------\n {\n what: 'orders text by code point under a binary collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.binary })),\n ),\n input: {},\n expected: ['d', 'a', 'c', 'b', 'e'],\n },\n {\n what: 'orders text with ASCII case folded under an asciiFold collation',\n body: from.pipe(\n Query.orderBy(Order.asc(Subject.fields.label, { collation: Collation.asciiFold })),\n ),\n input: {},\n expected: ['d', 'a', 'b', 'c', 'e'],\n },\n // Ordering by text with no declared collation is deliberately not here. How text compares is the\n // backend's — SQLite by code point, TanStack by locale, Postgres by whatever\n // the database was created with — and §6.0.1 puts it outside the conformant\n // subset rather than pretending one of them is the rule. A case asserting an\n // order would only pin whichever engine was written first.\n\n // ---- defined operators -----------------------------------------------------\n {\n what: 'a defined operator matches the rows what it means does',\n body: from.pipe(Query.where(tagged(Subject.fields.tag)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'a defined operator under not is the negation of what it means',\n body: from.pipe(Query.where(Expr.not(tagged(Subject.fields.tag))), byId),\n input: {},\n expected: ['a', 'c'],\n },\n {\n what: 'a defined operator over an input only is decided by the request',\n body: from.pipe(Query.where(Expr.or(tagged(maybeTag), Expr.eq(Subject.fields.rank, 3))), byId),\n input: { maybeTag: null },\n expected: ['c', 'd'],\n },\n {\n what: 'a defined scalar operator compares as what it means',\n body: from.pipe(Query.where(Expr.eq(rankOf(Subject.fields.rank), 3)), byId),\n input: {},\n expected: ['c', 'd'],\n },\n]\n\nconst prefix = Expr.input('prefix', Schema.NullOr(Schema.String))\nconst asciiFold = { collation: Collation.asciiFold }\n\n/**\n * Bodies calling the kernel's primitive operators (`Text.startsWith`). An\n * interpreter runs these once it implements them: the in-memory one through\n * `Operators.kernel`, a compiler through its own table.\n */\nexport const primitiveCases: ReadonlyArray<ConformanceCase> = [\n {\n what: 'startsWith under binary is exact about case',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'In', binary)), byId),\n input: {},\n expected: ['a'],\n },\n {\n what: 'startsWith under asciiFold folds ASCII case on both sides',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, 'IN', asciiFold)), byId),\n input: {},\n expected: ['a', 'b'],\n },\n {\n what: 'startsWith the empty prefix holds for every row with text',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: '' },\n expected: ['a', 'b', 'c', 'd', 'e'],\n },\n {\n what: 'startsWith over null text is unknown, so its rows are not matched',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.tag, '', binary)), byId),\n input: {},\n expected: ['b', 'd', 'e'],\n },\n {\n what: 'startsWith a null prefix is unknown for every row',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: null },\n expected: [],\n },\n {\n what: 'startsWith reads % and _ as characters, never as like wildcards',\n body: from.pipe(\n Query.where(\n Expr.or(\n Text.startsWith(Subject.fields.label, '100%', binary),\n Text.startsWith(Subject.fields.label, 'sn_', binary),\n Text.startsWith(Subject.fields.label, 'O%', binary),\n ),\n ),\n byId,\n ),\n input: {},\n expected: ['d'],\n },\n {\n what: 'startsWith under not keeps a null unknown',\n body: from.pipe(Query.where(Expr.not(Text.startsWith(Subject.fields.tag, 'x', binary))), byId),\n input: {},\n expected: ['e'],\n },\n]\n\n/**\n * A body whose answer no two interpreters agree on, so every interpreter must\n * refuse it rather than answer. Run each through yours and expect a failure.\n */\nexport interface ConformanceRefusal {\n readonly what: string\n readonly body: AnyQuery\n /** The inputs, encoded, as in `ConformanceCase`. */\n readonly input: Readonly<Record<string, unknown>>\n}\n\nconst NUL = String.fromCharCode(0)\n\nexport const refusals: ReadonlyArray<ConformanceRefusal> = [\n // Postgres text cannot hold NUL and SQLite's `like` stops at it.\n {\n what: 'contains refuses a search holding NUL',\n body: from.pipe(Query.where(Expr.contains(Subject.fields.label, label)), byId),\n input: { label: `in${NUL}` },\n },\n {\n what: 'a comparison refuses text holding NUL',\n body: from.pipe(\n Query.where(Expr.lt(Subject.fields.label, label, { collation: Collation.binary })),\n byId,\n ),\n input: { label: `b${NUL}` },\n },\n {\n what: 'contains refuses searched text holding NUL',\n body: from.pipe(Query.where(Expr.contains(text, label)), byId),\n input: { text: `a${NUL}b`, label: 'b' },\n },\n]\n\n/** As `refusals`, for bodies calling the kernel's primitive operators. */\nexport const primitiveRefusals: ReadonlyArray<ConformanceRefusal> = [\n {\n what: 'startsWith refuses a prefix holding NUL',\n body: from.pipe(Query.where(Text.startsWith(Subject.fields.label, prefix, binary)), byId),\n input: { prefix: `In${NUL}` },\n },\n]\nexport * from './operator.js'\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAa,UAAU,KAAK,WAAoB;AAchD,MAAa,cAAc,KAAK,WAAwB;AAqBxD,MAAMA,QAAM,OAAO,aAAa,CAAC;AAEjC,MAAM,QAAQ;CAAC;CAAI;CAAK;CAAK;CAAM;CAAM;CA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