Skip to content

Commit a40930c

Browse files
committed
refactor(effect): drop per-action defect schema from Action
Defects are by definition outside the author's vocabulary, so a per-action defect schema has no meaningful content for the author to fill in. Their wire shape is a single runtime-wide policy owned by rivetkit-core's sanitizer, so the client decoder for defects belongs on the transport, not on each Action. @effect/rpc keeps a per-RPC defectSchema because it serializes the full Cause and lets each endpoint pick its own exposure policy. Rivet's client<->engine boundary is always untrusted and sanitization happens uniformly in core, so the per-action knob collapses to a no-op.
1 parent cd13d4c commit a40930c

1 file changed

Lines changed: 0 additions & 22 deletions

File tree

  • rivetkit-typescript/packages/effect/src

rivetkit-typescript/packages/effect/src/Action.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@ import * as Schema from "effect/Schema";
33

44
const TypeId = "~@rivetkit/effect/Action";
55

6-
/**
7-
* Schema describing the shape of unexpected runtime errors (defects)
8-
* that the action transport may surface.
9-
*
10-
* Defects are sanitized at the runtime boundary, so untrusted clients
11-
* never observe raw stack traces or non-serializable payloads.
12-
*/
13-
export interface DefectSchema extends Schema.Top {
14-
readonly Type: unknown;
15-
make(input: null, options?: Schema.MakeOptions): unknown;
16-
make(input: undefined, options?: Schema.MakeOptions): unknown;
17-
make(input: object, options?: Schema.MakeOptions): unknown;
18-
readonly DecodingServices: never;
19-
readonly EncodingServices: never;
20-
}
21-
226
/**
237
* A Rivet Actor action: a synchronous request-response call dispatched
248
* on the actor's main loop.
@@ -44,7 +28,6 @@ export interface Action<
4428
readonly payloadSchema: Payload;
4529
readonly successSchema: Success;
4630
readonly errorSchema: Error;
47-
readonly defectSchema: Schema.Top;
4831
}
4932

5033
/**
@@ -68,7 +51,6 @@ export interface AnyWithProps extends Pipeable {
6851
readonly payloadSchema: Schema.Top;
6952
readonly successSchema: Schema.Top;
7053
readonly errorSchema: Schema.Top;
71-
readonly defectSchema: Schema.Top;
7254
}
7355

7456
// --- Type helpers ---------------------------------------------------
@@ -180,7 +162,6 @@ const makeProto = <
180162
readonly payloadSchema: Payload;
181163
readonly successSchema: Success;
182164
readonly errorSchema: Error;
183-
readonly defectSchema: Schema.Top;
184165
}): Action<Tag, Payload, Success, Error> => {
185166
function Action() {}
186167
Object.setPrototypeOf(Action, Proto);
@@ -220,7 +201,6 @@ export const make = <
220201
readonly payload?: Payload;
221202
readonly success?: Success;
222203
readonly error?: Error;
223-
readonly defect?: DefectSchema;
224204
},
225205
): Action<
226206
Tag,
@@ -230,7 +210,6 @@ export const make = <
230210
> => {
231211
const successSchema = options?.success ?? Schema.Void;
232212
const errorSchema = options?.error ?? Schema.Never;
233-
const defectSchema = options?.defect ?? Schema.Defect;
234213
const payloadSchema: Schema.Top = Schema.isSchema(options?.payload)
235214
? (options?.payload as any)
236215
: options?.payload
@@ -241,6 +220,5 @@ export const make = <
241220
payloadSchema,
242221
successSchema,
243222
errorSchema,
244-
defectSchema,
245223
}) as any;
246224
};

0 commit comments

Comments
 (0)