Skip to content

fix(core): validation errors name what was validated - #413

Merged
cuibonobo merged 2 commits into
mainfrom
claude/issue-406-l5xj8r
Oct 6, 2026
Merged

cuibonobo merged 2 commits into
mainfrom
claude/issue-406-l5xj8r

Conversation

@cuibonobo

@cuibonobo cuibonobo commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #406.

StackValidationError takes its header. Content keeps "Content validation failed"; defineType()'s schema checks read "Schema validation failed"; argument checks (migrateAll/grantType/revokeType baseId, filter.baseId, ID clock skew, association edit lists, permission sets, attachmentRecordId, install manifests, wire-body fields) read "Invalid arguments".

associate()/dissociate() and grantAccess()/revokeAccess() — on both Stack and ScopedStack — check their list before wrapping it as edits, so errors are reported under associations/permissions rather than changes. A wrong-surface element is still refused as bad_request before duplicates are counted.

deserializeError() keeps the header a server sent. Four conformance fixtures whose refusals are argument checks now carry "Invalid arguments".

Spec

code and the 422 mapping are unchanged. Message text and the list verbs' errors[].path change; the spec pins neither, but both are observable, so the changeset is minor.

Verification

pnpm run format:check, check:refs, lint, test, build, typecheck — all clean. packages/core/tests/validation-headers.test.ts asserts 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.
  • "Schema validation failed" is a third header beyond the two the issue names.
  • The issue asked for a patch; this is minor because paths and messages are observable.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B7z8BEjS2hwDbLyZTaopo4

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-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6516435

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@haverstack/core Minor
@haverstack/wire-types Minor
@haverstack/conformance-fixtures Minor
@haverstack/adapter-api Patch
@haverstack/adapter-conformance Patch
@haverstack/adapter-local Patch
@haverstack/blob-adapter-disk Patch
@haverstack/blob-adapter-s3 Patch
@haverstack/commons Patch
@haverstack/record-adapter-do-sqlite Patch
@haverstack/record-adapter-sqlite Patch

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
@cuibonobo
cuibonobo merged commit b073e84 into main Oct 6, 2026
9 checks passed
@cuibonobo
cuibonobo deleted the claude/issue-406-l5xj8r branch October 6, 2026 11:53
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.

Validation errors name what was validated

2 participants