Enable strict validation by default in defineStack()#654
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Contributor
|
@copilot 修正内核所有对象, fix and test |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate test passing without errors
Enable strict validation by default in defineStack()
Feb 12, 2026
Copilot stopped work on behalf of
hotlong due to an error
February 12, 2026 16:39
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enforces field name validation by changing defineStack() to validate by default. Previously, field names were required to be snake_case per the schema specification, but this validation was never enforced because defineStack() defaulted to strict: false and returned configurations as-is without running Zod validation.
Changes:
- Changed
DefineStackOptions.strictdefault fromfalsetotrueto enable validation by default - Updated validation logic from
if (!options?.strict)toconst strict = options?.strict !== false; if (!strict) - Updated tests to reflect new default behavior and added comprehensive field name validation tests
- Created changeset documenting this breaking change with migration guide
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/stack.zod.ts | Changed default value of strict option from false to true and updated implementation logic to validate by default |
| packages/spec/src/stack.test.ts | Updated existing test expectations for new default behavior and added 4 new tests for field name validation (camelCase rejection, PascalCase rejection, snake_case acceptance, strict=false bypass) |
| packages/spec/src/data/field-name-validation.test.ts | New test file with direct FieldSchema validation tests covering camelCase, PascalCase, snake_case, and optional name cases |
| FIELD_VALIDATION_FIX.md | Comprehensive technical documentation explaining root cause, investigation findings, solution, and migration path |
| .changeset/strict-validation-by-default.md | Breaking change documentation with migration guide, examples, and impact assessment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Field name validation (snake_case requirement) existed in schema but was never enforced.
defineStack()defaulted tostrict: false, returning config as-is without running Zod validation.Changes
Breaking Change:
defineStack()now validates by defaultDefineStackOptions.strictdefault:false→trueconst strict = options?.strict !== falsestrict: falseValidation enforcement
/^[a-z_][a-z0-9_]*$/(snake_case)"Field names must be lowercase snake_case"Migration
Files Modified
stack.zod.ts: Default strict=true, updated logicstack.test.ts: Updated tests, added 4 validation testsfield-name-validation.test.ts: New direct FieldSchema tests.changeset/strict-validation-by-default.md: Breaking change documentationOriginal prompt
Created from VS Code.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.