Skip to content

WEB-8121: depend on diff-lcs so that we can share the global namespace#35

Merged
dcaddell merged 2 commits intomasterfrom
WEB-8121_share_global_namespace_with_diff-lcs
Mar 27, 2025
Merged

WEB-8121: depend on diff-lcs so that we can share the global namespace#35
dcaddell merged 2 commits intomasterfrom
WEB-8121_share_global_namespace_with_diff-lcs

Conversation

@dcaddell
Copy link
Contributor

[0.6.1]

Fixed

  • Fixed a global namespace collision with diff-lcs over the Diff constant

Added

  • Loading invoca/utils/diff now gives access to both invoca-utils and diff-lcs diff helpers

Demo

Tested this change locally with the call_artifact_push repo

--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,10 @@
+PATH
+  remote: ../invoca-utils
+  specs:
+    invoca-utils (0.6.0)
+      activesupport (>= 6.0)
+      diff-lcs (>= 1.6.1)
+
 PATH
   remote: .
   specs:
@@ -167,7 +174,7 @@ GEM
-    diff-lcs (1.5.1)
+    diff-lcs (1.6.1)

> bundle exec rspec
/Users/dcaddell/invoca/invoca-utils/lib/invoca/utils.rb:23: warning: already initialized constant Diff
/Users/dcaddell/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0/gems/diff-lcs-1.6.1/lib/diff/lcs.rb:3: warning: previous definition of Diff was here
.........................................................................................................................................................................................................................................................................................................................................

Finished in 1.83 seconds (files took 2.61 seconds to load)
329 examples, 0 failures

Coverage report generated for RSpec to /Users/dcaddell/invoca/call_artifact_push/spec/results/coverage/coverage.json. 1120 / 1145 LOC (97.82%) covered.
Coverage report generated for RSpec to /Users/dcaddell/invoca/call_artifact_push/spec/results/coverage. 1120 / 1145 LOC (97.82%) covered.

@dcaddell dcaddell requested a review from a team as a code owner March 27, 2025 15:09
@dcaddell dcaddell requested a review from jebentier March 27, 2025 15:09
unless defined?(Diff)
Diff = Invoca::Utils::Diff
end
Diff = Invoca::Utils::Diff
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has the side-effect of adding a "previously initialized constant" warning to the logs whenever invoca-utils is loaded. See the demo for an example. Is that amount of noise a deal breaker?

Copy link
Contributor

@jebentier jebentier left a comment

Choose a reason for hiding this comment

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

Nice! Looks good!

@dcaddell dcaddell merged commit b806e94 into master Mar 27, 2025
21 checks passed
@dcaddell dcaddell deleted the WEB-8121_share_global_namespace_with_diff-lcs branch March 27, 2025 17:36
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