Skip to content

feat(intsch): emit dpPreview=true on non-master workspaces (DPT-67)#552

Open
garibu wants to merge 3 commits into
mainfrom
feat/DPT-67-dp-preview
Open

feat(intsch): emit dpPreview=true on non-master workspaces (DPT-67)#552
garibu wants to merge 3 commits into
mainfrom
feat/DPT-67-dp-preview

Conversation

@garibu

@garibu garibu commented May 28, 2026

Copy link
Copy Markdown

Summary

  • Activates Delivery Promises on the IS API for QA traffic by emitting dpPreview=true automatically on every workspace other than master. Production traffic in master is unchanged.
  • Storefronts running on a non-master workspace no longer need the store to flip deliveryPromisesEnabled in order to validate DP end-to-end. The persisted store setting becomes a clean signal of production adoption.

Changes

  • node/clients/intsch/utils.ts
    • New shouldInjectDPPreview(workspace) helper. Returns true for any workspace that is not master and not undefined/empty.
    • dpPreview added to INTELLIGENT_SEARCH_PRODUCT_QUERY_KEYS so the param survives filterByAllowedIntelligentSearchQueryKeys.
  • node/clients/intsch/index.ts
    • productSearch() and facets() derive dpPreview from this.context.workspace and add it to the merged params before the allowlist filter.
  • node/clients/intsch/utils.test.ts
    • Unit coverage for the helper across master / non-master / undefined / empty.
    • Coverage for the allowlist behavior on the new key.

Context

This is the storefront half of DPT-67. The companion PRs:

  • sp-node — adds the dpPreview query param parsing, gatekeep, and APM activation-source label: https://github.com/vtex/sp-node/pull/486
  • intelligent-search (intsch) — propagates the param to the search-engine and exposes the activation source on the API response (PR forthcoming in this same ticket).

The intelligent-search-api (TS legacy) was intentionally left out of scope — only the modern intsch (Rust) path receives the new behavior.

Test plan

  • yarn test — 163 passing (3 unrelated skips), including the new helper specs
  • yarn lint — clean (tsc --noEmit)
  • Deploy a beta tag of search-resolver to a sandbox workspace and confirm:
    • Calls from master do not carry dpPreview in the IS API query
    • Calls from a non-master workspace carry dpPreview=true
    • DP behavior end-to-end with deliveryPromisesEnabled=false only fires in the non-master workspace

Ticket

https://vtex-dev.atlassian.net/browse/DPT-67

Adds workspace-driven QA mode for Delivery Promises: the Intsch client now
appends `dpPreview=true` to product-search and facets requests whenever the
current IO workspace is not `master`. Storefronts running QA in a workspace
get DP activated end-to-end on the IS API without the store having to flip
the persisted `deliveryPromisesEnabled` setting. Production traffic in
`master` is untouched.

- New `shouldInjectDPPreview(workspace)` helper centralizes the policy
  (`master` and undefined/empty values stay opted out).
- `dpPreview` added to the IS API query keys allowlist so the param
  survives `filterByAllowedIntelligentSearchQueryKeys`.
- Coverage for the helper and the allowlist behavior.

Refs: https://vtex-dev.atlassian.net/browse/DPT-67

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vtex-io-ci-cd

vtex-io-ci-cd Bot commented May 28, 2026

Copy link
Copy Markdown

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot

vtex-io-docs-bot Bot commented May 28, 2026

Copy link
Copy Markdown

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

Tighten the comments added in the previous commit. Helper names and the
PR description carry the rationale — inline blocks were repeating each
other.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@garibu garibu marked this pull request as ready for review May 29, 2026 18:36
@garibu garibu requested a review from a team as a code owner May 29, 2026 18:36
@garibu garibu requested a review from Copilot May 29, 2026 18:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables Delivery Promises QA behavior for the modern intsch (Rust) Intelligent Search API calls by automatically emitting dpPreview=true whenever the request is running on a non-master VTEX IO workspace, while keeping master (production) traffic unchanged.

Changes:

  • Added dpPreview to the Intelligent Search query-param allowlist so it survives request param filtering.
  • Introduced shouldInjectDPPreview(workspace) helper and used it in productSearch() and facets() to conditionally inject dpPreview=true.
  • Added unit tests for the new helper and for allowlist behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
node/clients/intsch/utils.ts Adds dpPreview to the allowlist and introduces shouldInjectDPPreview() to gate param injection by workspace.
node/clients/intsch/index.ts Injects dpPreview=true into product-search and facets requests on non-master workspaces before allowlist filtering.
node/clients/intsch/utils.test.ts Adds unit coverage for shouldInjectDPPreview() and verifies dpPreview is allowlisted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread node/clients/intsch/utils.ts Outdated
…pace name

Per review: a workspace can be non-master yet still production, so keying
the QA override off the workspace name would leak dpPreview into real
production traffic on named production workspaces. Gate on
`context.production` instead — only non-production workspaces emit the param.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@salesfelipe salesfelipe added the enhancement New feature or request label Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants