Repository navigation
fix: restore raw StoreProduct.releaseDate, normalize only in PDP JSON-LD - #3508
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: vtex/faststore/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. WalkthroughThe VTEX API now passes through Intelligent Search release dates. The product page normalizes release dates to UTC calendar dates and maps product identifiers before passing them to ProductJsonLd. ChangesProduct release date flow
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Merge Risk: 🔵 Low · up to The PDP continues to emit normalized JSON-LD dates, but the public GraphQL field again exposes raw catalog values. Stores relying on the ISO output introduced in 4.7 may need to adjust; merge is reasonable with the stated upgrade notice. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 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. |
| // Stores read this field directly, so its format is a public contract. The | ||
| // JSON-LD normalization lives in `@faststore/core` and must not leak here. | ||
| it('passes epoch milliseconds through unchanged', () => { | ||
| expect(resolve('1774224000000')).toBe('1774224000000') |
There was a problem hiding this comment.
[Functional.LargerDefect] 🟡 RESTRICT
The StoreProduct.releaseDate resolver's tests change from asserting normalization of epoch/ISO input into an ISO calendar date to asserting a raw passthrough. The adjacent comment explicitly states this field 'is a public contract' read directly by stores, so GraphQL consumers will now receive raw values (e.g. '1774224000000' or a full ISO datetime) instead of a normalized calendar date ('2026-03-23'). No migration guide, deprecation notice, or BREAKING CHANGE marker is visible for this contract change.
Action: Confirm whether releaseDate is an already-shipped/stable GraphQL field. If so, add a deprecation/migration note and a BREAKING CHANGE marker per AGENTS.md, or keep normalizing in the resolver and only reuse the new util internally so the public contract doesn't change.
To dismiss: reply /dk-review dismiss [reason] under this comment
There was a problem hiding this comment.
/dk-review dismiss This PR restores the pre-4.7.0 contract and does not introduce a new one. releaseDate has returned the raw Intelligent Search value (epoch ms) since #1438. #3465 switched it to ISO without a BREAKING CHANGE marker, and that broke store customizations, which is the regression fixed here. Adding BREAKING CHANGE would make Lerna cut a major for a regression fix and would rule out backporting it as a patch to 4.7.x/4.8.x. Keeping the normalization in the resolver is the reported bug. The behavior change is described under "Notes for review" in the PR description and will be called out in the changelog.
DK Review — Audit SummaryVerdict: ✅ CLEAN
Only BLOCK and RESTRICT findings anchored to a changed line are commented inline on the diff. The 3 findings below open no review thread. Scenarios evaluated: feature-flags, general-review, quality-ratchet 📋 Findings (3)SUGGEST
DK Review v1.0.0 | To dismiss a finding: reply |
@faststore/api
@faststore/cli
@faststore/components
@faststore/core
@faststore/diagnostics
@faststore/lighthouse
@faststore/sdk
@faststore/ui
commit: |
| ['an unparseable value', 'not-a-date'], | ||
| ])('passes %s through unchanged', (_label, input) => { | ||
| expect(resolve(input)).toBe(input) | ||
| }) |
There was a problem hiding this comment.
[Functional.Interface] 🔴 BLOCK
The StoreProduct.releaseDate resolver's output contract changed from a guaranteed ISO calendar date or empty string to a raw pass-through of unvalidated platform data (including empty strings, whitespace, and unparseable garbage such as 'not-a-date'). The PR's own comment states 'Stores read this field directly, so its format is a public contract,' yet this is a breaking change to that contract with no deprecation warning or migration guide, and any GraphQL consumer that doesn't independently re-normalize via the new core utility will now receive inconsistent or malformed date strings where it previously received a safe, normalized value.
Action: Either keep minimal validation/normalization in the resolver so the public GraphQL field remains a stable contract, or, if the contract is intentionally being relaxed, document the breaking change with a deprecation notice and migration guide per AGENTS.md section VI and communicate it to downstream store consumers.
To dismiss: reply /dk-review dismiss [reason] under this comment
There was a problem hiding this comment.
/dk-review dismiss Same finding as the earlier RESTRICT on this field, which was dismissed. Passing malformed values through is the pre-4.7.0 contract, not something this PR adds. Before #3465 the resolver was exactly releaseDate ?? '', so empty, whitespace and unparseable values already reached consumers unchanged. The new tests pin that restored behavior so it can't drift silently again. Normalizing in the resolver is the regression reported by Search & Recommendation, and a BREAKING CHANGE marker would force a major for a regression fix that has to ship as a patch on 4.7.x/4.8.x.
|
|
||
| it('converts epoch milliseconds to an ISO calendar date', () => { | ||
| expect(resolve('1774224000000')).toBe('2026-03-23') | ||
| }) |
There was a problem hiding this comment.
[Evolvability.Organizational] 🟡 RESTRICT
The VTEX-specific epoch-vs-seconds threshold heuristic and raw date-format parsing (previously exercised in the platform-specific resolver test) has been relocated into @faststore/core's platform-agnostic JSON-LD utility (toProductJsonLdReleaseDate). Per AGENTS.md, @faststore/api is meant to 'handle platform-specific integrations' while @faststore/core orchestrates packages generically; housing VTEX's raw epoch-encoding quirks in core couples the integration layer to one platform's data format, so every future platform integration must re-teach core about its own raw date encoding instead of normalizing at the platform boundary.
Action: Consider keeping platform-specific raw-value normalization (epoch threshold detection, etc.) in the @faststore/api VTEX platform layer, and have @faststore/core's JSON-LD utility only operate on an already-normalized, platform-agnostic date value.
To dismiss: reply /dk-review dismiss [reason] under this comment
There was a problem hiding this comment.
Agreed that core is the wrong long-term home for epoch detection, but it's out of scope for this PR. The clean fix is to normalize at the platform boundary and expose that value through the schema, e.g. a releaseDate(format: ISO) argument or a separate field. Either way it adds to the public GraphQL surface, which doesn't belong in a fix that will be backported as a patch. For now core reads the format the schema description documents ("usually epoch milliseconds, some accounts store an ISO 8601 string"), and epoch ms isn't a VTEX-specific encoding. I'm tracking the move to the API layer as a follow-up.
hellofanny
left a comment
There was a problem hiding this comment.
What's good: This is a solid regression fix with proper test coverage (25 API + 37 core tests, all passing). The move of normalization from the resolver to JSON-LD builder correctly isolates the ISO formatting to where it's actually needed.
Context for the DK Review findings: The [Functional.Interface] BLOCK is technically correct—this does change the contract from 4.7.0–4.8.x. However, it's reframing the actual issue: #3465 introduced ISO without a BREAKING CHANGE marker and broke stores parsing epoch ms. This PR restores the pre-4.7.0 contract (the original contract since #1438). The dismissal is reasonable: adding BREAKING CHANGE would force a major version, which blocks backporting as a patch to 4.7.x/4.8.x where the regression exists.
Two details to confirm before merge:
Changelog entry: The PR description mentions the format change will be in the changelog. ✅ Confirm this is queued so upgraders from 4.7/4.8 see it.
Architecture note (non-blocking): The epoch-vs-seconds threshold logic now lives in @faststore/core, coupling it to VTEX's date encoding. Consider a follow-up to move VTEX-specific normalization back to the resolver boundary—this keeps core truly platform-agnostic. (This can be a separate refinement; the current design works.)
The regression fix is sound and ready.
|
@hellofanny thanks for the review!
|
#3465 normalized `StoreProduct.releaseDate` to ISO 8601 in the API resolver so the PDP JSON-LD would be Schema.org compliant. That changed the field's format for every consumer, breaking store customizations that read the epoch-milliseconds value Intelligent Search has always returned (reported on FS 4.8.0, shipped in 4.7.0). The resolver now passes the value through again, as it did before 4.7.0. The normalizer moves to `@faststore/core` (`toProductJsonLdReleaseDate` in `src/utils/productJsonLd.ts`) and is applied only where the PDP builds `ProductJsonLd`, so the structured data still publishes `YYYY-MM-DD`. The schema description no longer claims ISO 8601, which the upstream value does not guarantee; generated types were regenerated via codegen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
5112345 to
637ef22
Compare
| {...(product.gtin && { gtin: product.gtin })} | ||
| {...(product.mpn && { mpn: product.mpn })} | ||
| {...(product.releaseDate && { releaseDate: product.releaseDate })} | ||
| {...(releaseDate && { releaseDate })} |
There was a problem hiding this comment.
productJsonLd.test.ts covers toProductJsonLdReleaseDate, and productJsonLdRendering.test.tsx only checks that next-seo omits an absent prop (mpn). Nothing renders this page with an epoch and reads the script.
This line is the whole SEO fix. Putting product.releaseDate back here leaves the suite green and publishes "1774224000000" in the application/ld+json again. Add a rendering assertion that product.releaseDate = "1774224000000" shows up as "2026-03-23".
There was a problem hiding this comment.
Good catch, fixed in a858737.
The identifier props (gtin, mpn, releaseDate) now come from toProductJsonLdIdentifiers in src/utils/productJsonLd.ts, and this line spreads {...toProductJsonLdIdentifiers(product)}. productJsonLdRendering.test.tsx renders ProductJsonLd from that helper with releaseDate: "1774224000000" and asserts the script publishes "2026-03-23" with no empty gtin/mpn. I checked that it catches the regression: if the helper passes releaseDate through raw, that test fails.
I didn't render the whole page. p.tsx pulls in ~40 imports (CMS sections, session, router, getStaticProps), and a page-level test would mostly exercise mocks. The trade-off is that going back to the bug now means removing the helper call here, which a review would see, but no test enforces it. If you think page-level coverage is worth that cost, I can add it in a follow-up.
`p.tsx` normalized `releaseDate` inline, so reverting that line to `product.releaseDate` would publish the raw epoch again while every test stayed green: the normalizer was covered, the page's use of it was not. The JSON-LD identifier props (`gtin`, `mpn`, `releaseDate`) now come from `toProductJsonLdIdentifiers` in `src/utils/productJsonLd.ts`, which `p.tsx` spreads into `ProductJsonLd`. A rendering test feeds it an epoch through next-seo and asserts the published script carries `"2026-03-23"`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| // Stores read this field directly, so its format is a public contract. The | ||
| // JSON-LD normalization lives in `@faststore/core` and must not leak here. | ||
| it('passes epoch milliseconds through unchanged', () => { | ||
| expect(resolve('1774224000000')).toBe('1774224000000') |
There was a problem hiding this comment.
[Functional.LargerDefect] 🔴 BLOCK
The StoreProduct.releaseDate resolver's behavior silently changed from normalizing epoch/ISO inputs to a canonical ISO calendar date, to passing the raw value through unchanged. This is a breaking change to a documented public GraphQL field contract ('Stores read this field directly, so its format is a public contract') with no deprecation notice or migration guide, risking regressions for any consumer other than @faststore/core that relied on the previous normalized output.
Action: Document this as a breaking change (changelog/migration guide, possibly a major version bump per Conventional Commits), or keep normalizing at the API layer and have @faststore/core consume the already-normalized value instead of re-deriving it.
Source: AGENTS.md Architectural Principles VI: 'Breaking changes MUST include migration guides and deprecation warnings.'
To dismiss: reply /dk-review dismiss [reason] under this comment
There was a problem hiding this comment.
/dk-review dismiss Same finding dismissed twice already on this PR (discussion_r4160216521, discussion_r4160475956). The breaking change was #3465 in 4.7.0. This PR restores the raw-passthrough behavior the field has had since #1438. A BREAKING CHANGE marker would make Lerna cut a major for a regression fix, and normalizing in the resolver is the bug that was reported. In 5b3ad56 I reworded the test comment to say this explicitly.
| ['an unparseable value', 'not-a-date'], | ||
| ])('passes %s through unchanged', (_label, input) => { | ||
| expect(resolve(input)).toBe(input) | ||
| }) |
There was a problem hiding this comment.
[Functional.Check] 🟡 RESTRICT
The resolver now passes malformed releaseDate values (empty string, whitespace, unparseable text like 'not-a-date') straight through to the GraphQL response instead of sanitizing them, removing the validation that previously guaranteed callers never saw 'Invalid Date' or garbage strings. Any API consumer that doesn't go through @faststore/core's new toProductJsonLdReleaseDate/toProductJsonLdIdentifiers will now receive unvalidated raw data.
Action: If validation is intentionally being pushed to consumers, state this explicitly in the GraphQL schema field description so external integrators are aware, or add a lightweight sanity check at the resolver boundary for obviously-invalid values.
To dismiss: reply /dk-review dismiss [reason] under this comment
There was a problem hiding this comment.
Took the first option in 5b3ad56. The schema description now says the value is passed through exactly as the catalog returns it, without validation or normalization, that it may be empty, and that consumers should parse and validate it before use (generated types regenerated). I didn't add a sanity check at the resolver. Rewriting values there, even obviously invalid ones, is the kind of change that broke stores in 4.7.0, and before #3465 this field never filtered anything.
The schema description now says the value is passed through exactly as the catalog returns it, may be empty, and must be parsed and validated by the consumer. Generated types were regenerated via codegen. The resolver test comment now frames the passthrough as the field's original behavior that 4.7.0 briefly changed, and the ISO case is split into a plain date and a date-time so each test title matches its input. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
## Summary - Traz para `dev` os commits de `main` que ficaram de fora depois da `v4.9.0`: o fix de `releaseDate` (#3508), a `v4.9.1`, o fix de session/cart (#3511) e a `v4.9.2`. - O único commit que existia só em `dev` era o release `4.9.1-dev.0` (bump de versão). Ele conflita com a `4.9.2` e foi resolvido ficando na versão da `main`. A árvore desta branch é idêntica à `origin/main`. - Mergear este PR em `dev` (merge commit, sem squash) deixa `dev` atualizada com `main`. ## Test plan - [ ] Conferir que o diff contra `dev` é só o que entrou na `main` desde a `v4.9.0` (releaseDate, session/cart e bumps `4.9.1` / `4.9.2`) - [ ] Mergear com **Create a merge commit**, sem squash, para `dev` passar a conter os commits da `main` - [ ] CI verde - [ ] Depois do merge, o workflow `release:dev` publica o próximo prerelease a partir da `v4.9.2` Made with [Cursor](https://cursor.com) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Product release dates now retain their original values in product data, while dates in product structured data are normalized to ISO format. * Session updates for cart validation and region changes no longer include UI-only status flags, helping prevent those flags from being stored or sent as session data. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: vtexgithubbot <[email protected]> Co-authored-by: Cursor <[email protected]>

0 New Issues
0 Fixed Issues
0 Accepted Issues
What
Puts
StoreProduct.releaseDateback to the raw value Intelligent Search returns. The ISO 8601 normalization added in #3465 now runs only where the PDP builds itsapplication/ld+json.StoreProduct.releaseDate(GraphQL)"2026-03-23""1774224000000", as returned upstream (same as before 4.7.0)releaseDate"2026-03-23""2026-03-23", unchangedWhy
#3465 (SO-666) needed an ISO date in the structured data, but it did the normalization in the API resolver. That changed the field's format for everyone who reads it, and store customizations that parse the epoch-ms value broke. Search & Recommendation reported this as a bug against FS 4.8.0, related feature ELOR-5408. The change first shipped in 4.7.0.
The JSON-LD is the only consumer that needs ISO, and it is built in
@faststore/core, so the conversion now lives there.Changes
@faststore/api: the resolver returnsreleaseDate ?? ''again, andutils/releaseDate.tsis removed. The schema description no longer says ISO 8601, because upstream doesn't guarantee that format. The type staysString!.@faststore/core: the normalizer moves tosrc/utils/productJsonLd.tsastoProductJsonLdReleaseDate, next totoProductJsonLdOffer.p.tsxapplies it only toProductJsonLd. Its behavior is unchanged: epoch ms or seconds and ISO strings become a UTC calendar day, and empty or unparseable input gives''.__generated__/schema.tsand@generated/graphql.tswere regenerated with codegen. Only the description text changed.Notes for review
main: this targetsmaindirectly, following the precedent of fix(core): prevent IS redirect hang and improve scroll restoration #3437 (4.5.1), so it ships as 4.9.1 without waiting for the nextdev → maingraduation. It should be back-merged intodevafterwards. There are no 4.7.x/4.8.x maintenance branches, so stores on 4.7 or 4.8 get the fix by bumping to 4.9.1.Testing
packages/api: the resolver tests pass (25). The newreleaseDatetests check that epoch ms and ISO values come through unchanged and that null or undefined give''.packages/core:productJsonLd.test.tsandproductJsonLdRendering.test.tsxpass (37). This includes the 13 normalizer cases that moved over from the API.tsc --noEmitreports no errors insrcfor either package, and Biome is clean.ci/codesandbox. Check that a customization readingreleaseDategets epoch ms and that the JSON-LD still passes the Google Rich Results Test.🤖 Generated with Claude Code
Summary by CodeRabbit