Skip to content

fix: add explicit fileutils/logger dependencies for Ruby 4.0 - #119

Merged
gavindidrichsen merged 2 commits into
mainfrom
fix/ruby4-missing-fileutils-logger-requires
Sep 14, 2026
Merged

gavindidrichsen merged 2 commits into
mainfrom
fix/ruby4-missing-fileutils-logger-requires

Conversation

@LukasAud

Copy link
Copy Markdown
Contributor

Summary

  • The spec (ruby 4.0 | puppet ~> 9.0) nightly lane has failed 5 consecutive nights on both ubuntu and windows.
  • Ruby 4.0 unbundled fileutils and logger from the default gem set (the same thing already happened to win32ole, per an existing comment in this repo).
  • lib/puppet/modulebuilder/builder.rb uses FileUtils extensively but never requires it, and require 'logger' without declaring logger as a real gemspec dependency. This only worked before by accident, via some other gem in the dependency graph transitively pulling both in — not guaranteed, and it broke under Ruby 4.0.

Test plan

  • Reproduced NameError: uninitialized constant FileUtils locally on Ruby 4.0.2 with a minimal bundle, matching the CI failure
  • Added require 'fileutils' in builder.rb and explicit fileutils/logger dependencies in the gemspec
  • Full unit suite (bundle exec rspec spec/unit) passes 59/59 on both Ruby 3.2.6 and Ruby 4.0.2, matching CI's example count
  • Confirm next scheduled Nightly run goes green for the Ruby 4.0 lane

🤖 Generated with Claude Code

Nightly CI has failed for 5+ consecutive nights on the ruby 4.0 /
puppet ~> 9.0 lanes with `NameError: uninitialized constant FileUtils`
in builder_spec.rb. Ruby 4.0 unbundled both fileutils and logger from
the default gem set (already worked around for win32ole in the
Gemfile); builder.rb uses FileUtils extensively but never required it,
and only required logger without declaring it as a real dependency.
It happened to work before because some other gem in the resolved
dependency graph transitively pulled fileutils/logger in - that's not
guaranteed and breaks under a different dependency set.

Verified locally: reproduced the NameError under Ruby 4.0.2, confirmed
it's gone with these two gemspec dependencies plus the missing
require, and the full unit suite (59 examples) now passes under both
Ruby 4.0.2 and 3.2.6 with no regressions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@LukasAud
LukasAud requested a review from a team as a code owner September 14, 2026 10:11
@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.96%. Comparing base (53d7990) to head (cf9e93e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #119      +/-   ##
==========================================
+ Coverage   94.93%   94.96%   +0.03%     
==========================================
  Files           2        2              
  Lines         158      159       +1     
==========================================
+ Hits          150      151       +1     
  Misses          8        8              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread puppet-modulebuilder.gemspec Resolved
Sounds good. Thanks for the suggestion

Co-authored-by: Tim Meusel <tim@bastelfreak.de>
@gavindidrichsen
gavindidrichsen merged commit d9cd390 into main Sep 14, 2026
12 checks passed
@gavindidrichsen
gavindidrichsen deleted the fix/ruby4-missing-fileutils-logger-requires branch September 14, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants