Skip to content

fix: Declare logger as a runtime dependency - #94

Merged
jsonbailey merged 1 commit into
mainfrom
jb/sdk-3207/logger-runtime-dep
Sep 28, 2026
Merged

jsonbailey merged 1 commit into
mainfrom
jb/sdk-3207/logger-runtime-dep

Conversation

@jsonbailey

@jsonbailey jsonbailey commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On Ruby 4.0, require "ld-eventsource" fails with:

cannot load such file -- logger (LoadError)

This happens in any app that does not already pull in the logger gem.

Cause

lib/ld-eventsource/client.rb requires logger, but the gemspec lists logger only as a development dependency. Ruby 4.0 removed logger from the default gems, so it is not available unless something declares it.

Fix

Move logger from add_development_dependency to add_runtime_dependency. The constraint stays ~> 1.5. Ruby 3.1 (the oldest supported version) ships logger 1.5.0, so this does not force an upgrade there.

Proof

A Bundler project with only gem "ld-eventsource", path: <this branch>, on Ruby 4.0.6, running bundle exec ruby -e 'require "ld-eventsource"; puts :ok':

  • Before: cannot load such file -- logger (LoadError)
  • After: ok (Bundler resolves logger 1.7.0)

Other requires checked

All require calls in lib/. Standard-library ones are logger, thread, and uri. thread is built in and uri is still a default gem in Ruby 4.0, so only logger needs a change. The code does not use base64, ostruct, cgi, bigdecimal, or json directly (JSON bodies go through the http gem).

Tests

  • bundle exec rspec spec: 174 examples, 0 failures
  • bundle exec rubocop --parallel: 16 files inspected, no offenses

CI covers Ruby 3.2, 3.3, 3.4, JRuby 9.4 and JRuby 10.0. It does not include Ruby 4.0.

Impact

The Ruby server SDK is not affected, because its lock file pulls in logger through other gems.

Jira: SDK-3207


Note

Overview
Fixes LoadError when requiring ld-eventsource on Ruby 4.0, where logger is no longer a default gem even though lib/ld-eventsource/client.rb requires it.

The gemspec now declares logger (~> 1.5) as a runtime dependency instead of a development-only dependency, so Bundler installs it for consumers. The version constraint is unchanged and remains compatible with Ruby 3.1’s bundled logger.

Reviewed by Cursor Bugbot for commit 3b046d5. Bugbot is set up for automated code reviews on this repo. Configure here.

@jsonbailey
jsonbailey marked this pull request as ready for review September 28, 2026 14:23
@jsonbailey
jsonbailey requested a review from a team as a code owner September 28, 2026 14:23
@jsonbailey
jsonbailey merged commit f7809c2 into main Sep 28, 2026
12 checks passed
@jsonbailey
jsonbailey deleted the jb/sdk-3207/logger-runtime-dep branch September 28, 2026 14:31
jsonbailey pushed a commit that referenced this pull request Sep 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.0.0](2.6.0...3.0.0)
(2026-09-28)


### ⚠ BREAKING CHANGES

* Report a server-initiated stream close to the error handler
([#91](#91))

### Features

* Report a server-initiated stream close to the error handler
([#91](#91))
([7e4dc1b](7e4dc1b))


### Bug Fixes

* Declare logger as a runtime dependency
([#94](#94))
([f7809c2](f7809c2))
* Stop the worker thread promptly when the client is closed during a
reconnect wait
([#93](#93))
([054b11b](054b11b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Release 3.0.0** — bumps the package version from `2.6.0` to `3.0.0`
in `.release-please-manifest.json`, `lib/ld-eventsource/version.rb`, and
documents the release in `CHANGELOG.md`.
> 
> This is a Release Please cut, not new library logic in the diff. The
changelog records what ships in **3.0.0**: a **breaking** behavior
change where a **server-initiated stream close** is reported through the
client **error handler** (e.g. `StreamClosedByServerError`), plus fixes
to declare **`logger` as a runtime dependency** and to **stop the worker
thread promptly** when the client is closed during a reconnect backoff
wait.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d5431c5. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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