feat: Opal boot file and boot-file verification - #27
Merged
Conversation
3 tasks
Adds lib/unitsdb/opal.rb, a single eager-require entry point that consumers (unitsml-ruby, plurimath-js) can pass to Opal via `-r unitsdb/opal` to pull in every autoloadable unitsdb entry point without hand-listing files. Under Opal, Ruby's autoload does not lazy-execute, so consumers need this canonical entry point. Adds spec/unitsdb/unitsdb_opal_boot_spec.rb which statically verifies that the boot file: - eager-requires every unitsdb/*.rb file that lib/unitsdb.rb exposes - skips the Opal-gated Cli/Commands entry points - only references files that exist on disk - actually compiles under Opal::Builder with the native-only lutaml/model dependency stubbed (the gem's consumer is responsible for providing a working lutaml-model bundle at runtime. Adds .github/workflows/opal.yml which runs the boot-file spec on every push and pull_request. Adds opal (~> 1.8) to the Gemfile as a development dependency for the boot-file compile check. The gem itself does not run under Opal at runtime in this PR — that is plurimath-js's responsibility at bundle time. This PR establishes the contract: a single entry point and a CI check that it is well-formed. EOF )
ronaldtse
force-pushed
the
feat/opal-specs-and-workflow
branch
from
June 27, 2026 15:31
da64084 to
47ed3bc
Compare
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.
Summary
Adds the canonical Opal entry point for unitsdb and a CI check that verifies it stays well-formed.
lib/unitsdb/opal.rb: a single eager-require file that consumers (unitsml-ruby, plurimath-js) pass to Opal via-r unitsdb/opal. Under Opal, Ruby's autoload does not lazy-execute, so consumers need this canonical entry point rather than hand-listing files.spec/unitsdb/unitsdb_opal_boot_spec.rb: a static MRI-run spec that verifies:unitsdb/*.rbfile thatlib/unitsdb.rbexposes.cli,commands).Opal::Builderwith the native-onlylutaml/modeldependency stubbed (the gem's consumer is responsible for providing a workinglutaml-modelbundle at runtime)..github/workflows/opal.ymlto run the spec on every push and pull_request.opal (~> 1.8)to the Gemfile as a development dependency for the compile check.Scope boundary
This PR establishes the contract between unitsdb-ruby and its Opal consumers — a single entry point and a CI check that it is well-formed. It does not make unitsdb-ruby itself run under Opal at runtime, because:
Lutaml::Model::Serializablefor every model class, so runtime Opal execution requireslutaml-modelto work under Opal (separate concern, owned bylutaml-modeland plurimath-js's bundle).Test plan
bundle exec rspec spec/unitsdb/unitsdb_opal_boot_spec.rb— 4 examples, 0 failures locally.bundle exec rake— 810 examples, 0 failures (no regression).bundle exec rubocop— clean.