A missing identifier is refused, not ignored

If a query arrives with a filter value that is explicitly empty, the server rejects it rather than silently running a wider search.

What it is

A guard on the filter map in the data proxy. Any filter key whose value is undefined causes a 400 with a message naming the key, instead of being dropped. Client-supplied org_id is always discarded and re-applied from the session. Explicit nulls are handled separately and correctly as IS NULL.

Also called: undefined filter · query ran too wide · wrong customer's total appeared

See it
A missing identifier is refused, not ignored
Area
Platform & Admin
Group
Tenancy & isolation
System
Multi-Tenancy & Identity
Solves
2 named problems
01Client filters are copied into a sanitised map before use.
02Any org_id key is dropped so the authoritative one can be re-applied.
03A value of undefined returns a 400 naming the offending key and telling the caller to resolve it before calling.
The 400 response body quoted verbatim: 'Filter "estimate_link_id" is undefined. A missing identifier must not widen the query.' Source: src/app/api/db/route.ts. Sample data — no customer information appears here.
How it works
  1. 1Client filters are copied into a sanitised map before use.
  2. 2Any org_id key is dropped so the authoritative one can be re-applied.
  3. 3A value of undefined returns a 400 naming the offending key and telling the caller to resolve it before calling.
  4. 4An explicit null is translated to IS NULL, because equality against null is rejected by typed columns.
Why we built it

This guard is the direct product of L2B-HMN3V9, and the comment records the exact shape of the bug: a call site wrote `estimate_link_id: someRow.id ?? undefined`, the undefined value could not survive JSON, 'so the query silently ran WIDER than the caller wrote' and returned the newest contract in the account — 'so one customer's signed total appeared on another customer's invoice.' The comment is honest about the limits of the fix: 'We cannot see the key that vanished, but we can refuse the one shape that does arrive.' A widened query inside a single account is not a cross-account leak, but it is exactly the class of silent error that produces a wrong number on a real document.

The problem
  • A dropped filter turned a targeted lookup into 'whatever is newest', producing a wrong number on a customer document.
  • The failure was silent — the query succeeded, it just answered a different question.
Sound familiar?
What you get
A missing identifier fails immediately with a message naming the field.
Queries never widen by accident.
Null-versus-missing is handled explicitly rather than by coincidence.

See it on your own jobs

Twenty minutes, your numbers, no slide deck. We’ll build one of your real buildings in front of you and send you the estimate link at the end — yours to keep either way.

or keep browsing features →