Make timex an optional dependency - #75
Closed
swarupsengupta wants to merge 1 commit into
Closed
Conversation
`Surgex.DateTime` is the only module that uses Timex, and it is already guarded by `if Code.ensure_loaded?(Timex)`, so the library compiles and works without it. Making the dependency optional stops it being forced on every consumer. Two reasons this matters beyond tidiness: - **timex is on the org's banned-libs list.** surgex currently propagates it transitively into every consuming service, where it shows up as a banned-libs advisory the consumer cannot fix. - **timex caps `gettext` at `~> 0.26`**, which blocks consumers from moving to gettext 1.x. Verified on app-inventory: with this change timex leaves the lock entirely (0 entries) and gettext resolves to 1.0.2, where before it was pinned below 1.0. Consumers that use `Surgex.DateTime` keep working by declaring `:timex` themselves — the same contract as any optional dependency. Tests: 2 doctests, 207 tests, 0 failures. Timex is still fetched for surgex's own build, so the `Surgex.DateTime` tests continue to run.
Author
|
@ai review |
|
Please don't use my user name for LLM commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surgex.DateTimeis the only module that touches Timex, and it is already guarded:So the library already compiles and works without it. Making the dependency
optional: truestops it being forced on every consumer.Why this matters beyond tidiness
timexis on the org's banned-libs list. surgex currently propagates it transitively into every consuming service, where ditto reports it as a banned-libs advisory the consumer has no way to fix — the dependency isn't theirs.timexcapsgettextat~> 0.26, blocking consumers from gettext 1.x. Even the latest timex (3.7.13) still requires~> 0.26, so there's no version that resolves it.Verified against app-inventory by pointing it at this branch:
timexentries inmix.lockgettextCompatibility
Consumers that use
Surgex.DateTimekeep working by declaring{:timex, "~> 3.7"}themselves — the standard optional-dependency contract. Consumers that don't (the common case — it's one small date/time helper) simply stop carrying it.Verification
mix test— 2 doctests, 207 tests, 0 failures. Timex is still fetched for surgex's own build, sinceoptional: trueonly affects consumers, so theSurgex.DateTimetests continue to exercise the real Timex path.🤖 Generated with Claude Code