Repository navigation
fix: generated workflows now typecheck, and --all runs - #45
Merged
Merged
Conversation
Two bugs in the workflow generator, both introduced or exposed by #44. The template gained `include Ai::Workflow` but its `call` sig did not say `override.`. Sorbet rejects an implementation of an abstract method without it, so every regenerated class failed to typecheck in the consumer with error 5051. `override.` is not decoration: it is what makes Sorbet verify the signature is a legal implementation. `generate_all_workflows` read `workflow_names = workflow_names`. Ruby binds the local as soon as it parses the assignment, so the right-hand side resolved to the nil local being defined rather than to the method, and `--all` always died with "undefined method `empty?' for nil". The local is renamed. Only `--name` worked before, which is why this went unnoticed. Specs cover both, and assert the template keeps the include, the override and the header forwarding. Note for anyone extending these specs: `generate_all_workflows` calls `exit 1` when a workflow fails, which tears down the RSpec process and silently truncates the run. Test the pieces, not the whole method.
rubenmoya
approved these changes
Sep 2, 2026
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.
Two bugs in the workflow generator, both introduced or exposed by #44.
1. Generated classes did not typecheck
#44 added
include Ai::Workflowto the template but left thecallsig withoutoverride..Sorbet rejects an implementation of an abstract method that does not declare it, so every
regenerated class failed in the consumer:
override.is not decoration — it is what makes Sorbet verify the signature is a legalimplementation of the abstract method.
2.
--allnever workedRuby binds the local as soon as it parses the assignment, so the right-hand side resolves to
the local being defined, not to
#workflow_names. The local is renamed tonames.Only
--nameworked before, which is why this went unnoticed — the existing generated classeswere all produced one at a time.
Tests
Five examples covering both. Each was verified to fail with its fix reverted. The template
assertions also pin the
includeand the header forwarding, so a future template edit cannotquietly drop them again.
Note for anyone extending these specs:
generate_all_workflowscallsexit 1when aworkflow fails. Driving the whole method under test tears down the RSpec process and silently
truncates the run — it looked like passing tests with examples missing. Test the pieces instead.
That
exit 1is worth revisiting separately; a generator that kills its caller is hard to usefrom anything but a terminal.
Checks
rspec111 examples, 0 failures.rubocop40 files, no offenses.srb tcno errors.Version
0.8.0→0.8.1.