Skip to content

fix(objectql): normalize OData $search/$searchFields so the search executor runs (ADR-0061)#2142

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/search-protocol-normalize
Jun 21, 2026
Merged

fix(objectql): normalize OData $search/$searchFields so the search executor runs (ADR-0061)#2142
xuyushun441-sys merged 1 commit into
mainfrom
feat/search-protocol-normalize

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Follow-up to the $search executor (#2134). Browser/HTTP end-to-end testing revealed the executor never ran over the REST/OData path: protocol.findData() normalizes $-prefixed OData params ($top/$skip/$orderby/$select/$count) to bare names, but not $search/$searchFields. So $search=retail fell through to the implicit-field-filter pass and became where.$search = 'retail' (a non-existent column) → the SQL driver silently returns []. The engine's expandSearchToFilter (which reads ast.search) therefore never fired — $search looked like a no-op over HTTP even though the engine logic was correct and unit-tested.

Fix

  • Add ['$search','search'] and ['$searchFields','searchFields'] to the dollar→bare normalization loop in findData.
  • Add 'searchFields' to knownParams so the bare form isn't swept into implicit filters.
  • Test: findData normalizes $search/$searchFields to bare search/searchFields and never leaks them into where.

Verification (real HTTP API, dev backend with the executor)

  • ?$search=retail3 retail-industry accounts (Acme Retail / Northwind / Wonka Brands), matched by the industry label→value, not by name.
  • ?$search=technology → 4 (by industry label) · ?$search=Contoso → 1 (by name) · ?$search=zzqq → 0 · baseline → 13.
  • Browser console (pointed at the dev backend) renders the same backend's data.

This is the missing link that makes ADR-0061 P2 actually work end-to-end over REST. Unit tests: protocol-data (34) green; objectql typecheck clean.

…ecutor runs (ADR-0061)

Follow-up to the $search executor (#2134): over the REST/OData path the term
never reached engine.find(). protocol.findData() normalizes $-prefixed OData
params ($top/$skip/$orderby/$select/$count) to bare names, but NOT $search /
$searchFields — so `$search=retail` fell through to the implicit-field-filter
pass and became `where.$search = 'retail'` (a non-existent column), which the
driver silently returns [] for. The engine's expandSearchToFilter (which reads
ast.search) therefore never fired.

- Add ['$search','search'] and ['$searchFields','searchFields'] to the
  dollar→bare normalization, and add 'searchFields' to knownParams so the bare
  form isn't treated as an implicit filter.
- Test: findData normalizes $search/$searchFields to bare and never leaks them
  into where.

Verified end-to-end over the real HTTP API against a dev backend: searching
"retail" returns the 3 retail-industry accounts (matched by the industry
label→value), "technology" → 4, "Contoso" → 1 by name, "zzqq" → 0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 21, 2026 3:49pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/objectql.

14 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/core/services.mdx (via @objectstack/objectql)
  • content/docs/concepts/implementation-status.mdx (via @objectstack/objectql)
  • content/docs/concepts/metadata-lifecycle.mdx (via @objectstack/objectql)
  • content/docs/concepts/packages.mdx (via @objectstack/objectql)
  • content/docs/guides/authentication.mdx (via @objectstack/objectql)
  • content/docs/guides/deployment-vercel.mdx (via @objectstack/objectql)
  • content/docs/guides/formula.mdx (via packages/objectql)
  • content/docs/guides/kernel-services.mdx (via @objectstack/objectql)
  • content/docs/guides/objectql-migration.mdx (via @objectstack/objectql)
  • content/docs/guides/packages.mdx (via @objectstack/objectql)
  • content/docs/guides/plugins.mdx (via @objectstack/objectql)
  • content/docs/protocol/objectos/index.mdx (via @objectstack/objectql)
  • content/docs/protocol/objectql/state-machine.mdx (via @objectstack/objectql)
  • content/docs/releases/v9.mdx (via @objectstack/objectql)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@xuyushun441-sys
xuyushun441-sys merged commit cecbbdb into main Jun 21, 2026
16 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/search-protocol-normalize branch June 21, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants