Skip to content

search() plain-object shorthand silently does a full-table scan instead of filtering #1426

Open

Description

@kriszyp

Summary

The resource search() API accepts a plain object literal — tables.Widget.search({ bucket: 'b1' }) — but silently ignores it as a filter and returns an unconditional full-table scan instead of filtering by the attribute. The correct indexed form is the array-of-conditions shorthand: search([{ attribute: 'bucket', value: 'b1' }]).

The plain-object form neither errors nor warns, so a developer expecting a filtered result gets the entire table back — a silent-wrong result plus a hidden full scan on large tables.

Reproduction

// Expected: only rows where bucket === 'b1'
const wrong = await tables.Widget.search({ bucket: 'b1' });   // returns ALL rows (full scan)

// Correct: array of condition objects
const right = await tables.Widget.search([{ attribute: 'bucket', value: 'b1' }]);  // filtered

search() with the object form returns every row; the bucket key is neither applied as a predicate nor rejected.

Impact

Low–medium. Two failure modes from one call:

  • Silent-wrong result — the caller believes it filtered, but receives the whole table.
  • Performance footgun — a full-table scan where an indexed lookup was intended; bites hardest on large tables.

Surfaced incidentally during the QA campaign (QA-184): probe code using the object shorthand was inadvertently full-scanning.

Suggested fix

Either:

  1. DWIM — accept the plain-object form as an equality filter ({attr: val} → [{attribute: attr, value: val}]), or
  2. Fail loud — reject the object form with a clear error pointing at the array-condition form.

At minimum, document the two forms and that the object form is not a filter.


Surfaced by the QA-explorer exploratory campaign. Filed by Claude (Opus 4.8).

Activity

  1. added this to the v5.2 milestone on Aug 7, 2026
  2. added theissue type on Aug 7, 2026
  3. modified the milestones: v5.2, v5.4 on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    P1

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions