Skip to content

refactor(studio-server): oRPC-native typed contract errors — declared .errors() maps, host-context defined-error mapping, client safe()/isDefinedError; delete all error wrappers - #1671

Merged
mateicanavra merged 1 commit into
mainfrom
design/p7-orpc-native-errors
Jun 12, 2026
Merged

refactor(studio-server): oRPC-native typed contract errors — declared .errors() maps, host-context defined-error mapping, client safe()/isDefinedError; delete all error wrappers#1671
mateicanavra merged 1 commit into
mainfrom
design/p7-orpc-native-errors

Conversation

@mateicanavra

Copy link
Copy Markdown
Owner

Contract declares per-procedure error maps (packages/studio-server/src/contract/errors.ts) pinning the legacy non-uniform statuses on DECLARED codes (CIV7_/SETUP_/SAVED_, AUTOPLAY_, RUN_IN_GAME_* incl. 404 server-identity echo, SAVE_DEPLOY_* incl. the documented no-echo 404 asymmetry). Router throws typed errors.CODE(...); the studio host context maps engine RunInGameHttpError statuses to matching raw ORPCErrors that arrive client-side as defined errors. Clients read failures via safe() + isDefinedError() and branch on codes, not raw status numbers.

Deleted as architectural dead weight: orpcError/statusToCode/rethrowEngineError (studio-server), orpcFailure/runInGameFailure/saveDeployFailure/readErrorData/StudioServerOrpcFailure/recipeDagSafeErrorMiddleware (studio). RunInGameHttpError-to-contract migration inside the engines (~18 throw sites) is a recorded deferred follow-up.

Gates: studio-server build/check/test (5) green; studio tsc clean; studio bun run test 239/50 green; turbo builds 15/15.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

This was referenced Jun 12, 2026

mateicanavra commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

mateicanavra commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

Merge activity

  • Jun 12, 10:46 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 12, 11:17 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 12, 11:17 PM UTC: @mateicanavra merged this pull request with Graphite.

@mateicanavra
mateicanavra changed the base branch from design/p7-flat-config-explorer to graphite-base/1671 June 12, 2026 23:14
@mateicanavra
mateicanavra changed the base branch from graphite-base/1671 to main June 12, 2026 23:15
… .errors() maps, host-context defined-error mapping, client safe()/isDefinedError; delete all error wrappers

Contract declares per-procedure error maps (packages/studio-server/src/contract/errors.ts) pinning the legacy non-uniform statuses on DECLARED codes (CIV7_*/SETUP_*/SAVED_*, AUTOPLAY_*, RUN_IN_GAME_* incl. 404 server-identity echo, SAVE_DEPLOY_* incl. the documented no-echo 404 asymmetry). Router throws typed errors.CODE(...); the studio host context maps engine RunInGameHttpError statuses to matching raw ORPCErrors that arrive client-side as defined errors. Clients read failures via safe() + isDefinedError() and branch on codes, not raw status numbers.

Deleted as architectural dead weight: orpcError/statusToCode/rethrowEngineError (studio-server), orpcFailure/runInGameFailure/saveDeployFailure/readErrorData/StudioServerOrpcFailure/recipeDagSafeErrorMiddleware (studio). RunInGameHttpError-to-contract migration inside the engines (~18 throw sites) is a recorded deferred follow-up.

Gates: studio-server build/check/test (5) green; studio tsc clean; studio bun run test 239/50 green; turbo builds 15/15.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mateicanavra
mateicanavra force-pushed the design/p7-orpc-native-errors branch from a519209 to 2c100a6 Compare June 12, 2026 23:16
@mateicanavra
mateicanavra merged commit 1f32f7c into main Jun 12, 2026
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.

1 participant