@@ -483,6 +483,50 @@ and `result:`. A failure callback receives `effect_id:`, `arguments:`, and
483483` error: ` , so an actor can correlate concurrent effects without storing a
484484separate callback ledger.
485485
486+ ### Typing your on_failure handler
487+
488+ The gem ships ` SolidObjects::effect_error ` ,
489+ ` SolidObjects::effect_failure_payload[Arguments] ` , and
490+ ` SolidObjects::effect_success_payload[Arguments, Result] ` as public RBS aliases.
491+ They describe the existing string-keyed hashes; they are not Ruby wrapper classes.
492+ See [ signature loading] ( development.md#public-effect-payload-signatures ) for Steep setup.
493+
494+ For an actor with ` generation ` and ` status ` attributes, declare the callback keywords
495+ in the application's RBS:
496+
497+ ``` rbs
498+ class ChatRun < SolidObjects::Actor
499+ type run_arguments = { "generation" => Integer }
500+ def fail_turn: (effect_id: String, arguments: run_arguments, error: SolidObjects::effect_error) -> void
501+ end
502+ ```
503+
504+ ``` ruby
505+ def fail_turn (effect_id: , arguments: , error: )
506+ return unless arguments[" generation" ] == generation
507+
508+ self .status = " failed"
509+ end
510+ ```
511+
512+ Record access with ` arguments["generation"] ` retains its declared ` Integer ` type.
513+ The callback receives top-level keywords, while nested arguments and error keys
514+ remain strings. The failure envelope requires ` "effect_id" ` , ` "arguments" ` , and
515+ ` "error" ` ; the success envelope replaces ` "error" ` with ` "result" ` . Empty original
516+ arguments remain ` {} ` , and a success result may be ` nil ` or any supported JSON value.
517+ Ruby errors contain ` "class" ` (` String? ` , including anonymous exception classes),
518+ ` "message" ` (` String ` , limited to 8,192 bytes), and ` "backtrace" ` (` Array[String] ` ,
519+ limited to 50 entries and possibly empty).
520+
521+ Applications supply the generic argument/result types to describe their serialized
522+ JSON values. These aliases do not infer or validate independently registered effect
523+ handlers. Their type parameters are deliberately unconstrained: Ruby serialization
524+ accepts and normalizes values such as symbols, and RBS cannot express that conversion
525+ as a generic bound. The constructors and consumer fixtures are checked with strict
526+ Steep diagnostics. JavaScript exposes equivalent contracts with its existing
527+ camelCase ID and ` { name, message } ` error shape in
528+ [ solid-objects-js #47 ] ( https://github.com/cardmagic/solid-objects-js/issues/47 ) .
529+
486530A commit action is registered the same way and runs inside the short fenced
487531transaction:
488532
0 commit comments