Skip to content

[17.0.0-rc.0] Runtime dispatcher error paths drop ValidationError.fields[] and downgrade status to 500 (rest-server maps it correctly) #3918

Description

@yinlianghui

Found while investigating form UX during the HotCRM 17.0.0-rc.0 upgrade (tag commit fc156fa4a). Minor but it forecloses per-field error display for any surface served by the runtime dispatcher.

Facts

  • ValidationError carries .code='VALIDATION_FAILED' and .fields[], but no .status/.statusCode/.issues (packages/objectql/src/validation/record-validator.ts:106-122).
  • @objectstack/rest maps it correctly → 400 with top-level fields[] (packages/rest/src/rest-server.ts:134-143).
  • The runtime dispatcher's two error exits do neither:
    • packages/runtime/src/http-dispatcher.ts:495-506 (errorFromThrown): status falls back to 500 (no .status on the error), details reads only .issues (absent) → fields[] lost.
    • packages/runtime/src/dispatcher-plugin.ts:378-410 (errorResponseBase): same status fallback; body carries only {message, code}, and :402 replaces the message with the generic INTERNAL_ERROR_MESSAGE on 5xx — so the caller gets a 500 "internal error" for a user-input validation failure.

Ask

Teach both dispatcher exits the VALIDATION_FAILED shape (status 400 + fields[] passthrough), matching rest-server.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions