Repository navigation
fix(api): keep excludent productClusterIds as repeated path facets - #3433
Conversation
Segment facets sharing the productClusterIds key (e.g. an inclusion and an exclusion cluster) were collapsed into a single query param via a plain object, so the last one silently overwrote the others. The surviving value was then sent as a singular `productClusterId` query param, a shape Intelligent Search does not recognize — it expects each occurrence as a repeated path segment (productClusterIds/X/productClusterIds/not:Y/), same as any other facet. productClusterIds now flows through the existing extraFacets/path pipeline like other repeated facets, instead of through a single-value query param.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe VTEX request builder no longer converts ChangesVTEX product cluster facet serialization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
| // NOTE: productClusterIds (and any other repeated facet key, e.g. for | ||
| // excludent collections) must stay as path segments, not collapse into | ||
| // a single query param — IS expects productClusterIds/X/productClusterIds/not:Y/. |

0 New Issues
0 Fixed Issues
0 Accepted Issues
What's the purpose of this pull request?
Fix a FastStore Intelligent Search bug (found while triaging a report on the odpstage account, Slack thread) where an excludent collection filter silently does nothing: products from an excluded
productClusterIdscluster keep showing up even though the session facets correctly ask to exclude them.How it works?
Since the IS v1 migration,
intelligentSearchRequest.tstreatedproductClusterIdssegment facets as a single query param, stored in a plain JS object keyed byproductClusterIds. When the session sends two facets sharing that key — one inclusion (productClusterIds=80182) and one exclusion (productClusterIds=not:80183) — the second silently overwrites the first in the object, and the one value that survives is still sent in the wrong shape: a singularproductClusterIdquery param, which Intelligent Search does not recognize.IS actually expects each occurrence as a repeated path segment (confirmed with a manual request against the account's IS endpoint):
The fix removes the special single-value query-param handling for
productClusterIdsso it flows through the sameextraFacets/path pipeline as any other repeated facet, producing the correct repeated path segments.How to test it?
packages/api/test/unit/platforms/vtex/utils/intelligentSearchRequest.test.ts:productClusterIdscookie test to assert the corrected path-based output.productClusterIdquery param is emitted anymore.packages/apiunit suite locally: all tests passing.vtexdefaults) to confirm this is a framework bug, not an account customization issue, before implementing the fix.References
Reported and investigated in an internal Slack thread (Search & Recommendation team) about the odpstage account's excludent collection filter not working on Intelligent Search.
Checklist
pnpm-lock.yamlchanges (no dependency changes)Summary by CodeRabbit