Repository navigation
feat: release 4.7.0 (graduate dev → main) - #3471
Conversation
…llback Restore experimental.enableRecommendations so Layout starts the session on every page when opted in, and fall back from RecommendationShelf when the flag is off and userId is missing. Remove CMS enableRecommendations gating.
Use nullish coalescing for the session enable override and only start the shelf fallback after userId lookup resolves to null.
Split the discovery flag read from the optional override so Sonar no longer flags a negated ternary or ambiguous nullish expression.
PATH lookup only orders directories, so it runs whichever next the nearest node_modules/.bin holds. On a monorepo where another package pins an older major, that copy can win the root .bin link and the build fails with 'error: unknown option --webpack'. Resolve through the dependency graph instead, falling back to the bare command.
JSON.stringify escapes the separators of a Windows path, so the script reached the shell with every backslash doubled. Node accepts forward slashes on Windows, and quoting still covers directories with spaces.
The generated scripts run from .faststore, so an absolute path put the whole store directory into a shell string — a quote, a dollar sign or a backtick anywhere above the project would have broken it, and on Windows the separators needed escaping that then reached the shell verbatim. A relative path only ever spans node_modules segments, so none of that can appear, and it needs no quoting on either platform.
New-code coverage sat at 16% because relativeNextBin, which is most of what this PR adds to generate.ts, had no test. It is exported and tested against a real tree: a Next under core, and one only an ancestor carries, which is the case a hoisted install depends on.
Sonar matches Ant-style paths — *, ** and ? — and does not expand brace
alternation, so `**/*.{test,spec}.{ts,tsx,js,jsx}` matched nothing. Every
test file was therefore analysed as production code: measured for coverage
it does not have, and compared against itself for duplication. It reported
17.30% coverage on new code for a change whose source lines are at 88.9%.
Expanded to explicit patterns, and folded the repeated fixture in the new
test into one helper.
core generate loads the compiled api package, which now imports @faststore/diagnostics at runtime. Without this dist, the automated main → dev back-merge fails with MODULE_NOT_FOUND.
…nto the CLI @inquirer/prompts@5 pulled core@9 (needs CancelablePromise) while unused @inquirer/confirm@5 and codegen pulled type@3. Align prompts to v7 and drop the unused confirm package.
## Summary Adds a "Cards" area to My Account (`/pvt/account/cards`) listing the buyer's personal payment cards and, when applicable, their Organization's/Contract's shared cards. - **`@faststore/api`**: new `commerce.savedCards` client + `listCreditCards` GraphQL query against the Saved-cards service; `SavedCard.origin` (`personal` | `shared`) added and mapped through, using the service's own tagging instead of a second endpoint/round trip; `cardLabel` (buyer/admin-set nickname, when the service has one on file) exposed and preferred over `paymentSystemName` for display; `hasAdHocCardAccess` query resolving the `UseAdHocCard` License Manager resource key for the current user (fail-open on any downstream error). - **`@faststore/core`**: `MyAccountListCards` component (Personal/Shared tabs, search, pagination, empty/error states) wired into the Cards page via SSR (mirrors the My Orders listing pattern); Personal and Shared cards are partitioned client-side from the single `listCreditCards` response by `origin` — no cards are de-duplicated across origins by design (a card present in both is shown in both tabs). - **Personal-tab permission gate**: `useAdHocCard` turned out to be a License Manager resource key resolved from roles, not a session-token claim as first assumed. The route itself and the sidebar entry are never gated — only the Personal tab's visibility is, via `customerId + hasAdHocCardAccess`. When a Unit/Contract-affiliated buyer lacks that permission, only the Shared list renders, with no tab chrome. The two remaining combinations without a Unit/Contract association are left exactly as the component already behaved, pending product confirmation on the intended render (tracked as O1 in the spec — see below). **Authorization-change approval**: this permission-model correction (removing the route-level 404 gate, replacing it with Personal-tab visibility) was walked through and approved by Arthur Andrade in the implementing session before being built, per `AGENTS.md`'s requirement for auth-mechanism changes. ## Tests - `packages/api/test/unit/platforms/vtex/resolvers/savedCards.test.ts`: `origin` and `cardLabel` passthrough on `listCreditCards`. - `packages/api/test/unit/platforms/vtex/resolvers/hasAdHocCardAccess.test.ts`: grant / deny / error fail-open / non-boolean fail-open / no-`userId` short circuit / malformed-cookie regression. - `packages/api/test/integration/vtex.cookies.test.ts`, `packages/core/test/utils/getCookie.test.ts`: `parseJwt` no longer throws on a malformed auth cookie (both packages' copies). - `packages/core/test/components/account/cards/MyAccountListCards.browser.test.tsx`: tab switching, arrow-key nav, search (incl. by `cardLabel`), pagination, empty/error states, default badge, label precedence/fallback, the `sharedOnly` and no-org-association tab-chrome combinations. - `packages/core/test/components/sections/Account/AccountListCards.browser.test.tsx`, `packages/core/test/pages/pvt/account/cards/index.test.ts`, `packages/core/test/sdk/account/getB2BSessionClaims.test.ts`: section wrapper and `getServerSideProps` branch coverage. - `packages/core/test/server/index.test.ts`, `packages/api/test/integration/schema.test.ts`: schema query-list regression tests updated for the new queries. - SonarQube Quality Gate: passing, 94.10% coverage on new code. - Full suites green on every push; typecheck clean on every file touched. ## Deviations - The parent implementation spec originally modeled the Personal-tab permission as a route-level 404 gate. That was corrected mid-implementation once `useAdHocCard`'s real semantics (a resolved License Manager role, not a token claim) were confirmed — see the "Personal-tab permission gate" point above. The route and sidebar entry are never blocked; only Personal-tab visibility is conditional. - A related backend defect was found while testing against a live B2B account: `GET /credit-card` on the Saved-cards service returns a generic unhandled-exception 500 for at least one real session (reproduced independently via `curl`, isolating it from this BFF). Likely cause: `RequestContextResolver.ResolveUserId()` throws unhandled when `User.UserId` is absent, a path newly introduced by the service's own recent PR. Flagged to the Saved-cards team with trace IDs; **since fixed on their end** and reconfirmed working in this session. ## Spec - vtex/faststore-dx-spec-kit#24 — `my-account-cards.md`, `my-account-cards-gating-plan.md`, `my-account-cards-shared-listing-unblock.md` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a My Account Cards page for viewing personal and shared saved payment cards. - Added card search, tabs, pagination, empty states, default-card indicators, and responsive layouts. - Added CMS configuration and navigation support for the Cards page. - Added access checks to control personal-card visibility. - **Bug Fixes** - Malformed authentication tokens are now handled safely without disrupting page rendering. - Card-service and permission errors provide appropriate fallback and recovery states. - **Tests** - Added coverage for card retrieval, access checks, authentication handling, and schema updates. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
Waiting for null exhausted cookie retries before the mutation could set vtex-rec-user-id, so the first page with a shelf never fetched.
## What's the purpose of this pull request? Resolves **O1**, the open question left in #3443: what the Cards page should render for the combinations *without* a Unit/Contract association. Those combinations were deliberately left "exactly as the component already behaved, pending product confirmation". Testing the released `4.7.0-dev.0` against a plain B2C shopper surfaced what that behaviour actually is, and it is not good: - The sidebar advertises **Cards** to every shopper, including ones with no card capability at all. - The page renders a **lone, inert "Personal" tab** — a single `role="tab"` button with nothing to switch to. The component already avoids this on the other side (`sharedOnly` returns a plain label, no tab chrome), so it was asymmetric. - Underneath that tab, `listCreditCards` answers **500**: the Saved-cards service has no customer record for a buyer with no association. The buyer gets "We couldn't load your cards" on a page they were never able to use. ## How it works? Cards is now org-gated the same way Quotes already is. **Sidebar** — `CARDS_ROUTE` joins `ROUTES_ONLY_FOR_B2B_MEMBERS`. Both consumers (`account/Layout` and `OrganizationDrawerBody`) already filter that list by `isOrgMember`, so no new wiring. **Route** — `getServerSideProps` redirects to `/pvt/account/404` when `hasOrgAssociation` is false. The gate sits **ahead of the query** so a buyer who cannot reach the page never costs a round trip to the service that 500s for them. The comment in `Layout.tsx` that asserted the opposite ("the sidebar entry always stays visible") was rewritten. `useAdHocCard` is untouched and remains the finer, separate gate over Personal-tab rendering only. It still never hides the entry. ### Note for reviewers: two follow-ups I did not fold in - **Divergence with Quotes.** Quotes redirects non-members to `/pvt/account/403` (`quotes/index.tsx:201`); this uses `/pvt/account/404` — the gate #3443 originally removed. Two behaviours now exist for the same condition. Worth aligning, in whichever direction. - **Now-dead branches.** With the route gated, `hasOrgAssociation` always arrives `true` in `MyAccountListCards`, so its `{hasOrgAssociation && ...}` guards and the `sharedOnly` path are always-true. Left in place as defensive code rather than widening this PR. ## How to test it? - Sign in as a shopper **without** a Unit/Contract association: - **Cards** must be absent from the My Account sidebar and from the Organization drawer. - Hitting `/pvt/account/cards` directly must land on `/pvt/account/404`. - No request should reach the Saved-cards service. - Sign in as a buyer **with** an association: Cards behaves exactly as it did in #3443, including the `useAdHocCard` Personal-tab gating. ## References - Follows up #3443 (released in `4.7.0-dev.0`), which tracked this as O1. **Authorization-change approval**: #3443 deliberately removed the route-level gate; this reinstates it on a different condition (org membership rather than `useAdHocCard`). Per `AGENTS.md`, that change was walked through and approved by Arthur Andrade before being built. ## Checklist **PR Title and Commit Messages** - [x] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification **PR Description** - [ ] Added a label according to the PR goal **Dependencies** - [x] No package changes, so no `pnpm-lock.yaml` change **Documentation** - [x] PR description ## Tests Full `@faststore/core` suite: **687 passing**. (`test/server/index.test.ts` and `test/server/rootSpan.test.ts` fail to load with `Cannot find package 'cross-inspect'` — verified pre-existing on `dev`, unrelated to this change.) Added: - `getMyAccountRoutes.test.ts` — Cards is marked B2B-only. - `Layout.test.tsx` — entry hidden without an org unit, shown with one. - `cards/index.test.ts` — no-association redirects to `/pvt/account/404` and `execute` is never called. Changed, and worth a look during review: - Two tests used `hasOrgAssociation: false` as an incidental scenario; moved to `true` so they keep exercising what they were written for instead of hitting the new gate. - `keeps personal cards in the payload when there is no org association (FR-7...)` was **removed** — it asserted precisely the behaviour this PR reverses, and its scenario can no longer occur. A comment marks the spot. - `never gates the route` renamed to `does not gate the route on useAdHocCard`, which is still true. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Restricted the Cards area to eligible business accounts with an organization association. * Users without an organization association are now redirected to the 404 page instead of seeing card-related content. * Clarified that personal card availability is controlled separately within the Cards page. * **Tests** * Added coverage for route visibility and 404 behavior for ineligible accounts. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 5 <[email protected]>
## What's the purpose of this pull request? The `Item` type in the VTEX Search API client declares the video field as `Videos`, but the FastStore GraphQL search response returns it as `videos`. This mismatch makes the internal TypeScript type inconsistent with the actual payload and may cause incorrect property access for SKU videos. This PR updates the field casing while preserving its existing `string[]` type. ## How it works? The `Item` interface now declares the field as: ```ts videos: string[] ``` No runtime behavior or public GraphQL schema was changed. ## How to test it? * Confirm that `ProductSearchResult.Item` exposes `videos` as `string[]`. * Run the Biome validation: ```bash pnpm exec biome check packages/api/src/platforms/vtex/clients/search/types/ProductSearchResult.ts ``` * Validate the diff: ```bash git diff --check ``` Both checks should pass. ### Starters Deploy Preview Not applicable. This is a type-only change with no storefront UI or runtime behavior changes. ## References * [[VTEX Search GraphQL documentation](https://developers.vtex.com/docs/apps/vtex.search-graphql)](https://developers.vtex.com/docs/apps/vtex.search-graphql) * [[VTEX product search response example](https://developers.vtex.com/docs/guides/consult-product-search-information)](https://developers.vtex.com/docs/guides/consult-product-search-information) * Actual FastStore search fixtures already use `videos` in lowercase. ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** * [x] PR title and commit messages follow the [[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)](https://www.conventionalcommits.org/en/v1.0.0/) specification * Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` * Prefix used: `fix` * Scope used: `api` **PR Description** * [x] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. * Label used: `bug` **Dependencies** * [x] Committed the `pnpm-lock.yaml` file when there were changes to the packages * No dependencies or package versions were changed, so `pnpm-lock.yaml` was not modified. **Documentation** * [x] PR description * [x] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) * Not applicable. This PR only corrects an internal TypeScript type. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **Bug Fixes** * Improved compatibility for product video data in search results by retaining support for the deprecated `Videos` property alongside `videos`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Evander Oliveira <[email protected]> Co-authored-by: Fanny Chien <[email protected]> Co-authored-by: Fanny Chien <[email protected]>
…My Account (#3464) Fixes the broken Order Details page reported in [SFS-3325](https://vtex-dev.atlassian.net/browse/SFS-3325) (High). [Jira on-call](https://vtex-dev.atlassian.net/browse/SO-667) ## Summary The CMS-driven migration ([#3354](#3354), first released in **v4.4.0**) broke several things at once on `/pvt/account/orders/[id]`. **Grid placement targeted the wrong element.** `[data-fs-order-details-content]` gave full width to its blocks via rules on the cards, which worked while `OrderDetails.tsx` mounted them as direct grid children. Every card now sits inside a `<Section>` wrapper — the real grid item — so `grid-column` on the nested card is inert. Status, budgets and the delivery accordions collapsed to one column, and the header, itself a section now, took a grid cell and overlapped the status card. The placement contract moves to the section wrapper. Attribute selectors (`[class~="section-account-order-status"]`) are required rather than plain classes: this is a CSS module, so a class selector would be hashed and never match the global class emitted by `Section.tsx`, and stylelint here does not support `:global()`. **The delivery section holds two blocks the design treats as independent** — the compact recipient card and the full-width option list. Its wrapper becomes `display: contents` so both are grid items again, without splitting the section (which would be a CMS contract change, and therefore not backportable as a patch). **The default section order never matched the design.** `DEFAULT_SECTION_KEYS.myAccountOrderDetails` was written wholesale in #3354 and never revised; it does not match the render order of the component it replaced. The broken CSS was hiding it. Reordered to mirror `@deprecated OrderDetails.tsx`. **Sections were lazy-loaded behind 823px placeholders.** `RenderSectionsBase` runs every section through `ViewportObserver`; the account pages pass no `isInteractive` and no account section sets `skipLazyLoadingSection`, so all eight order-details sections rendered as placeholders. Since `ViewportObserver` starts with `isVisible = false`, this reached the SSR HTML too — the served markup carried placeholders and real content only appeared after hydration. New `skipLazyLoading` prop, set on every account page (eight call sites, including the Cards page that landed on `dev` while this branch was open). Side effect worth noting: content now ships in the SSR HTML, which should improve LCP and removes a CLS source (each 823px placeholder collapsing to the real card height). **The page crashed before rendering on stores with no CMS content.** Surfaced while testing this fix. `extractOrderStatusLabelsFromSections` returns `undefined` when no section carries order-status labels — exactly the case for default sections, which are created with empty data — and `getServerSideProps` cannot serialize `undefined`. Pre-existing since the migration and independent of the layout work, but it blocks verifying it: the default-sections store is the very shape the layout fix has to be checked against. Note that [#3417](#3417) targeted this class of failure ("missing CMS content") and left this path. **Two grid rules never matched anything.** `[data-fs-buying-policy-alert]` and `[data-fs-pending-policies-alert]` were scoped to `[data-fs-order-details-content]`, but `BuyingPolicyAlert` only renders inside `OrderDetailsHeader`, which in the deprecated component sits *outside* `<main>`. Removed. ## Tests 12 tests, all passing. - `test/server/cms/myAccountDefaultSections.test.ts` — pins the default order and asserts the key set is unchanged (reorder only, nothing added or removed). - `test/components/cms/RenderSections.browser.test.tsx` — immediate render, coverage of store-authored sections, content present in the SSR HTML via `renderToString`, and a regression guard proving lazy loading still works without the flag. Biome, stylelint and SonarQube are clean. ## Assumptions - **`403.tsx` and `404.tsx` also get `skipLazyLoading`.** The binding rule is "no My Account section goes through `ViewportObserver`", so it applies to every page under `/pvt/account`, not only the five content pages. ## Deviations - **The delivery accordions sit right after the compact delivery card**, whereas the deprecated component rendered them after the summary. They are siblings inside one section, so this is unavoidable without splitting `AccountOrderDelivery` into two CMS sections. Deliberately accepted to keep this PR free of CMS contract changes and backportable as a patch. - **`display: contents` is not scoped to the grid breakpoint**, so mobile changes too. Below `>=notebook` the container is a flex column with a gap; today the delivery wrapper is a block box and neither child carries a margin of its own, so the recipient card and the accordions stack flush against each other, unlike every other pair of blocks. Unscoped, they become sibling flex items and pick up the container gap. Scoping the rule would preserve the flush stacking. Discussed [here](#3464 (comment)). ## Not verified here The visual acceptance criteria — column widths, header overlap, the un-clipped status timeline, and the mobile spacing change above — need a layout engine, and the `browser` vitest project is jsdom. They require the store running. Also still open: the header now inherits the grid `gap` on top of its own `padding`, so its vertical spacing should be checked against the design. ## Follow-ups - **Backport as a patch.** The bug affects every store on **v4.4.0+** with `enableFaststoreMyAccount: true` — not 4.5.0+ as the Jira states (#3411 merged three hours *after* the bug was reported; the culprit is #3354). The reported stores are `b2bfaststoredev` and `usb2bstore`; their versions still need to be established. - [SFS-3345](https://vtex-dev.atlassian.net/browse/SFS-3345) — remove the deprecated `OrderDetails.tsx` and the two remaining orphan card rules (status, budgets). Kept out of this PR because deleting an importable surface does not belong in a patch. The SCSS carries a comment block mapping which rules are live for the CMS render, which one is live via `display: contents`, and which serve only the deprecated component. - The layout contract is now coupled by string to the `section-account-order-*` class names, and nothing enforces that coupling — renaming a wrapper class would silently break the grid. Consistent with how `data-fs-*` selectors work across the repo, so left as is rather than adding a bespoke guard here. - `cms/faststore/my-account/README.md` still has an empty "How a merchant enables My Account in their CMS" heading. Its schema counts were stale (14/6 vs 15/7 after the Cards schemas) and are fixed here. - 3 pre-existing test failures on `dev` (`cookieCacheBusting.test.ts`, `graphql.test.ts`) are unrelated to this change — they reproduce on a clean checkout. ## Spec The spec driving this change lives at `specs/order-details-layout-fix.md` and is intentionally **not committed** (`specs` is gitignored in this repo). It is available on request; every decision above is summarised here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) [SFS-3325]: https://vtex-dev.atlassian.net/browse/SFS-3325?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ [SFS-3345]: https://vtex-dev.atlassian.net/browse/SFS-3345?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - My Account pages now display content sections immediately, improving first-load visibility. - Order details use an updated layout and section order for clearer information presentation. - **Bug Fixes** - Improved handling of missing order status labels. - Preserved full-width delivery option presentation within order details. - **Documentation** - Updated My Account content schema documentation and section guidance. - **Tests** - Added coverage for immediate section rendering and order-details section ordering. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 <[email protected]>
[Jira task](https://vtex-dev.atlassian.net/browse/SO-666) ## What Fixes the four defects reported in [SO-666](https://vtex-dev.atlassian.net/browse/SO-666) / ticket [#1449246](https://vtexhelp.zendesk.com/agent/tickets/1449246) (Stanley Black & Decker) in the `application/ld+json` block emitted on the PDP. | # | Defect | Fix | |---|---|---| | 1 | `"mpn":""` / `"gtin":""` for products with no catalog value | Spread conditionally in `p.tsx` — the key is omitted, not emitted empty | | 2 | `"releaseDate":"1774224000000"` (epoch ms) | Normalized to ISO 8601 in the resolver that documents that contract | | 3 | `offers` leaking `priceWithTaxes`, `listPriceWithTaxes`, `quantity`, `priceToken` | Blacklist replaced by an allowlist | | 4 | `"seller":{"@type":"Organization"}` with no name | Falls out of the allowlist | ## Why defect 3 recurred silently The PDP's inline query and `ProductDetailsFragment_product` both select `offers.offers`. GraphQL merges the two selection sets, so `data.product.offers.offers[0]` arrives carrying the union — including UI-only fields the JSON-LD never asked for. The old code used a blacklist: ```ts const { listPrice, ...offerData } = data.product.offers.offers[0] ``` That has to enumerate fields owned by a fragment the JSON-LD does not control, which is exactly how four fields leaked in unnoticed. It is now an allowlist in `packages/core/src/utils/productJsonLd.ts`, so a field added to any fragment cannot reach the JSON-LD. To be precise about the scope of that guarantee: it covers the `application/ld+json` block, not the whole HTML response. The same fields — `priceToken` included — remain in Next's `__NEXT_DATA__` hydration payload, because the PDP needs them client-side (price display, quantity selector, add-to-cart). That is by design and unchanged by this PR; see the out-of-scope note below. ## Verified output Rendered through next-seo with the reported ticket data: ```json {"@context":"https://schema.org","@type":"Product","sku":"1101","gtin":"SC13-0702A-FTKALG","releaseDate":"2026-03-23","brand":{"@type":"Brand","name":"Lista"},"offers":{"priceCurrency":"USD","url":"…","availability":"https://schema.org/InStock","itemCondition":"https://schema.org/NewCondition","price":0.2,"priceValidUntil":"2027-08-24T19:48:25Z","@type":"Offer"},"name":"LISTA XPRESS"} ``` ## Notes for review - **Behavior change**: stores reading `StoreProduct.releaseDate` directly now get ISO 8601 instead of the raw upstream value. This moves the field onto the contract its own schema already documented (`product.graphql:70-72`). - **Behavior change**: an offerless product now omits `offers` entirely rather than emitting an `Offer` carrying only a currency and URL, which is invalid Schema.org. - **Emptiness, not falsiness**: the allowlist filter drops `null`/`undefined`/`""` but keeps `price: 0`, which is a real price. Covered by a test. - **Epoch disambiguation** is by magnitude (`>= 1e11` → milliseconds), not digit count. A digit-count heuristic leaves a larger hole: 9-digit seconds and 12-digit milliseconds both fall through to the string parser, which reads them as a year. - **No backport.** `priceToken` is selected only on `dev`/`main` — `0.x` through `3.x` have zero occurrences, so it never reaches their JSON-LD. Those majors do still carry defects 1–3 and would need per-branch verification, since their fragment field sets differ. ## Out of scope, investigated - **`priceToken` in `__NEXT_DATA__`.** Removing it from the JSON-LD does not remove it from the page. It is still in the hydration payload of the same HTML response, and always was — the buy button reads it client-side. Decoded on a live PDP it carries `accountName`, `id`, `price`, `salesChannel` and `seller`, with a 1800s validity window. Pre-existing and out of scope here, but worth stating explicitly so "the token leak is fixed" is not read more broadly than it should be. Whether a 30-minute token behind statically generated, cached pages is worth acting on has not been assessed. - **`gtin` populated with a non-GTIN value.** The payload's `SC13-0702A-FTKALG` is a manufacturer reference: `product.ts:253` falls back to `referenceId[0]?.Value` when there is no EAN, and Google rejects the field for values that aren't 8/12/13/14 digits. Not covered by this PR — the fallback predates it and may exist for a compatibility reason worth understanding first. - **`"` in `name`/`description`.** Two causes, neither the JSON-LD builder: `description` goes through `sanitize-html` in `enhanceSku.ts:10`, which escapes for an HTML context the value never reaches; `name` is unsanitized, so its entity comes from the catalog record. ## Testing - `packages/api`: 263 unit tests passing, 13 new for the normalizer (epoch ms/s, both sides of the `1e11` threshold, ISO, ISO with an offset crossing midnight, empty, garbage, null/undefined). - `packages/core`: 19 new tests — 15 on the allowlist mapper, 4 pinning the next-seo behavior the fix depends on so an upgrade can't silently reintroduce the defects. Still to do before undrafting: render the reported SKU in a starter store via `ci/codesandbox` and validate against the Google Rich Results Test. 🤖 Generated with [Claude Code](https://claude.com/claude-code) [SO-666]: https://vtex-dev.atlassian.net/browse/SO-666?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Product release dates are now consistently formatted as UTC dates across supported input formats. * Invalid or missing release dates no longer produce misleading values such as “Invalid Date.” * Product structured data now omits unavailable optional fields instead of emitting empty values. * Offer data is filtered to include only valid Schema.org properties while preserving legitimate zero prices. * **Tests** * Expanded coverage for release-date formatting, structured product data, and offer serialization. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 <[email protected]>
Copying test/ and plugin __tests__ made Next type-check vitest files stores do not install. Skip those paths and drop test globs from the copied tsconfig so yarn build does not need a store-side patch.
SonarQube failed Coverage on New Code at 36% because copyCoreFiles and the plugin filter were untested. Exercise those paths and remaining storefrontCopy branches.
Keep both copyCoreFiles storefront-filter tests and the relativeNextBin tests from dev.
## What's the purpose of this pull request? `experimental.enableRedirects` is a silent no-op for any store that has a `src/redirects.json` file. Redirect rules created in the Admin never apply — the store returns 404 instead. Reported via [SO-672](https://vtex-dev.atlassian.net/browse/SO-672) (ticket #1450148, Whirlpool), reproduced on `consulqa`. ## Root cause The CLI copies the whole store `src/` into `.faststore/src/customizations/src/`. Stores following the [documented file-based redirects workflow](https://developers.vtex.com/docs/guides/faststore/routing-managing-urls-with-redirects-and-rewrite-paths) keep a `src/redirects.json`, so the generated tree ends up with both: ``` src/customizations/src/redirects/ <- core's stub, exports `matcher` src/customizations/src/redirects.json <- copied from the store ``` The import in `getRedirect` used the bare directory specifier: ```ts import { matcher } from 'src/customizations/src/redirects' ``` Webpack resolves a request as a **file** before trying it as a **directory**, and `.json` is in the default extension list, so `redirects.json` wins. `matcher` becomes the JSON's contents (an array) instead of a function, and `getRedirect` throws on its first statement inside the `try`: ``` TypeError: (0 , src_customizations_src_redirects__WEBPACK_IMPORTED_MODULE_0__.matcher) is not a function at getRedirect (webpack-internal:///./src/sdk/redirects/index.ts) at getStaticProps (webpack-internal:///./src/pages/[...slug].tsx) ``` The `catch` swallows it and returns `null`, so `getStaticProps` falls through to `notFound: true`. **The rewriter lookup is never reached**, which is why a perfectly valid Admin rule has no effect. ### Why no build ever caught it TypeScript resolves the same specifier differently. With the generated project's `tsconfig` (`moduleResolution: "node"`, `resolveJsonModule: true`, `baseUrl: "./"`), `tsc` does *not* try `.json` at that position: ``` File 'src/redirects.ts' does not exist. File 'src/redirects.tsx' does not exist. File 'src/redirects.d.ts' does not exist. File 'src/redirects/package.json' does not exist. File 'src/redirects/index.ts' exists - use it as a name resolution result. ``` So type checking sees a valid `matcher` function while the bundler ships an array. The code reads as correct and the failure only surfaces at runtime. ## How it works - Import the directory index explicitly (`.../redirects/index`). Once the specifier contains the `/index` segment, no `redirects.*` file can shadow it, so stores can keep `src/redirects.json` exactly where the docs put it. - Guard the call with `typeof matcher === 'function'` so a store shipping a malformed override degrades to the rewriter lookup instead of throwing and silently returning `null`. Store overrides are unaffected: `copyCoreFiles` runs before `copyUserStarterToCustomizations`, so a store-provided `src/redirects/index.ts` still replaces the stub. ### Deliberately not included Logging on the `!response.ok` branch. `redirect-evaluate` returns **404 for any path without a rule**, so that branch is the normal case on every genuine 404 and logging it would flood the logs. ## How to test it? `packages/core/test/sdk/redirects/index.test.ts` covers the fallback, the custom-matcher path, permanent vs temporary, asset-path skipping, and the no-rule case. ```bash cd packages/core && pnpm vitest run test/sdk/redirects ``` The regression test fails without the fix and passes with it: ``` × falls back to the rewriter when the matcher export is not a function Tests 1 failed | 4 passed (5) ``` Note the unit test covers the `typeof` guard; the resolution change itself is bundler behavior and isn't unit-testable. End-to-end verification needs a store with a `src/redirects.json`, `enableRedirects: true`, and an Admin rule on a path that has never been requested. ## Related - Backported to `3.x` in #3468. The affected Whirlpool accounts are on 3.100.2, so the v3 PR is the one that resolves the ticket. [SO-672]: https://vtex-dev.atlassian.net/browse/SO-672?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved redirect handling when custom matchers are unavailable or invalid, preventing errors and allowing fallback redirects to work as expected. - Preserved correct behavior for asset paths, permanent and temporary redirects, and requests without matching rules. - **Tests** - Added coverage for redirect matching, fallback behavior, asset bypasses, rewrite types, and cases with no applicable redirect rules. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor <[email protected]>
## Summary
`StoreProduct.otherLocales` feeds both the PDP `hreflang` alternates and
the
`LocalizationSelector` targets. Serving two consumers from one field
forced a
single slug-resolution rule onto two problems with opposite tolerances,
and both
ended up wrong:
1. **Wrong slug for the default locale.** It used the Intelligent Search
`linkText` as the default locale's slug, but IS localizes `linkText` to
the
locale being **browsed**. While browsing a non-default locale, the
default-locale alternate pointed at the browsed locale's slug under the
default locale's prefix, which 404s.
2. **Non-reciprocal clusters.** A fallback to `linkText` for the locale
being
browsed made the advertised set depend on which locale served the
request, so
locale variants of the same product advertised disjoint sets. Google
discards
annotations that are not reciprocal.
Both defects come from using `linkText` as a stand-in for a registered
slug.
This PR makes `otherLocales` strict — every slug from
`availableLinkIds`, no
fallback — and adds `StoreProduct.defaultLocaleSlug` for the navigation
case,
which is free to guess precisely because it never reaches an annotation.
| | `otherLocales` | `defaultLocaleSlug` |
| --- | --- | --- |
| Consumer | hreflang + selector | selector only |
| Source | `availableLinkIds` only | `availableLinkIds[default]` then
`linkText` |
| Locale with no registered slug | omitted | best-effort guess |
| Cost of a wrong value | search engines discard the whole cluster | one
404 the shopper can recover from |
## Agreed behavior
Confirmed with product. Store defaulting to `en-US`, with a t-shirt
translated
to pt-BR and not sold in fr-FR:
| Locale | URL | Result |
| --- | --- | --- |
| en-US | `/en-us/tshirt/p` | 200, canonical `/en-us/tshirt/p` |
| pt-BR, slug registered | `/pt-br/camisa/p` | 200, canonical
`/pt-br/camisa/p` |
| pt-BR, no slug registered | `/pt-br/tshirt/p` | 200, canonical
`/pt-br/tshirt/p`, even when the content renders in English |
| fr-FR, product not sold | `/fr-fr/tshirt/p` or `/fr-fr/camisa/p` | 404
|
Untranslated content under a localized URL is a merchant setup problem,
not
something the framework detects or routes around. That is what makes
`defaultLocaleSlug` safe to guess: the destination is either a valid
page or an
honest 404.
Mapping to this PR: a registered slug is served by `otherLocales`; no
registered
slug with the product available is served by `defaultLocaleSlug`; an
unavailable
product is also served by `defaultLocaleSlug`, and its 404 is the
intended
outcome.
## Evidence (live, account `pm2023team2`)
Rendered output for product 880009 / SKU 12 with the pre-fix resolver,
both
alternates returning **404**:
```
page pt-BR -> hrefLang="en-US" href=".../en-us/refrigerador-portas-duplas-12/p" -> 404
page fr-FR -> hrefLang="en-US" href=".../en-us/refrigerateur-multi-portes-12/p" -> 404
page pt-BR -> hrefLang="x-default" href=".../refrigerador-portas-duplas-12/p"
```
The same `hrefLang="en-US"` resolved to three different URLs depending
on the
serving locale, and `x-default` inherited the translated slug. After the
fix all
three locales emit the same set and `en-US` points at
`french-door-refrigerator-1-12` (200). The same broken output is still
observable in production on a store running the released version.
For the reciprocity defect, product 880011 (empty `availableLinkIds`)
advertised
disjoint sets:
```
before -> /en-us page: en-US (self) + x-default | /pt-br page: pt-BR (self) only
after -> both pages: no alternates
```
## Why `availableLinkIds` is the right source
The Catalog Dataplane returns `availableLinkIds` **identically for every
`Accept-Language`**, while `linkId` and `linkText` are locale-specific.
Deriving
the whole set from a locale-independent source is what makes the cluster
reciprocal by construction:
| Account / product | Accept-Language | linkId |
availableLinkIds["en-US"] |
| --- | --- | --- | --- |
| pm2023team2 / 880009 | en-US | french-door-refrigerator-1 |
french-door-refrigerator-1 |
| pm2023team2 / 880009 | pt-BR | refrigerador-portas-duplas |
french-door-refrigerator-1 |
| pm2023team2 / 880009 | fr-FR | refrigerateur-multi-portes |
french-door-refrigerator-1 |
| brandless / 41 | it-IT | scarpe-roshe | roshe-tenis |
| brandless / 41 | pt-BR | tenis-roshe | roshe-tenis |
| brandless / 41 | en-US | roshe-tenis | roshe-tenis |
No extra per-locale request is needed to obtain a trustworthy
default-locale slug.
## Untranslated products
Products with no registered translations return `availableLinkIds: {}`
and now
advertise **no alternates at all, from any locale**. A self-only
`hreflang` tag
conveys nothing, so nothing is lost, and the set stays consistent across
locales.
Filling every configured locale with the untranslated slug was
considered and
rejected. Those URLs do resolve (verified:
`/pt-br/side-by-side-refrigerator-14/p`
and `/fr-fr/side-by-side-refrigerator-14/p` both return 200), but
advertising a
locale to a search engine is a claim about the catalog, and
`availableLinkIds`
cannot substantiate it: the field describes **slug** registrations, not
whether
the product is sold or translated in that locale. In VTEX slug and
content
translation are independent — a product can carry a translated name and
description with no `linkId` registered, and the reverse also occurs.
Navigation needs no such guarantee, which is what the new field is for.
## `StoreProduct.defaultLocaleSlug`
Additive nullable field, populated only when localization is enabled.
With `otherLocales` strict, the selector has nothing to navigate to for
an
omitted locale and drops the shopper on the locale root — a regression
against
the previous behavior, which kept them on the product page, and against
the
agreed behavior above.
Resolution order is `availableLinkIds[defaultLocale]`, falling back to
`linkText`. The fallback is sound in the case that matters: a product
with no
registrations carries the same slug in every locale, so `linkText` *is*
the
default-locale slug. A product translated for the browsed locale but not
for the
default one still yields a wrong guess and a 404 — pre-existing
behavior,
unchanged.
It reuses the request-scoped Dataplane entry `otherLocales` already
loads, so
serving both fields costs a single call.
Wired through core: PDP query, `LocalizedProductProvider`,
`useLocalizedProduct`,
`useBindingSelector`. The selector's fallback chain moved outside the
`otherLocales?.length` guard so it also applies to untranslated
products, which
is exactly the case where the set is empty.
## Observability (separate concern, same file)
`getLocalizedProductEntry` swallowed every Catalog Dataplane failure. A
timeout
or 5xx silently downgrades the PDP breadcrumb to the IS category names,
which are
always in the account's default language — and with the PDP's default
`revalidate: false`, a transient failure during page generation freezes
an
untranslated breadcrumb on that URL until a deploy or purge, with
nothing
recorded to diagnose it afterwards.
This was investigated as the cause of a reported case of untranslated
breadcrumbs and **not** confirmed: direct Dataplane probes returned the
translated categories correctly. The logging stands on its own merit,
since the
failure mode is invisible either way. Warns with `productId` and locale,
matching
what `collection.ts` already does for the same class of failure. No
behavior
change.
A stale comment in `assertSkuMatchesSlug` claiming that `linkText` is
always in
the default locale is corrected in the same pass. It is the same
misconception
that produced the 404 alternates; the surrounding logic was already
validating
against the Dataplane rather than trusting `linkText`.
## Out of scope
Live inspection of a localized storefront surfaced a separate and larger
canonical defect: `getStoreURL()` resolves the binding from
`window.location`, so
during static generation it returns the **default** locale's binding,
and every
localized page emits a canonical pointing at the default locale. It
affects PDP
and PLP, contradicts the very `hreflang` tags this PR fixes, and lives
in
`@faststore/core` rather than the BFF. The agreed behavior table above
is its
specification. Tracked separately and deliberately not bundled here.
Also left open: whether a locale that serves the product under the
default slug
should appear in `hreflang` at all. It does not today, which leaves such
a page
self-canonical but outside any cluster. Answering it needs a per-locale
availability signal, not `availableLinkIds`.
## Test plan
- `pnpm test:unit` in `packages/api` — 259 passing
- `otherLocales` cases: default locale resolved from `availableLinkIds`
while
browsing another locale; default locale omitted when absent from the
map;
browsed locale omitted when it has no registered slug; no alternates
when the
map is empty; same alternates whichever locale serves the product
(reciprocity
regression)
- `defaultLocaleSlug` cases: null when localization is disabled;
resolved from
`availableLinkIds`; falls back to `linkText` when the map is empty;
null-safe
on a Dataplane failure; shares the cached entry with `otherLocales`
- `pnpm test` in `packages/core` — 710 passing
- Locale-switch redirect, previously untested end to end: the slug
registered
for the target locale; the fallback through `defaultLocaleSlug` when the
target has none; a product with no registered translations at all; the
binding
root when nothing is available; the error path when no binding matches
the
currency. Two cases pin behavior nothing enforced before — a slug
registered
for a third locale is never carried to the target, and the query string
and
hash survive the switch
- The locale button forwarding all three arguments to the selector on a
product
page, a collection page, and outside a provider — a dropped argument
there
sends shoppers to the locale root with every other test still green
- Coverage on the touched core files: `useBindingSelector` 21% → 86%,
`LocalizationButton` 6% → 77%, `LocalizedProductContext` and
`bindingSelector` at 100%
- `tsc --noEmit` in `packages/core` — no errors under `src/`, none in
the added
test files
- Biome clean on changed files
- Live before/after on `pm2023team2`, rendering the pre-fix resolver and
confirming the 404 alternates, then the corrected output across three
locales
- Reviewer check: on a translated product, switch locales in the
selector and
confirm the PDP resolves; on a product without a registered slug for the
target locale, confirm the selector lands on the product page instead of
the
locale root
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added support for resolving and exposing a product’s default-locale
slug.
* Localization controls and product pages now use the default-locale
slug when localized slugs are unavailable.
* Product links can redirect to the best available localized or default
URL.
* **Bug Fixes**
* Prevented unavailable locale links from being advertised.
* Improved handling of untranslated products and catalog lookup
failures.
* Clarified localized slug validation behavior when locale-specific
slugs differ.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Leandro Rodrigues <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: ⛔ Files ignored due to path filters (9)
📒 Files selected for processing (102)
WalkthroughFastStore 4.7.0-dev.9 adds My Account Cards, VTEX saved-card APIs, locale-aware product navigation, recommendation session configuration, JSON-LD normalization, CLI storefront filtering, and account rendering updates. Tests and changelogs cover the changes. ChangesFastStore platform changes
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant AccountPage
participant GraphQL
participant VTEXCommerce
participant MyAccountListCards
AccountPage->>GraphQL: request listCreditCards and hasAdHocCardAccess
GraphQL->>VTEXCommerce: fetch saved cards and permission
VTEXCommerce-->>GraphQL: return cards and access result
GraphQL-->>AccountPage: return account card data
AccountPage->>MyAccountListCards: render personal/shared cards
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. |
|

0 New Issues
0 Fixed Issues
0 Accepted Issues
No data about coverage (36.90% Estimated after merge)
What's the purpose of this pull request?
Graduation of the
devprerelease cycle (4.7.0-dev.9) into a stable4.7.0release onmain. Merging this PR triggers thereleaseCD workflow, which runslerna version --conventional-graduate --force-conventional-graduateand publishes all 8@faststore/*packages under thelatestdist-tag.The bump is decided by the Conventional Commits accumulated on
dev(feat:→ minor4.7.0). No unmerged hotfixes onmain.How it works?
No new product code in this PR itself — it is the merge of
devintomain. After merge, CD graduates4.7.0-dev.9→4.7.0.Highlights (features)
Fixes
@faststore/core(fix: resolve the next binary from @faststore/core #3454)Packages published (latest)
@faststore/{api,cli,components,core,diagnostics,lighthouse,sdk,ui}→4.7.0How to test it?
releaseworkflow succeeds onmain4.7.0under thelatestdist-tag on npmmain→devto open the next dev cycleChecklist
PR Title and Commit Messages
PR Description
Dependencies
Made with Cursor
Summary by CodeRabbit