Skip to content

Exit strategy for vendor/opal-oga + vendor/opal-ruby-ll: upstream the Opal lexer, scope forks to the Opal leg, no new C #835

Closed

Description

@ronaldtse

What the vendored forks actually are

vendor/opal-oga / vendor/opal-ruby-ll are lutaml-maintained Opal-compatibility forks of oga and ruby-ll: upstream oga's lexer is the liboga C extension, which cannot load under Opal (Ruby→JS). The forks add a pure-Ruby lexer (ext/pureruby/oga/native/lexer.rb) and an RUBY_PLATFORM == 'opal' conditional in lib/oga.rb; under MRI the conditional falls through to the C extension — which is why CI compiles C for dev-only pins (#832).

The problem

  • We carry two full parser forks to support one runtime (Opal), and pay C-compilation cost in every MRI CI leg for code that is upstream's, not ours.
  • The strategic native direction is Rust (leptris family crate, leptris-ruby#294; parsanol-ruby as the pipeline reference). The C fork is not part of that future — but the pure-Ruby Opal lexer is not replaceable by Rust either: native extensions do not run under Opal/JS. The fork is a compatibility shim, and its exit is upstreaming, not rewriting.

Exit strategy

  1. Upstream the Opal compatibility to yorickpeterse/oga (the patch is small and mechanical: pure-Ruby lexer file + platform conditional — originated in plurimath/oga, carried since). Once released upstream, delete both forks and bundle add oga normally.
  2. Scope the forks to the Opal leg: MRI CI tests against released oga; only opal.yml uses the forks — this removes the windows-head compile red on every PR (Vendored C-fork compile reds every PR on windows-ruby-head — stop compiling dev-only pins on head #832) without waiting for upstream.
  3. Long term: if leptris/wasm ever reaches Opal-ruby (parsanol carries a wasm.yml.disabled — the pattern exists), the pure-Ruby lexer could itself be replaced; until then it is the only parser Opal can run.

Non-goal

Rewriting the lexer in Rust. Under Opal it cannot load; under MRI, oga is a fallback adapter behind moxml's leptris preference. New native code is Rust by policy (#831) — the fork is legacy tolerance with a retirement plan, not an investment.

Activity

  1. ronaldtse commented on Sep 28, 2026

    @ronaldtse
    ContributorAuthor

    This is a bad take. We do not need to use Oga or ruby-ll here. Closing.

  2. ronaldtse commented on Sep 28, 2026

    @ronaldtse
    ContributorAuthor

    Status update: the upstream half of this strategy is withdrawn permanently — the oga maintainer closed the attempt and blocked the account, and per the project's standing rule nothing will ever be sent upstream again. The work stays in our own fork: lutaml/oga carries the validated pure-Ruby lexer (1,628 examples green under OGA_PURERUBY=1) and serves the Opal leg; vendor/opal-oga and vendor/opal-ruby-ll remain scoped to that leg with no new C. The remaining actionable item is fork hygiene only; the exit strategy as originally written (upstream acceptance) is not viable.

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