Skip to content

Remove stale ox dependency (unused in code; hijacks moxml adapter auto-detection) #74

Description

@ronaldtse

Summary

unitsml.gemspec declares spec.add_dependency "ox", but no code in lib/ references Ox at all (no require "ox", no Ox. constant use) — the dependency appears to be stale from before the moxml/lutaml-model migration.

Why this matters beyond hygiene

The stale dependency has an active side effect through moxml's adapter auto-detection. Moxml::Config.detect_loaded_adapter prefers :ox whenever the Ox constant is defined:

def detect_loaded_adapter
  return :nokogiri if Object.const_defined?(:Nokogiri)
  return :ox if Object.const_defined?(:Ox)   # <- any loaded ox gem hijacks this
  return :oga if Object.const_defined?(:Oga)
  nil
end

Because unitsml drags ox into every consumer's bundle (and sibling gems like plurimath load it), all moxml consumers in the process — unitsml's own lutaml-model serialization included — silently run on the ox adapter even when the application never chose ox.

On TruffleRuby, ox is currently a crash hazard under sustained cext load (non-deterministic "dead handle" failures, truffleruby#4454), which we hit packaging Metanorma with tebako. Removing the unused dependency lets applications pick their XML backend deliberately (e.g. leptris via moxml ≥ 0.5, or nokogiri) instead of having ox forced on them by a gem that never calls it.

Proposed change

Remove spec.add_dependency "ox" from the gemspec (no code change needed — nothing references it). Happy to send the one-line PR if you agree.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions