Repository navigation
fix(rpc): pass SchemaError failures through request contracts - #918
Closed
omegent-app[bot] wants to merge 1 commit into
Closed
omegent-app[bot] wants to merge 1 commit into
omegent-app[bot] wants to merge 1 commit into
Conversation
@effect-app/cli
effect-app
@effect-app/eslint-codegen-model
@effect-app/eslint-shared-config
@effect-app/infra
@effect-app/vue
@effect-app/vue-components
commit: |
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.
Why
Typed
SchemaErrorfailures did not survive application RPCs: query failureswere promoted to defects by logger middleware, and command/stream failure
wrappers could not encode them against their declared error schemas. Clients
therefore saw a defect or a response decoding error rather than the original
schema failure.
What
Include
SchemaErrorin everymakeRpcClientrequest's common error contractand let logger middleware preserve typed failures. No application-specific
error type or handler wrapper is needed. Explicitly raised defects remain defects.
How
SchemaErrorCodecencodes the native error as its tag and formatted message,then decodes through a Schema transformation into an actual
SchemaError.isSchemaError,instanceof,messageandtoStringwork on the client.The decoded issue is a normalized
InvalidValuecarrying that message; theoriginal schema AST and input are not transported. Add the codec to the inner
request error union so command metadata and stream failure wrappers encode it
correctly. Authentication middleware errors continue to use middleware schemas.
Validation
Focused tests: codec JSON round-trip and strict wire validation, request error
typing, and real HTTP query/command/stream failure round-trips, including a
failure after the first stream value. An explicit schema defect remains a defect.
All 30 focused tests passed (two pre-existing skipped cases). The full library
push gate passed typechecks, lint and the unit suite. Changesets cover
effect-appand@effect-app/infra.This supersedes the withdrawn Scanner-specific workaround in
https://github.com/macs-holding/scanner/pull/2445. Scanner will need the published
library release on both API and frontend to receive this transport fix.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.