Skip to content

fix: declare the standard library gems the driver requires - #148

Merged
tas50 merged 1 commit into
mainfrom
declare-stdlib-deps
Aug 23, 2026
Merged

fix: declare the standard library gems the driver requires#148
tas50 merged 1 commit into
mainfrom
declare-stdlib-deps

Conversation

@tas50

@tas50 tas50 commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

Declares the five formerly-stdlib gems this driver requires but never listed, plus three small tooling cleanups.

bundle exec rake is green: 294 examples, 0 failures, cookstyle clean across 18 files (was 6), YARD still 100%.

The problem

Every standard library this driver requires — except openssl — has stopped being a default gem:

Library Required by driver Declared Resolves from
base64 a real gem, present only via jwt / rubyntlm
date interpreter stdlib dir
json a real gem, via faraday
securerandom interpreter stdlib dir
timeout interpreter stdlib dir

base64 is the live hazard. It is not in the bundle on its own account — it is there because jwt and rubyntlm happen to depend on it. The moment a transitive dependency drops it, this gem fails with:

LoadError: cannot load such file -- base64

That is byte-for-byte the failure test-kitchen 3.x hits on Ruby 4.0 with benchmark, which #146 diagnosed. Same bug, different library, this time in our own gemspec.

The fix

# Formerly part of the standard library. These are no longer default gems,
# so they must be declared rather than assumed present.
s.add_dependency "base64", ">= 0.1"
s.add_dependency "date", ">= 3.2"
s.add_dependency "json", ">= 2.5"
s.add_dependency "securerandom", ">= 0.1"
s.add_dependency "timeout", ">= 0.2"

Floors match what Ruby 3.1 — this gem's oldest supported interpreter — ships as default gems, so nothing new is downloaded there.

On the gem count

Installed gems go 98 → 100, and I want to be straight about that rather than bury it: this makes the dependency surface honest, it does not enlarge it. The driver always used these five. Three of them were simply being taken from the interpreter instead of the bundle. Nothing new is pulled in on any Ruby that still ships them.

I verified the result actually stands on its own — the driver loads with only runtime dependencies present, no development groups:

$ BUNDLE_WITHOUT="test:debug:cookstyle:docs" bundle exec ruby -Ilib -e 'require "kitchen/driver/gce"'
driver loads: OK

I also confirmed the built gem packages lib/kitchen/driver/gce/windows_password.rb and declares all seven runtime dependencies.

Tooling cleanups

Removed .github/dependabot.yml. Dependabot (daily, 10 PRs) and Renovate (config:recommended) were both configured for bundler, so both would open pull requests for the same updates. Git history shows Renovate is the one actually landing changes here (#137, #138), making Dependabot vestigial.

Specs are now linted. .rubocop.yml excluded spec/**/*, an exclusion that predated the current suite. That suite passes cookstyle clean, so the exclusion is gone and coverage goes from 6 files to 18.

Dropped redcarpet. It was a dev-only C extension serving as YARD's markdown provider. Docs still build at 100% coverage without it.

Not changed

I considered replacing Base64.strict_encode64 with [x].pack("m0") and DateTime#rfc3339 with strftime — both verified byte-identical — which would have removed two runtime dependencies outright. Declaring them keeps the cryptographic code readable, which matters more in that particular file.

I also left google-apis-compute_v1 at >= 0.75 with no upper bound.

🤖 Generated with Claude Code

Every stdlib library this driver requires, apart from openssl, has
stopped being a default gem: base64, date, json, securerandom and
timeout. All five were required but none were declared.

They only kept working by luck. base64 resolves to a real gem that is
present solely because jwt and rubyntlm happen to depend on it; date,
securerandom and timeout were being picked up from the interpreter's
standard library directory rather than from the bundle. If a transitive
dependency drops base64, kitchen-google fails with

  LoadError: cannot load such file -- base64

which is exactly the failure mode test-kitchen 3.x hits on Ruby 4.0
with benchmark.

The floors match what Ruby 3.1, the gem's oldest supported interpreter,
ships as default gems, so nothing new is downloaded there.

Also:

* Remove .github/dependabot.yml. Both Dependabot and Renovate were
  configured for bundler, so both would open pull requests for the same
  updates. Renovate is the one actually landing changes in this repo.
* Lint spec/ with cookstyle. The exclusion predated the current suite,
  which passes clean, so the specs are now covered too: 18 files
  inspected rather than 6.
* Drop redcarpet. It was pulled in only as YARD's markdown provider;
  documentation still builds at 100% coverage without it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tas50
tas50 merged commit f0d91dc into main Aug 23, 2026
8 checks passed
@tas50
tas50 deleted the declare-stdlib-deps branch August 23, 2026 02:50
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.

1 participant