Skip to content

fix: apply same hotfix as #3245 for After pagination field#3248

Merged
lemagnetic merged 2 commits intocanary-v2from
chore/faststore4-schema-update
Mar 27, 2026
Merged

fix: apply same hotfix as #3245 for After pagination field#3248
lemagnetic merged 2 commits intocanary-v2from
chore/faststore4-schema-update

Conversation

@lemagnetic
Copy link
Copy Markdown
Contributor

@lemagnetic lemagnetic commented Mar 27, 2026

What's the purpose of this pull request?

This applies the same hotfix as PR #3245: align the after pagination cursor with string type (and related CMS schema updates) so hCMS → Content Platform migrations do not hit type mismatches.

References

Summary by CodeRabbit

  • Bug Fixes

    • Normalized pagination handling for ProductShelf and ProductTiles so "after" cursors are processed consistently across the storefront.
  • Chores

    • Updated CMS configuration schemas and added foundational schema definitions to improve content and template handling.

@lemagnetic lemagnetic requested a review from a team as a code owner March 27, 2026 21:20
@lemagnetic lemagnetic requested review from hellofanny and lariciamota and removed request for a team March 27, 2026 21:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 27, 2026

Walkthrough

This PR updates FastStore CMS JSON schemas: converts pagination cursor after from integer→string across ProductShelf and ProductTiles, changes defaults from 0"0", updates base.jsonc $id to vtex.faststore4 and reorders components/content-types, and adds new $defs in schema.json.

Changes

Cohort / File(s) Summary
Base Schema Configuration
packages/core/cms/faststore/base.jsonc
Changed JSON Schema $id from the full Schema Registry URL to vtex.faststore4; moved components to after content-types (value remains {}).
Pagination Type Updates
packages/core/cms/faststore/components/cms_component__productshelf.jsonc, packages/core/cms/faststore/components/cms_component__producttiles.jsonc, packages/core/cms/faststore/sections.json
Changed after property type from integerstring and default from 0"0" for ProductShelf and ProductTiles schemas.
Schema Definitions
packages/core/cms/faststore/schema.json
Added new $defs (base-component, base-page-template) and updated after pagination fields to string with "0" default across relevant definitions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

hotfix

Suggested reviewers

  • hellofanny
  • lariciamota
  • ommeirelles
  • matheusps
  • eduardoformiga

Poem

Numbers slipped into quotes tonight,
Cursors traded integer for string delight,
IDs tidied, defs aligned in place,
FastStore schemas hum with sleeker grace ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and specifically references the main change: applying a hotfix for the after pagination field, with a reference to the related PR #3245.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/faststore4-schema-update

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lemagnetic lemagnetic changed the title fix(cms): apply same hotfix as #3245 for \after pagination field fix: apply same hotfix as #3245 for \after pagination field Mar 27, 2026
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Mar 27, 2026

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/cms/faststore/schema.json`:
- Around line 4308-4315: The "base-page-template" component is defined under
$defs but other page schemas still reference the old location, so update every
$ref that points to "#/components/base-page-template" (or similar) to point to
the new $defs path (e.g. "#/$defs/base-page-template"); ensure the "sections"
property continues to reference "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS" (or the
consistent $defs alias used) and apply this replacement for all content types
that currently extend or $ref the legacy base-page-template so strict $extends
resolvers find the definition.
- Around line 3668-3672: The "after" fields (ProductShelf.after and
ProductTiles.after) are defined as plain strings but are parsed numerically
downstream (maybeAfter via Number(...)), so tighten the JSON Schema to only
accept numeric strings; update both ProductShelf.after and ProductTiles.after to
include a numeric-string guard (e.g., a pattern like "^[0-9]+$" or equivalent)
and keep the existing "default" and description, ensuring invalid non-numeric
values are rejected at validation time rather than becoming NaN in the resolver.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7bcf5d5d-1615-474e-80ab-1d0a87a109d0

📥 Commits

Reviewing files that changed from the base of the PR and between 82f817d and 3fa686b.

📒 Files selected for processing (1)
  • packages/core/cms/faststore/schema.json

Comment on lines 3668 to 3672
"after": {
"type": "integer",
"type": "string",
"title": "After",
"default": 0,
"default": "0",
"description": "Initial pagination item"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Constrain after to numeric strings.

Line 3669 and Line 3785 switch the field to a plain string, but packages/api/src/platforms/vtex/resolvers/query.ts:190-195 still parses maybeAfter with Number(...) and uses it in pagination math. That means values like "foo" now validate here and only fail downstream as NaN.

Suggested schema guard
        "after": {
          "type": "string",
          "title": "After",
          "default": "0",
-         "description": "Initial pagination item"
+         "pattern": "^[0-9]+$",
+         "description": "Initial pagination item encoded as a numeric string"
        },

Apply the same guard to both ProductShelf.after and ProductTiles.after.

Also applies to: 3783-3787

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/cms/faststore/schema.json` around lines 3668 - 3672, The
"after" fields (ProductShelf.after and ProductTiles.after) are defined as plain
strings but are parsed numerically downstream (maybeAfter via Number(...)), so
tighten the JSON Schema to only accept numeric strings; update both
ProductShelf.after and ProductTiles.after to include a numeric-string guard
(e.g., a pattern like "^[0-9]+$" or equivalent) and keep the existing "default"
and description, ensuring invalid non-numeric values are rejected at validation
time rather than becoming NaN in the resolver.

Comment on lines +4308 to +4315
"base-page-template": {
"type": "object",
"properties": {
"sections": {
"$ref": "#/$defs/$ALLOW_ALL_COMPONENTS"
}
}
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Point page templates at the new $defs entry.

This shared schema lives under $defs, but the page types above still extend #/components/base-page-template (for example Line 6 and Line 22). As written, this definition is never used, and any strict $extends resolver will keep treating the target as missing.

Minimal fix
- "$extends": ["#/components/base-page-template"],
+ "$extends": ["#/$defs/base-page-template"],

Apply that change to every content type that currently extends base-page-template.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/cms/faststore/schema.json` around lines 4308 - 4315, The
"base-page-template" component is defined under $defs but other page schemas
still reference the old location, so update every $ref that points to
"#/components/base-page-template" (or similar) to point to the new $defs path
(e.g. "#/$defs/base-page-template"); ensure the "sections" property continues to
reference "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS" (or the consistent $defs alias
used) and apply this replacement for all content types that currently extend or
$ref the legacy base-page-template so strict $extends resolvers find the
definition.

@lemagnetic lemagnetic changed the title fix: apply same hotfix as #3245 for \after pagination field fix: apply same hotfix as #3245 for After pagination field Mar 27, 2026
@lemagnetic lemagnetic merged commit b611c7c into canary-v2 Mar 27, 2026
6 of 7 checks passed
@lemagnetic lemagnetic deleted the chore/faststore4-schema-update branch March 27, 2026 22:18
@coderabbitai coderabbitai Bot mentioned this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants