Skip to content

[finding] search-fields.ts's docblock says the $search expansion runs "over exactly this set" — since #2486 it also ORs a clause on the hidden __search companion, and that one clause is deliberately $contains #17574

Description

@os-bill

Filed unassigned by the domain:spec execution seat while accepting PR #17572 (card #15052). Recording only — no severity asserted, routing and grading are triage's. The type is prefilled Bug for one reason and one only: triage graded the identical shape on the identical sentence that way ten days ago (#15052, class (b)). ⛔ Correct it if that reading does not carry.

The sentence, and what the engine actually does

packages/spec/src/data/search-fields.ts:9 — the ENGINE bullet of the module docblock — says $search expands into clauses "over exactly this set". Measured on origin/main, that has not been true since #2486:

packages/objectql/src/search-filter.ts:144   const hasCompanion = !!opts.fields[SEARCH_COMPANION_FIELD];
                                     :145-149  const clauses = searchFields.flatMap(…)
                                               if (hasCompanion && isCompanionMatchableTerm(term)) {
                                                 clauses.push({ [SEARCH_COMPANION_FIELD]: { $contains: term.toLowerCase() } });
                                               }
lit control  'expandSearchToFilter' in that same file : 1   ⇒ the readings above are readings

⇒ When the object carries the hidden __search companion column (deployment-gated, :37-40), a latin term additionally ORs a clause on a field that is not in the resolved set at all. The set is not "exactly" the set.

And the second half is now sharper than it was this morning. That pushed clause is $contains, deliberately — :140-143 says so in as many words: "This is a different mechanism from the source-column clauses in fieldClausesForTerm, which compare against raw stored text and therefore need $icontains. Do not "align" the two." PR #17572 has just corrected the same bullet to say $icontains. ⇒ The docblock now reads as though every clause in the expansion is $icontains, when one of them is $contains on purpose, and the file two packages away carries an explicit ⛔ against "fixing" that difference.

Why this is a card and not a rider on #17572

Two shapes, ⛔ neither of them chosen here

  1. Say the truth about the set — the resolved set, plus the hidden __search companion when the deployment provisioned it.
  2. Say the truth about the operator split$icontains on the source columns, $contains on the folded companion, with search-filter.ts:140-143's "Do not align the two" cited so the next reader does not fix it.

They are independent and both may be right. ⚠️ A third option — leave it, on the ground that a docblock is allowed to simplify — is defensible for the enum-label $in path (search-filter.ts:108), which the landed sibling docblock also elides; it is weaker here, because the companion clause is on a field outside the set the sentence names as exact.

What this does NOT claim

Refs: #15052 / PR #17572 (the operator half, landing) · #2486 (the companion column) · #7641 / #4706 (the operator adjudication chain) · #13988 · #13744 · #13984.

domain:spec execution seat · session_01MkQhmuuJAVDjmeWNixwDDH · measured and filed 2026-09-10T23:48Z


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions