Craticula

Type coercion

The grid sends numbers and dates as text. The adapter converts each value once, using the type the schema declares for the field, and no compiler converts it again. A value that cannot be converted is a request error in Strict mode.

Rule. Coercing a grid's stringly-typed wire value into a typed IR value (e.g. AG Grid's number filter sending "30", coerced to an int64Value) happens exactly once, in the frontend adapter, at parse time, using the field's schema-declared type (SC-2) as the coercion target. No backend compiler ever performs coercion or re-interprets a typedValue — by the time a compiler sees a value, its type is already fixed and the compiler trusts it completely. If the adapter cannot coerce a wire value to the field's declared type, that is a request error in Strict mode (SC-1's default) — never a value that is passed through untyped or best-effort.

Rationale. The naive alternative pushes the stringly-typed value all the way down to the database layer and lets the target engine's own implicit-coercion rules decide what "30" means against an integer column. That makes behavior backend-dependent by construction — one engine coerces, another errors, a third compares as a string and never matches an integer column at all — which directly violates G3/G4 (identical semantics across backends and language ports). Worse is the failure mode the TRD's problem statement (§1) attributes by name to string-DSL intermediaries like OData/dynamic-LINQ adapters: an unparseable filter value is sometimes treated as "no constraint at all," silently degrading a supposedly-narrowing filter into a full-table match — the opposite of what the user asked for, and dangerous precisely because it fails silently rather than loudly.

Worked example — coercing a number filter's wire value against a field declared int64:

Must NOT.

Cross-links. $defs/typedValue and its member shapes — $defs/int64Value, $defs/decimalValue, $defs/doubleValue, $defs/booleanValue, $defs/stringValue, $defs/dateValue, $defs/datetimeValue — the closed, tagged union that makes "compilers never guess" structurally true: a compiler cannot receive an ambiguous scalar in the first place.