Skip to content

Generate actor-specific RBS dispatch types - #66

Merged
cardmagic merged 2 commits into
mainfrom
feat/actor-operation-rbs
Sep 15, 2026
Merged

cardmagic merged 2 commits into
mainfrom
feat/actor-operation-rbs

Conversation

@cardmagic

@cardmagic cardmagic commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Typed actors currently get Ruby::NoMethod for valid scheduled operations, while misspelled effect callbacks pass Steep. This adds an opt-in RBS generator that combines registered actor message names with application-declared argument types, and prepares version 0.14.7. Existing Ruby calls, runtime validation, and staging behavior stay unchanged.

Closes #63. Counterpart to JS #49. Rebased onto main at e00f4c1, preserving the payload contracts and documentation merged in #65. The release notes cover both typing improvements; the gem version and regenerated lockfile agree.

The syntax stays the same:

schedule(at: deadline, key: "watchdog").recover_if_stuck(generation: generation)
emit :run_model, generation: generation, on_failure: :fail_turn

Before: the first call fails static checking and a callback typo passes. After loading the generated signatures: valid calls pass; invalid operations/callbacks and wrong keyword arguments fail.

require "solid_objects/actor_signatures" loads development tooling only. ActorSignatures.generate(actors:, signatures:) returns deterministic RBS, preserving handwritten inputs and refreshing removed operations. The application owns loading its actors and writing the generated file. It never invokes operations, migrations, or workers. The generator requires explicit signatures, supports inherited/block messages and method overloads/generics, and gives staging methods nil returns. Generic actor classes require application-owned signatures.

Dynamic names use explicit public_send; normal typed calls have no catch-all fallback. Global effect/commit-action registries, references, queries, and ordinary untyped Ruby usage remain unchanged. This does not claim actor-specific Sorbet support.

Validation after rebase and version bump:

  • bundle exec rake: 633 tests, 2,238 assertions, no failures/errors (15 environment-gated skips), plus formatting, RBS generation/validation, strict payload and consumer checks, Steep, and Brakeman.
  • The strict consumer checks real actor source, inherited/required/optional/zero keyword arguments, block callbacks, both literal forms, dynamic calls, overloads/generic methods, and nil staging returns.
  • Removing the generated signatures reproduces Ruby::NoMethod; 14 invalid calls each produce a diagnostic.
  • Tests load the generator/signatures from a built gem, reject missing/incompatible declarations, verify deterministic ordering, and refresh removed operations. The merged payload package tests also pass at version 0.14.7.
  • Conflict resolutions retain both payload guidance and actor-signature documentation in development/reminder docs.

Release preparation updates the PR branch; publishing remains a separate step.

@cardmagic

Copy link
Copy Markdown
Owner Author

@greptileai please review the current head for issue #63, including generated signature correctness, explicit dynamic dispatch, and packaged consumer tests.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds opt-in generation of actor-specific RBS dispatch signatures while preserving runtime dispatch behavior and prepares release 0.14.7.

  • Generates deterministic schedule, transmit, and effect-callback signatures from registered actor messages and application declarations.
  • Rejects missing, private, positional, block-bearing, or generic declarations that cannot safely produce dispatcher signatures.
  • Adds packaged-consumer and strict Steep coverage for valid and invalid actor calls.
  • Preserves the rebased public effect-payload contracts and documents both typing improvements in the release notes.
  • Keeps the version constant and regenerated lockfile aligned at 0.14.7.

Confidence Score: 5/5

The PR appears safe to merge; the combined signatures, package layout, release notes, and version metadata are consistent, with no outstanding actionable issue identified.

The packaged signature root includes generated, support, and public declarations; actor-specific generation is covered against a built gem and strict consumer fixtures; and the 0.14.7 version, lockfile, and changelog agree.

Important Files Changed

Filename Overview
lib/solid_objects/actor_signatures.rb Implements deterministic actor-specific RBS generation with explicit declaration validation and nil-returning staged operation types.
test/integration/actor_signatures_test.rb Exercises packaged generation, deterministic output, refreshed operations, declaration rejection, and strict consumer diagnostics.
docs/development.md Documents application-owned declarations, generation, Steep loading, limitations, and explicit dynamic-dispatch escape hatches.
CHANGELOG.md Records both public effect-payload typing and actor-specific dispatch generation under release 0.14.7.
Gemfile.lock Regenerates both local solid_objects entries consistently for version 0.14.7.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Application loads actor classes] --> B[Application supplies actor RBS paths]
  B --> C[ActorSignatures loads packaged and application signatures]
  C --> D[Reflect registered actor message names]
  D --> E[Validate matching public keyword-only declarations]
  E --> F[Rewrite operation return types to nil]
  F --> G[Generate actor-specific dispatcher interface]
  G --> H[Application writes generated RBS]
  H --> I[Steep checks schedule, transmit, and callback calls]
Loading

Reviews (2): Last reviewed commit: "chore: prepare version 0.14.7" | Re-trigger Greptile

Combine registered message names with application-declared signatures.
Keep strict checks opt-in and preserve dynamic Ruby dispatch and global
registry names. Verify actual consumer source and packaged tooling.

Closes #63
Combine operation and payload typing release notes after rebasing onto main. Regenerate the lockfile from the gem version.
@cardmagic
cardmagic force-pushed the feat/actor-operation-rbs branch from 2eb87c4 to d29fccf Compare September 15, 2026 02:47
@cardmagic

Copy link
Copy Markdown
Owner Author

@greptileai please review head d29fccf after rebasing onto main and preparing 0.14.7. The conflict resolutions retain both payload contracts and actor-operation documentation. Full local rake passes (633 tests, 2238 assertions); please verify combined signatures, packaging, release notes, and regenerated lockfile.

@cardmagic
cardmagic merged commit 0b92ed1 into main Sep 15, 2026
41 checks passed
@cardmagic
cardmagic deleted the feat/actor-operation-rbs branch September 15, 2026 03:57
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.

Add actor-specific RBS for dispatch and callbacks

1 participant