Repository navigation
Design memo: what CI checks of the ISeq VM, and four checks it lacks - #232
Conversation
No code and no change to CI. The corpus already runs on the VM in CI; what is not checked is a program that stops running on the VM (a fallback), the VM forced (vm_check), the two compilers against each other and against ruby, and CRuby's own tests on the VM. Each with its measured cost.
284km
left a comment
There was a problem hiding this comment.
Reviewed current head 82e81c2c against current main 6d39c773. Two documentation corrections are inline: the CI reference-Ruby invocation and the account of earlier VM validation.
The reviewed fallback list, including removal of obsolete entries, and the proposed per-test evaluator/VM comparison are useful ways to expose coverage loss. The current corpus checks and the 873-program / 245-VM-snippet / 460-compiler-snippet inventories agree with the memo.
Validation: inspected the complete memo, current workflows, the referenced harnesses and historical LOOP records; confirmed that runtime, build, dependency and workflow inputs are byte-identical to main; git diff --check passed. A missing-reference control for vm_check exited 1 before generating any real snippets, reproducing the startup problem described inline. This control did not execute the VM, and no full runtime suite or performance measurement was repeated for this documentation-only change.
Hosted CI remains incomplete, with running and queued jobs and downstream coverage still pending. No merge performed: the recorded hold_all_merges / new_failure_review_required remains active. The other open mere-ruby PRs (#224 and #228) are drafts; merelang/mere has no open PRs. This review does not clear historical resource failures or claim that pending CI passed.
Event: COMMENT because the authenticated account is the PR author.
|
|
||
| ### 2. vm_check in the corpus job | ||
|
|
||
| One step: `sh tools/iseq/vm_check.sh`. 1 min 21 s. It needs nothing the job does not have. |
There was a problem hiding this comment.
[Major] [P2] Pass the CI reference Ruby to this command. vm_check.sh defaults RUBY to $HOME/.rbenv/versions/4.0.10/bin/ruby; unlike vm_corpus.sh, it does not source tools/ref_ruby.sh. The corpus job installs Ruby through ruby/setup-ruby and does not export RUBY or create that rbenv path. Consequently, copying this proposed one-step command into that job fails during snippet generation instead of checking the VM. Please document . ./tools/ref_ruby.sh followed by RUBY="$REF_RUBY_BIN" sh tools/iseq/vm_check.sh, or include updating the script to use the repository reference selector as a prerequisite.
|
|
||
| The largest, and the one that decides whether the default can change. | ||
|
|
||
| - **What exists**: by hand, test/ruby's 142 files were run on both executions on 2026-11-17 (note 552, section 15): VM 9,532 passing tests, evaluator 9,545, the difference a leak check and a time limit. Since then the comparison has been made for the files a round touched (seven to fourteen a round). No test failed on the VM alone until round 62 (#231), where one did: a test whose file had been falling back whole. |
There was a problem hiding this comment.
[Minor] [P3] Reconcile this history with the earlier full VM CI run. LOOP.md, section "2026-11-19 (87): the VM as the default, measured over the whole suite", already records run 44295654770 on vm-default-r44, covering 758 files. It specifically records a VM-only wrong answer in TestKeyword#test_kwrest_overwritten, its fix, and VM-sensitive timeouts. This contradicts both the implication that only selected-file comparisons happened after November 17 and the statement that no test failed on the VM alone before round 62. Please include that whole-suite comparison and its limitations, and scope the no-new-failures claim to the actual later interval if that is what was intended. That history matters when deciding what evidence is still needed before changing the default.
A design memo only: no code and no change to CI. It answers the request for a note on CI checks of the VM before the VM is made the default (note 558, item 1). The first finding is that CI already runs the corpus on the VM; the memo is about the four checks it lacks, what each costs (measured), and what each would have caught. Each proposal would be a PR to
.github/workflows/ci.yml, for the owner to decide.The memo is
loop/2026-11-25-stage10-vm-ci-design.md; what follows is it.A memo, with no change to the code or to CI. It is for the decision on making the VM the default execution (note 558, item 1): which checks should be in CI before that, what each costs, and what each would have caught. Each proposal below changes
.github/workflows/ci.yml, so each is a PR of its own for the owner to read.What CI checks today
The corpus job (macOS) and the Linux job both run
tools/iseq/vm_corpus.sh: every corpus program under MERE_RUBY_VM=1, its output and exit status compared with ruby's. A program that differs fails the job.That is the whole of it. A program the VM declines runs on the evaluator, matches ruby, and is counted as a fallback and passed.
What that leaves open
1. A program that stops running on the VM. A change that makes the native compiler or the loader decline something it took yesterday turns programs into fallbacks, and the job stays green. The number is printed and nobody is asked to read it. The same is so of a required file:
vm_corpus.shasks only of the main script.2. The VM forced.
tools/iseq/vm_check.shruns 245 snippets throughRubyVM::InstructionSequence#evalwith the VM forced, and compares each byte with ruby. Forced means a refusal is a failure, so it is the one check where "the VM does not take this" is red. It is not in CI.3. The two compilers against each other.
tools/iseq/native/check.shcompiles a file with the native compiler and with the Ruby one, and compares the two trees as text. The native compiler is the one that runs; the Ruby one is the one whose output was compared with ruby's own#to_a(tools/iseq/compare_with_ruby.rb,compare_files.rb). Neither comparison is in CI. A change toic/is checked in CI only by what the corpus happens to run.4. CRuby's own tests on the VM. The unit-test shards run on the evaluator. Nothing in CI runs a test file under MERE_RUBY_VM.
The four checks
Times are this machine's, each command run alone on main with #231, and CI's runners are slower.
1. A budget of fallbacks
vm_corpus.shfails when a program falls back that is not on a list kept in the repository.tools/iseq/vm_fallbacks.txt: one corpus program a line, with the reason asvm_corpus.shprints it. Today it would have one line: corpus 370, ashareable_constant_valuewrite of a value that is not a literal (round 62, A source in another encoding runs on the VM (round 62) #231, took it from four to one).A second part, for required files:
MERE_RUBY_VM=reportnames each file the VM declined. One more run of the corpus under=report, with the lines collected and held to a second list, would cover what a program requires. Cost: one more VM corpus run, 2 min 20 s here at four jobs. This part could wait: round 60's sweep (every corpus program run as a required file) found no required-file difference, and the main script's verdict covers most of the compiler.2. vm_check in the corpus job
One step:
sh tools/iseq/vm_check.sh. 1 min 21 s. It needs nothing the job does not have.3. The compilers' comparison
Two parts, and they differ in what they need.
tools/iseq/native/check.shover a fixed list of files (the corpus, or a sample of it, andlib/): it builds a small tool fromic/with the Mere compiler and runs the Ruby compiler on mere-ruby. 41 s for the whole corpus, 873 files: 871 the same, 0 different, 1 the native compiler declines and the Ruby one compiles, 1 neither compiles. The job already has the Mere compiler.compare_with_ruby.rbandcompare_files.rbcompare the Ruby compiler's tree with ruby's own. They run under the reference ruby, which the job has: 5 s for the whole corpus (872 the same, 1 refused), and under 1 s for the 460 snippets.Together they close the chain: ruby's
#to_a= the Ruby compiler's = the native compiler's, for the files listed.Both are cheap enough to run over the whole corpus, which is the simplest rule: no list to keep. The verdict to fail on is "different" (and "failed"); a file one of them refuses is the fallback list's business, and the native comparison's "declined by the native compiler, compiled by the Ruby one" is a second kind of fallback worth a line there: the file still runs on the VM, at many times the cost to compile.
4. Unit tests on the VM
The largest, and the one that decides whether the default can change.
So the order proposed is: the scheduled shard now, to find what is VM-only while the evaluator is still the default; the full double run only for the PR that changes the default, to show the numbers side by side once.
Order, and what each would have caught
ic/was written)1, 2 and 3 are small and independent, and could be one PR or three. 4 needs a script in
unittest/that compares each test's outcome on the two executions; so far that comparison has been made by hand.Recorded here, found while writing this
Under MERE_RUBY_VM a regexp literal with a warning was warned of twice, and a required file's regexp literal that did not compile ran anyway. Both were found by reading output by hand in rounds 60 and after (#223, #229), and neither by a check: the corpus compares stdout and the exit status, not stderr. A check of what a program writes to stderr, on both executions, is a fifth gap, and a wider one than the VM's.
🤖 Generated with Claude Code