Skip to content

ci: read the byte-indexed side on full-core minus mruby-encoding - #7155

Merged
matz merged 3 commits into
mruby:masterfrom
takumin:ci-byte-string-build
Aug 14, 2026
Merged

ci: read the byte-indexed side on full-core minus mruby-encoding#7155
matz merged 3 commits into
mruby:masterfrom
takumin:ci-byte-string-build

Conversation

@takumin

@takumin takumin commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Stacked on #7154, whose two commits this branch carries. Only the last commit is new here.

The fourth build in ci/gcc-clang exists so that the tests written as the byte indexed mirror of the UTF-8 ones run somewhere: String#scrub degrading to a no-op, the byte counting halves of mruby-regexp and mruby-string-ext. It reached that by taking the default gembox, which is the smaller box that happens not to carry mruby-encoding. What it wants is the gem gone, not a smaller box, and with #7154 it can say so.

conf.gembox 'full-core'
conf.gems.delete 'mruby-encoding'

This is the configuration you built in #7142 when you showed that a byte indexed full-core build is available today. It answers the same way:

$ build/byte-string/bin/mruby -e 'p "あ".length, "あ"[0], defined?(Encoding), defined?(Struct), defined?(Rational), defined?(Regexp)'
3
"\xe3"
nil
"constant"
"constant"
"constant"

What it changes

default gembox full-core minus mruby-encoding
Total 2066 2220
Skip 26 26
KO 0 0

154 more tests at the same skip count. Nine gems come under byte indexed test that were not: mruby-benchmark, mruby-bin-mrb, mruby-cmath, mruby-exit, mruby-os-memsize, mruby-strftime, mruby-string-bitops, mruby-task, mruby-test-inline-struct. The one gem the default gembox had and full-core does not is mruby-bin-debugger, which the bintest build in this file already adds by name, so no gem loses a build.

The build is renamed byte-string after what it reads, since it is no longer the default gembox.

What it costs

No CI build loads mrbgems/default.gembox after this. The five boxes it nests are still loaded, by the Cosmopolitan job, which names stdlib, stdlib-ext, stdlib-io, math and metaprog directly; what loses coverage is the six lines of the wrapper.

#7138 added this build for the byte indexed tests rather than for the gembox, and before it no CI build read default.gembox either, so this is a return to that rather than a new gap. Still, it is a real one, and if you would rather keep a build on the box I can add it back as a fifth rather than trade it.

Tests

MRUBY_CONFIG=ci/gcc-clang rake -m test, all four builds and the bintests, KO 0:

byte-string   Total 2220   Skip 26
full-debug    Total 2280   Skip 2
bintest       Total 2281   Skip 10   + 116 bintests
cxx_abi       Total 2281   Skip 10

No can't be removed warning is printed. mruby-regexp and mruby-sprintf declare mruby-encoding as a test dependency only when it is present, and that guard is read after the removal.

Summary by CodeRabbit

  • New Features
    • Added gem list management options to remove specific gems or filter gems by criteria.
    • Dependency resolution now warns when a removed gem must be restored to satisfy another gem.
  • Documentation
    • Expanded GemBox configuration guidance, including gem removal syntax, ordering, error handling, filtering behavior, and dependency limitations.
  • Build Improvements
    • Updated the default test configuration to validate byte-oriented string behavior using the full core configuration.

`MRuby::Gem::List` had `[]` and `<<` but no way to remove, so a build
config that wanted a gembox minus one gem had to restate the box.
`build_config/i586-pc-msdosdjgpp.rb` does exactly that: twelve lines
hand-expanding `default.gembox`, each carrying a comment naming the box
the line came from, so that `mruby-socket` can be left out.

`conf.gems.reject!` was the natural reach for this and raised
NoMethodError; `conf.gems.reject` inherits from Enumerable, returns a new
Array and drops it, so the removal reads as if it worked and does
nothing.

Add `List#delete`, which names the gem, and `List#reject!`, which takes a
predicate. Both run while the build config is being read, before any
`Specification#setup`, so a removed gem contributes nothing: not its
objects, and not the defines its `mrbgem.rake` sets on the build.
Measured on `full-core` minus `mruby-encoding`: 57 gems instead of 58,
and `MRB_UTF8_STRING` and `HAVE_MRUBY_ENCODING_GEM` both absent.

`delete` fails when the name is not in the build rather than returning
nil, following `Can't find gembox` and `Invalid gem name` elsewhere in
the build system. A misspelled name is a typo, and a build that silently
keeps the gem is the failure this method exists to remove. `reject!`
keeps Array semantics and returns nil when it matches nothing, since a
predicate matching nothing is not a mistake.
`List#delete` runs while the build config is read, and dependencies are
declared later, in `Specification#setup`. So a gem cannot be checked
against them at the moment it is removed, and one that another gem in
the build depends on is loaded again by `setup_dependencies` a phase
later. `conf.gems.delete 'mruby-string-ext'` on `full-core` ends with
the same 58 gems it started with, and says nothing.

Keeping the gem is right, since `mruby-regexp` cannot be built without
it. Staying quiet is not: the build config asked for something and got
the opposite, which is the shape of failure `delete` was added to
remove.

Record what was removed and say so when it comes back, naming the gem
that requires it:

    gem 'mruby-string-ext' can't be removed; mruby-regexp depends on it

23 gems in a `full-core` build with tests enabled are reachable this
way, 17 without, the difference being `add_test_dependency`, which is
`add_dependency` under `test_enabled? || bintest_enabled?`.
`mruby-encoding` is in the larger list but is still removable, because
`mruby-regexp` and `mruby-sprintf` guard that dependency on the gem
being present and the guard is read after the removal.
The fourth build in `ci/gcc-clang` exists so that the tests written as
the byte-indexed mirror of the UTF-8 ones run somewhere. It reached that
by taking the default gembox, which is the smaller box that happens not
to carry `mruby-encoding`. What it wants is the gem gone, not a smaller
box, and `conf.gems.delete` says that.

On `full-core` minus `mruby-encoding`: 2220 tests instead of 2066, the
same 26 skips, and 9 more gems under test (`mruby-benchmark`,
`mruby-bin-mrb`, `mruby-cmath`, `mruby-exit`, `mruby-os-memsize`,
`mruby-strftime`, `mruby-string-bitops`, `mruby-task`,
`mruby-test-inline-struct`). The one gem the default gembox had and
`full-core` does not is `mruby-bin-debugger`, which the `bintest` build
in this file already adds by name.

The build is renamed `byte-string` after what it reads, since it is no
longer the default gembox. It answers as a byte-indexed build should:

    $ build/byte-string/bin/mruby -e 'p "あ".length, "あ"[0], defined?(Encoding)'
    3
    "\xe3"
    nil

No CI build loads `mrbgems/default.gembox` after this. The five boxes it
nests are still loaded by the Cosmopolitan job, which names them
directly; what loses coverage is the six lines of the wrapper.
@takumin
takumin requested a review from matz as a code owner August 14, 2026 06:27
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d4a8277d-ae12-4b7e-8613-81c431529b2c

📥 Commits

Reviewing files that changed from the base of the PR and between 84a4186 and d6fab73.

📒 Files selected for processing (3)
  • build_config/ci/gcc-clang.rb
  • doc/guides/compile.md
  • lib/mruby/gem.rb

📝 Walkthrough

Walkthrough

The Gem list now supports explicit removal with dependency re-addition warnings. Compile documentation describes removal rules. The CI configuration adds a byte-string build based on full-core while excluding mruby-encoding.

Changes

Gem removal and byte-string build configuration

Layer / File(s) Summary
Gem removal APIs and dependency resolution
lib/mruby/gem.rb, doc/guides/compile.md
MRuby::Gem::List tracks removed Gems and adds delete and reject!. Dependency resolution records the requiring Gem and warns before re-adding removed dependencies. The compile guide documents removal behavior and constraints.
Byte-string CI build configuration
build_config/ci/gcc-clang.rb
The default build becomes byte-string, uses the full-core gembox, and removes mruby-encoding while retaining tests and byte-indexed string behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to d6fab

The PR expands byte-indexed CI coverage by using full-core without mruby-encoding, with the reported builds completing with zero failures; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant CompileConfig
  participant GemList
  participant DependencyResolution
  CompileConfig->>GemList: delete a named Gem
  GemList-->>CompileConfig: remove the Gem or raise an error
  DependencyResolution->>GemList: resolve dependencies
  GemList-->>DependencyResolution: provide requiring Gem metadata
  DependencyResolution-->>GemList: warn and re-add a removed dependency
Loading

Possibly related PRs

  • mruby/mruby#7120: Changes byte-string CI coverage and related build behavior.
  • mruby/mruby#7132: Addresses encoding-dependent behavior affected by removing mruby-encoding.
  • mruby/mruby#7138: Updates the same CI build configuration for byte-string behavior.

Suggested labels: core, build

Suggested reviewers: matz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main CI change: using full-core without mruby-encoding for byte-indexed testing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants