Skip to content

✨ kettle-jem: opt-in Duel performance regression guards - #81

Merged
pboling merged 1 commit into
structuredmerge:mainfrom
sferik:duel
Oct 26, 2026
Merged

pboling merged 1 commit into
structuredmerge:mainfrom
sferik:duel

Conversation

@sferik

@sferik sferik commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

As discussed on ruby-oauth/oauth2#780, this adds Duel to the kettle-jem template, so any templated project can opt in and re-templating keeps it. It's off by default: workflows.duel: true turns it on, next to workflows.recording, and it only applies to the full profile. With it off, nothing kettle-jem generates changes.

With Duel on, the template generates .github/workflows/perf.yml, gemfiles/modular/duel.gemfile (Duel and StackProf on Ruby 3.4 or later only), a perf appraisal, the root Gemfile's eval_gemfile for local development, a rake duel task with a stub for older Rubies, the RuboCop include for .duel.rb, and the badge at the end of the badge row. .duel.rb is only copied when it's missing, since it's the project's, and no benchmarks are generated. The workflow is the one from oauth2's PR after review: a read-only Duel job, a separate Comment job with only pull-requests: write that runs none of the branch's code, and the baseline's Ruby (and its bundle) installed for every kind of run when its version file names a different Ruby. It follows the template's conventions for pins, the [ci skip] guard and permissions.

The new spec covers absent and false rendering identically, a project's own Duel files being left alone while it's off, every generated file with it on, a second run changing nothing, an existing .duel.rb and perf appraisal being kept, the profile gating and the changelog transfer filter. I also ran it against oauth2: with Duel off the output matches main's kettle-jem except the lock file's checksums, and with it on every Duel file matches what oauth2's PR ends up with. The rest of the suite has the same six failures here as main (a fixture outside the repo, and the case-insensitive macOS filesystem), and rubocop_gradual:check flags appraisal_helper_and_token_spec.rb, which this doesn't touch.

A few things you may want to weigh in on:

  • Adding actions/download-artifact to the pin table means kettle-jem will also update that pin in a project's own workflows, even with Duel off.
  • The badge is reference-style, to match the rest of the row.
  • Concurrency only cancels superseded pull request runs, so no push to main skips its comparison.
  • It uses ruby/setup-ruby rather than setup-ruby-flash, because the baseline steps need its ruby-prefix output.
  • The push trigger is main only, not *-stable.
  • Turning Duel off again doesn't remove what it generated.
  • I couldn't check whether the kettle-jem-appraisals plugin keeps the injected perf block.

Once there's a release with this, I'll update oauth2's PR to just set workflows.duel: true and drop its workarounds.

Add Duel (https://github.com/sferik/duel-ruby) to the template, off by
default, so that every templated project can opt in with
`workflows.duel: true` and re-templating keeps it. This replaces the
per-project setup reviewed in
ruby-oauth/oauth2#780.

With Duel on, the full template generates:

- .github/workflows/perf.yml: a read-only Duel job and a separate
  Comment job with only pull-requests: write, which runs none of the
  branch's code. The baseline's Ruby, and the bundle for it, are
  installed for every event type when its version file (.ruby-version,
  .tool-versions, or mise.toml, in Duel's order) names another Ruby
  than the candidate's.
- gemfiles/modular/duel.gemfile: Duel and StackProf on Ruby 3.4 or
  later only, loaded by the root Gemfile and a new perf appraisal.
- a `rake duel` task in the Rakefile, with a stub for older Rubies.
- the RuboCop include for .duel.rb, and the Duel README badge.
- .duel.rb, only when it is missing.

While Duel is off, kettle-jem neither writes nor removes .duel.rb,
perf.yml, or duel.gemfile, and generated files are unchanged.
actions/download-artifact joins the workflow pin table, and a
workflow.duel changelog transfer filter scopes the replayed entry to
projects that opt in.
@pboling

pboling commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Adding actions/download-artifact to the pin table means kettle-jem will also update that pin in a project's own workflows, even with Duel off.

Not an issue! The template always updates workflows it can process, and the templated release tooling has a hard fail-closed gate when outdated workflow pins are discovered... So updating them is already a requirement.

I'll fix CI issues.

@pboling
pboling merged commit 756aa83 into structuredmerge:main Oct 26, 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.

2 participants