Repository navigation
fix(core): validation errors name what was validated - #413
Merged
Merged
Conversation
Every StackValidationError opened with "Content validation failed", including refusals of arguments that have nothing to do with content (migrateAll(TypeId), grantType(TypeId), a versioned filter.baseId, an empty associate([]), a duplicate in amendAssociations()). StackValidationError now takes its header. Content keeps "Content validation failed"; defineType()'s schema checks read "Schema validation failed"; argument checks read "Invalid arguments". create() and mutate() report option errors ahead of content errors so each refusal carries one subject. associate()/dissociate() and grantAccess()/revokeAccess() check their list before wrapping it as edits, so errors name `associations` or `permissions` rather than the `changes` of the verb they delegate to. deserializeError() keeps the header a server sent. Closes #406 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B7z8BEjS2hwDbLyZTaopo4
🦋 Changeset detectedLatest commit: 6516435 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…irst - create()/mutate() report argument and content problems together again; a mixed set reads "Invalid arguments", content alone keeps its header. - assertAssociationList() runs the surface check before counting duplicates, matching assertAssociationEdits(), so associate() given a duplicated permission is still a bad_request, not a validation error. - Changeset is minor: message text and errors[].path are observable. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012Juw9shSNkSZVNbXopt3Z3
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.
Summary
Closes #406.
StackValidationErrortakes its header. Content keeps "Content validation failed";defineType()'s schema checks read "Schema validation failed"; argument checks (migrateAll/grantType/revokeTypebaseId,filter.baseId, ID clock skew, association edit lists, permission sets,attachmentRecordId, install manifests, wire-body fields) read "Invalid arguments".associate()/dissociate()andgrantAccess()/revokeAccess()— on bothStackandScopedStack— check their list before wrapping it as edits, so errors are reported underassociations/permissionsrather thanchanges. A wrong-surface element is still refused asbad_requestbefore duplicates are counted.deserializeError()keeps the header a server sent. Four conformance fixtures whose refusals are argument checks now carry "Invalid arguments".Spec
codeand the 422 mapping are unchanged. Message text and the list verbs'errors[].pathchange; the spec pins neither, but both are observable, so the changeset isminor.Verification
pnpm run format:check,check:refs,lint,test,build,typecheck— all clean.packages/core/tests/validation-headers.test.tsasserts header and path per call site; the wire-types round-trip test asserts the header survives.Notes for reviewers
create()/mutate()still report argument and content problems in one refusal. A mixed set reads "Invalid arguments" (content is itself an argument); content alone keeps its header.patch; this isminorbecause paths and messages are observable.🤖 Generated with Claude Code
https://claude.ai/code/session_01B7z8BEjS2hwDbLyZTaopo4