docs(search): document the field selection form and the extended search refusal - #29
Open
PMerlet wants to merge 2 commits into
Open
docs(search): document the field selection form and the extended search refusal#29PMerlet wants to merge 2 commits into
PMerlet wants to merge 2 commits into
Conversation
…ch refusal The Node.js agent has refused extended search on any collection with a `replaceSearch` handler since 1.97.3, because it cannot enumerate the fields a handler reads and so cannot check them against the caller's read permission. Nothing on the search page said so, and every Node.js example on it used the handler form. The two `onlyFields` / `excludeFields` examples now use the field selection form that 1.71.3 introduced, which the agent can enumerate and permission-check, so extended search keeps working. The two remaining handler examples keep their handler and say what it costs — the Context-Dependent Search example in particular, whose `extendedMode` branch has been unreachable since 1.97.3. Scoped to Node.js throughout: Ruby serves an extended search on a handler collection without checking it, and the Python agent has no such check at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
…keover Both raised by review on #29 and checked against agent-nodejs: - `lenientGetSchema` resolves a path segment only through `ManyToOne`, `OneToOne` and `OneToMany`. A `ManyToMany` segment resolves to null and the path is filtered out, so `includeFields: ['tags:name']` searched nothing while the page claimed paths cross relations at any depth. - `refineFilter` implements the search itself as soon as a replacer is set, so on a datasource that called `enableSearch()` a field selection does not narrow the native search, it replaces it with the agent's per-column one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
@forestadmin/agent1.97.3 shipped ForestAdmin/agent-nodejs#1840, which refuses an extended search whenever the agent cannot enumerate the fields the search reads. AreplaceSearchhandler prevents that enumeration, so every collection with a custom search handler now returns a 403 on extended search.Nothing on the search page said so — and every Node.js example on it used the handler form. A customer following the documentation was walking into the failure.
It shipped as a patch, with no
BREAKINGmarker anywhere in the changelog, so the page is the main place a customer would find out.What changed
product/build/search-configuration.mdx:How Search Works— the extended search bullet now states the permission check and the enumeration requirement.Replacing the Search Handler— a table of the two forms and what each costs, plus a<Warning>quoting the actual error message and naming the versions.Restricting Which Fields Are SearchedandExcluding Fields from Default Search— the Node.js examples now use the field selection form from ForestAdmin/agent-nodejs#1852 (replaceSearch({ onlyFields: [...] })), which the agent enumerates and permission-checks, so extended search keeps working.includeFieldsand relation paths documented alongside.Context-Dependent SearchandIntegrating an External Search Engine— these genuinely need a handler, so they keep it and now say what it costs.Limitations— added, with the per-agent matrix and the version requirements.reference/agent-api/nodejs.mdx:collection.replaceSearchnow documents both forms, the three field-selection options as a table, and the extended-search consequence.The example that had become self-contradicting
Worth a reviewer's eye.
Context-Dependent Searchbranches onextendedModeto pick itsonlyFields:Because it installs a handler, the agent refuses the extended search before the handler runs. Its extended branch has been unreachable since 1.97.3. The page now says so rather than leaving the example looking functional. The Ruby version of the same example still reaches its branch.
Cross-agent accuracy
Scoped to Node.js throughout, checked against each SDK rather than assumed:
collect_search_usagesreturns early on an unknown footprint instead of refusingThe Ruby row is a gap rather than a design choice: the extended-search half of the disclosure #1840 closed is still open there. That belongs in a ticket on
agent-ruby, not in this PR, and I have not opened one yet.Also worth flagging, outside this PR
A customer whose handler is genuinely custom — an external index, a filter derived from the search string — has no migration path. Extended search stays refused for them, and the only alternatives are
disableSearch()or dropping their custom search. Letting a handler declare its own footprint would fix that and needs a change inagent-nodejs.🤖 Generated with Claude Code
Note
Document
replaceSearchfield selection form and extended search 403 refusalreplaceSearchin Node.js: field selection (SearchFieldsDefinition) and handler (SearchHandlerDefinition), with a comparison table in search-configuration.mdx@forestadmin/agent1.97.3+, using a handler causes extended search to return 403 because the agent cannot enumerate read fields ahead of the query; normal search still worksonlyFields,excludeFields) instead of a handler returningcontext.generateSearchFilterdatasource-customizer1.71.3+, shipped in agent 1.98.3), cross-language behavior differences, and handler exemption from read-permission checks on normal searchMacroscope summarized 1b9d8ba.