Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit require where OpenStruct is used #114

Merged
merged 1 commit into from
May 23, 2024
Merged

Add explicit require where OpenStruct is used #114

merged 1 commit into from
May 23, 2024

Conversation

csutter
Copy link
Contributor

@csutter csutter commented May 17, 2024

OpenStruct is used by MockMessage to represent a message's headers and delivery information, but the file (or indeed the entire library) does not actually require the ostruct library which provides this type.

Many of our projects will somehow transitively require it anyway as it's extensively used in Ruby, so this omission hasn't caused issues so far, but we've encountered a problem on search-api-v2 now where a completely unrelated dependency was updated and no longer uses ostruct, causing tests that use MockMessage to fail as the library is no longer loaded.

`OpenStruct` is used by `MockMessage` to represent a message's headers
and delivery information, but the file does not actually require the
`ostruct` library which provides this type.

Many of our projects will somehow transitively require it anyway as it's
extensively used in Ruby, so this omission hasn't caused issues so far,
but we've encountered a problem on `search-api-v2` now where a
completely unrelated dependency was updated and no longer uses
`ostruct`, causing tests that use `MockMessage` to fail as the library
is no longer loaded.
@@ -1,3 +1,5 @@
require "ostruct"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heya, just checking, does this mean you'll be removing the ostruct requirement from other apps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if so it might be worth linking those PRs in the description for this one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no - the app I've been having problems with did not actually require ostruct at all. This meant it suddenly broke when another one of it's dependencies stopped requiring it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't cause issues for it to be additionally required in any other app though!

Copy link
Contributor

@JonathanHallam JonathanHallam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks :)

@csutter csutter merged commit b08a32b into main May 23, 2024
17 checks passed
@csutter csutter deleted the ostruct branch May 23, 2024 10:23
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