A Ruby gem that provides a CLI between MESA (Modules for Experiments in Stellar Astrophysics) and the MESATestHub Rails web app. Users run the MESA test suite locally and the gem submits commit + per-test-case results back to the hub.
Author: William Wolf (wolfwm@uwec.edu). License MIT. Homepage: https://github.com/MESAHub/mesa_test.
This is an intentionally minimal gem — no Bundler scaffolding, no Rakefile, no spec/, no test/. The whole gem is two files:
- bin/mesa_test — Thor CLI. Defines the
MesaTest < Thorclass and its subcommands. - lib/mesa_test.rb — All library code in a single file.
- mesa_test.gemspec — Lists
lib/mesa_test.rbas the only library file. If you add new library files you must also list them here.
Runtime dependencies (from gemspec): thor ~> 1.3.0, json ~> 2.0, os ~> 1.0. Ruby >= 2.0.0.
MesaTestSubmitter— Owns the user/computer config (~/.mesa_test/config.yml) and all HTTP submission logic. Thesetupwizard prompts for credentials, mirror/work paths, and platform info.submit_commit,submit_instance, andsubmit_*_logare the actual network calls.Mesa— Wraps a MESA checkout. Knows how tocheckout,clean,install, and iterate test cases. Uses a mirror + worktree pattern: a bare-ish mirror clone lives atmesa_mirror, andgit worktree addmaterializes amesa_workdirectory at a given SHA so repeated checkouts don't re-download history. Requiresgit-lfs.MesaTestCase— A single test case inside one of the three modules::star,:binary,:astero(seeMesaTestCase.modules). Test results are read from atesthub.ymlfile MESA writes into the test-case directory after a run.
CLI commands (all defined in bin/mesa_test): test, submit, checkout, install, install_and_test, setup, search, count. Run mesa_test help <cmd> for details. search and count are read-only query commands that hit the testhub's search API and emit raw JSON to stdout (suitable for jq pipelines).
Two different servers are involved:
- MESATestHub — JSON API. URI selected by
MesaTestSubmitter::DEFAULT_URI=https://testhub.mesastar.org. Two auth styles, both plaintext:- Submission flow —
POST /check_computer.json,POST /submissions/create.json. Auth via asubmitterobject (email+password+computer+platform_version) in the JSON request body, alongside commit/instance payload. - Search flow —
GET /test_instances/search.json,GET /test_instances/search_count.json. Auth viaemailandpasswordquery parameters (HTTPS-only); the search itself rides inquery_text. Successful responses are{"results": [...], "failures": [...]}wherefailureslists query clauses the server's parser rejected. Always surfacefailuresto the user — a typo in a key silently drops the clause, so the CLI echoes it to STDERR. Bad creds come back as HTTP 422 with{"error":"Invalid e-mail or password."}.
- Submission flow —
- Logs server —
https://mesa-logs.flatironinstitute.org/uploads. Receives base64-encodedbuild.log,mk.txt,out.txt,err.txtfrom failing builds/tests. Auth viaX-Api-Keyheader usinglogs_tokenfrom config (contact Philip Mocz for a key). URL is hardcoded inMesaTestSubmitter#submit_logs.
bin/mesa_test:7 has a top-level constant:
MODE = :production:production—require 'mesa_test'(the installed gem) and submit toDEFAULT_URI.:staging— load../lib/mesa_testfrom this checkout and submit tohttps://beta-testhub.herokuapp.com.:development— load local lib and submit tohttp://localhost:3000.
Always confirm MODE = :production before building/pushing the gem. Switching it is the standard dev workflow but is easy to forget.
There is no Rakefile or CI. To cut a release:
- Bump
s.versionands.datein mesa_test.gemspec. - Ensure
MODE = :productionin bin/mesa_test. gem build mesa_test.gemspec→ producesmesa_test-X.Y.Z.gem.gem push mesa_test-X.Y.Z.gemto publish to RubyGems.- Commit and tag.
The built .gem is sometimes checked in alongside the gemspec (see mesa_test-1.1.12.gem), but this isn't strictly required.
There is no automated test suite. Validation is manual: flip MODE to :development or :staging, point at a local MESATestHub, and exercise the CLI against a real MESA checkout. Don't add fake unit tests just because they're conventional — the value here is end-to-end against an actual MESA install and testhub instance.
- The library uses bare
bash_execute/bashtickshelpers (bottom of lib/mesa_test.rb) to force commands throughbash -c, because MESA's build scripts assume bash. Mesa#with_mesa_dirtemporarily mutatesENV['MESA_DIR']around a block and restores it — this is how the gem isolates MESA installs from the user's ownMESA_DIR.- Config is YAML at
~/.mesa_test/config.yml(note the directory, not a dotfile in$HOMEdirectly).MesaTestSubmitter::new_from_configruns the setup wizard automatically if the file is missing. - Passwords and the logs API token are stored in plaintext in the config file. This is documented to the user in the setup wizard; don't try to "fix" it without a real plan for credential storage.
- GitHub access protocol (
:sshvs:https) is per-user config and affects how the mirror is cloned.