Visitar URL original
fix(schema): stop listing date as a future reserved type by jonahsnider · Pull Request #15134 · sanity-io/sanity · GitHub
Skip to content

fix(schema): stop listing date as a future reserved type - #15134

Merged
jonahsnider merged 2 commits into
mainfrom
fix/date-type-reserved
Nov 9, 2026
Merged

jonahsnider merged 2 commits into
mainfrom
fix/date-type-reserved

Conversation

@jonahsnider

@jonahsnider jonahsnider commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

date is a real Sanity type, but it wasn't 8 years ago when #299 introduced schema validation. Since it's now included as a core type, we don't need to include it in the FUTURE_RESERVED array.

Also, since we're touching this code anyway I made it so the list of reserved types is a Set instead of an array since we're just checking for inclusion anyway.


Note

Low Risk
Small validation-path refactor in schema traversal with no security or data-handling impact; behavior change is limited to reserved-name detection for date and lookup performance/clarity.

Overview
Removes date from the FUTURE_RESERVED list in schema traversal so it is no longer treated as a placeholder reserved name now that date is a core Sanity type.

Reserved-name checks now use a Set (including type, future reserved names, core types, and parent types) instead of concatenating arrays and special-casing type in isReserved, with a small typing tweak on that helper.

Reviewed by Cursor Bugbot for commit cdc3ad1. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
auth-test-studio Ready Ready Preview Oct 20, 2026 9:55pm UTC
page-building-studio Ready Ready Preview Oct 20, 2026 9:55pm UTC
studio-diagnostics Ready Ready Preview Oct 20, 2026 9:55pm UTC
studio-radar Ready Ready Preview Oct 20, 2026 9:55pm UTC
studio-storybook Ready Ready Preview Oct 20, 2026 9:55pm UTC
test-studio Ready Ready Preview Oct 20, 2026 9:55pm UTC
test-studio-preview-iframe Ready Ready Preview Oct 20, 2026 9:55pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
variants-2-0-studio Ignored Ignored Preview Oct 20, 2026 9:55pm UTC

Request Review

Copilot AI balanced review requested due to automatic review settings October 1, 2026 00:31
@jonahsnider
jonahsnider requested a review from a team as a code owner October 1, 2026 00:31
@jonahsnider
jonahsnider requested review from stipsan and removed request for a team October 1, 2026 00:31
@jonahsnider
jonahsnider enabled auto-merge (squash) October 1, 2026 00:31
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — sanity

Compared against main (8f950501) · v6.20.0 (npm)

sanity

Metric Value vs main (8f95050) vs v6.20.0
Internal (raw) 4.62 MB - +10.0 KB, +0.2%
Internal (gzip) 1.15 MB - +2.8 KB, +0.2%
Bundled (raw) 13.71 MB +7 B, +0.0% -6.0 KB, -0.0%
Bundled (gzip) 3.26 MB -8 B, -0.0% -1.8 KB, -0.1%
Import time 1.03s +1ms, +0.1% +28ms, +2.8%

bin:sanity

Metric Value vs main (8f95050) vs v6.20.0
Internal (raw) 7.1 KB - -
Internal (gzip) 2.9 KB - -
Bundled (raw) 7.1 KB - -
Bundled (gzip) 2.8 KB - -
Import time 3ms +0ms, +3.1% +0ms, +4.1%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

The focused refactor preserves validation behavior while removing obsolete classification.

Review effort: Balanced
Findings: None

What changed in this PR

Removes the redundant date future-reserved entry while preserving it as a reserved core type.

Changes:

  • Removes date from FUTURE_RESERVED.
  • Uses a Set for reserved-name lookups.
  • Includes type directly in the reserved-name set.
File Description
packages/​@sanity/​schema/​src/​core/​traverseSchema.ts Updates reserved schema type handling and lookup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 57.01% 50582 / 88721
🔵 Statements 52.53% 68671 / 130717
🔵 Functions 51.85% 10362 / 19981
🔵 Branches 46.7% 39981 / 85611
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/@sanity/schema/src/core/traverseSchema.ts 90.9% 80.76% 86.95% 92.3% 18-24, 119, 133
Generated in workflow #75624 for commit cdc3ad1 by the Vitest Coverage Report Action

@stipsan stipsan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Good catch!

@jonahsnider
jonahsnider merged commit b426283 into main Nov 9, 2026
86 of 88 checks passed
@jonahsnider
jonahsnider deleted the fix/date-type-reserved branch November 9, 2026 12:27
@squiggler-app

squiggler-app Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

A 📜 Release note has been created for this PR.

Please take a look and make sure it includes all the relevant details.

Thanks for your contribution, @jonahsnider! 🎉

This branch was successfully deployed

7 active deployments
Preview – test-studio — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
Preview – studio-storybook — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
Preview – studio-radar — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
Preview – page-building-studio — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
Preview – auth-test-studio — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
Preview – studio-diagnostics — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
Preview – test-studio-preview-iframe — cdc3ad15 Deployed Oct 20, 2026 by vercel[bot]
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.

3 participants