Strict mode: gRPC facet requests with exact=true bypass search_allow_exact=false (REST rejects them)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 34.7k
- Forks
- 2.7k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 187
Description
Current Behavior
With strict mode enabled and search_allow_exact: false, a gRPC Facet request with exact: true is accepted and runs an exact facet count. The equivalent REST request (POST /collections/{collection_name}/facet with "exact": true) is correctly rejected with a strict-mode error, so REST and gRPC disagree.
Expected Behavior
Both APIs should reject exact: true when strict mode disallows exact search.
Steps to Reproduce
- Create a collection with
"strict_mode_config": {"enabled": true, "search_allow_exact": false}. - Over REST:
POST /collections/{name}/facetwith{"key": "<indexed_key>", "exact": true}-> strict mode error ("Exact search disabled!"). Correct. - Over gRPC:
Facetwithexact: true-> 200 OK, exact count runs. Wrong.
Root Cause
The gRPC facet handler converts the request to FacetParams (defaults applied) and verifies that. StrictModeVerification for FacetParams::request_exact() returns None, so check_bool_opt skips the exact check. The REST handler verifies FacetRequestInternal, whose request_exact() returns self.exact, so REST enforces the setting. FacetParams already carries the resolved exact field; it just never reports it.
I have a fix with a regression test and will open a PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the gRPC facet handler and its conversion to FacetParams, then inspect StrictModeVerification for FacetParams and request_exact(). Compare this path with the REST FacetRequestInternal verification and locate the existing facet strict-mode regression tests. Done means gRPC rejects exact=true with the same strict-mode behavior as REST when search_allow_exact is false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, rust
- Domain
- api, backend, search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100