Skip to content

ci: cover a build without MRB_UTF8_STRING - #7138

Merged
matz merged 1 commit into
mruby:masterfrom
takumin:ci-default-gembox-build
Aug 14, 2026
Merged

ci: cover a build without MRB_UTF8_STRING#7138
matz merged 1 commit into
mruby:masterfrom
takumin:ci-default-gembox-build

Conversation

@takumin

@takumin takumin commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Problem

Every build in CI takes the full-core gembox: the three in
build_config/ci/gcc-clang.rb and the one in build_config/ci/msvc.rb.
full-core pulls in mruby-encoding, and that gem is what defines
MRB_UTF8_STRING:

# mrbgems/mruby-encoding/mrbgem.rake
spec.build.defines << "MRB_UTF8_STRING"

So CI has never built a mruby whose strings index by byte, and the tests
written as the byte-indexed mirror of the UTF-8 ones have never run.
String#scrub no-op on non-UTF-8 build guards itself with
skip if "あ".length == 1 and skipped on every job in the matrix. The
byte-counting halves of mruby-regexp and mruby-string-ext went the same
way.

Both gems assume that build exists. mruby-string-ext:

UTF-8 coverage comes from full-core builds (mruby-encoding defines
MRB_UTF8_STRING); the mirror runs on gemboxes without it.

and mruby-regexp, on why it sets MRB_UTF8_SCAN:

mruby-encoding is what does, and the default gembox carries this gem
without it.

Nothing in CI builds the default gembox. The Cosmopolitan job comes
closest, taking the stdlib gemboxes with no mruby-encoding, but
build_config/cosmopolitan.rb enables neither enable_test nor
enable_bintest, so rake test:run:serial builds no mrbtest for it and
runs no test there.

Change

A fourth build in build_config/ci/gcc-clang.rb on the default gembox.

It rides the existing matrix rather than taking a job of its own, the
way the MRB_REGEXP_UNICODE_CASE coverage on full-debug does, so it
costs no runner and gets checked on Linux, macOS and mingw, under gcc
and clang, on ARM64 and on the one runner where char is unsigned. It
enables tests only: the binaries the default gembox adds are the ones
the bintest on the build above already covers.

Verification

rake -m test:run:serial MRUBY_CONFIG=ci/gcc-clang from a clean build
directory, on Linux with gcc:

build gembox total KO skip warning
full-debug full-core 2268 0 2 0
host full-core 2269 (+116 bintest) 0 10 0
cxx_abi full-core 2269 0 10 0
default default 2067 0 23 4

The new build passes as it stands, so this adds coverage without
uncovering a failure.

Cost

The new build comes to 270 compilation units against the 883 the three
existing ones come to together, so it adds about a third to the compile
work of every job in the GCC-CLANG matrix.

Job durations over the last eight master runs of this workflow, as a
reference point rather than a prediction, since runners vary:

job min avg max
windows-2025-mingw-gcc 5m08s 5m23s 6m07s
windows-2022-mingw-gcc 4m35s 4m51s 5m17s
ubuntu-24.04-gcc 1m33s 2m06s 2m24s
ubuntu-22.04-clang 1m43s 2m00s 2m05s
ubuntu-22.04-gcc 1m42s 1m58s 2m13s
ubuntu-24.04-clang 1m27s 1m54s 2m05s
macos-26-clang 1m26s 1m51s 2m12s
ubuntu-24.04-arm-gcc 1m47s 1m50s 1m54s
macos-15-clang 1m33s 1m44s 2m02s

A third more compile work on the worst mingw run seen there comes out
near eight minutes, inside the 10 minute timeout, and that scaling is
pessimistic because a job's checkout and setup do not grow with the
build. Everything outside mingw sits under three minutes either way.
timeout-minutes: 10 is left alone, but mingw is where the margin is
thinnest, so raising it is a one line change if you would rather have
the room.

Note on the four warnings

The new build reports 4 "no assertion" warnings, all in
mrbgems/mruby-string-ext/test/string.rb, where a test wraps its whole
body in if UTF8STRING and so runs empty when strings index by byte:

  • String#inspect of a binary string escapes every byte
  • String#chop! on a binary string removes one byte
  • String#rindex on a binary string counts bytes
  • a needle that spells no character is found nowhere

They are warnings rather than failures, and CI stays green. The rest of
that file writes the same condition as end if UTF8STRING, which
reports nothing. A separate PR will bring those four into that form.

Summary by CodeRabbit

  • Tests
    • Added CI coverage using the default environment without UTF-8 string support.
    • Added validation for byte-indexed behavior.
    • Binary tests remain excluded from this build.

@takumin
takumin requested a review from matz as a code owner August 13, 2026 16:32
@github-actions github-actions Bot added the build label Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 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: 89197d48-f4c3-432b-8c53-33639a4d2ad8

📥 Commits

Reviewing files that changed from the base of the PR and between efb8467 and 5fe6a01.

📒 Files selected for processing (1)
  • build_config/ci/gcc-clang.rb
🚧 Files skipped from review as they are similar to previous changes (1)
  • build_config/ci/gcc-clang.rb

📝 Walkthrough

Walkthrough

The CI configuration adds a default-gembox build. It runs byte-indexed string and regexp tests without UTF-8 string support. Binary tests remain disabled.

Changes

CI coverage

Layer / File(s) Summary
Default gembox build
build_config/ci/gcc-clang.rb
Adds a default-gembox build that runs the default test suite and covers byte-indexed string and regexp behavior without enabling binary tests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 5fe6a

This adds a CI build for the default gembox to cover byte-indexed strings. It increases CI work and leaves less timeout margin on mingw, but the reported builds pass and no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

  • mruby/mruby#7115: Adds byte-indexed regexp behavior covered by the new CI build.
  • mruby/mruby#7116: Adds byte-indexed regexp behavior exercised by the new CI build.
  • mruby/mruby#7120: Updates byte-indexed regexp cases that the new CI build runs.

Suggested reviewers: matz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the added CI coverage for builds without MRB_UTF8_STRING.
✨ 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.

Every build CI runs takes the full-core gembox. full-core carries
mruby-encoding, and that gem is what defines `MRB_UTF8_STRING`, so no
job in the matrix builds a mruby whose strings index by byte.

The tests written as the byte-indexed mirror of the UTF-8 ones therefore
never ran. `String#scrub no-op on non-UTF-8 build` skipped itself on
every build, and so did the byte-counting halves of mruby-regexp and
mruby-string-ext. Both gems name that missing build in their
mrbgem.rake: mruby-string-ext says UTF-8 coverage comes from full-core
while "the mirror runs on gemboxes without it", and mruby-regexp sets
MRB_UTF8_SCAN because "the default gembox carries this gem without"
mruby-encoding. Nothing built the default gembox.

The cosmopolitan job does take a gembox without mruby-encoding, but its
build config enables neither `enable_test` nor `enable_bintest`, so
`rake test:run:serial` builds no mrbtest for it and runs no test there.

Add a fourth build on the default gembox to the CI build config. It
rides the existing matrix instead of taking a job of its own, so it
costs no runner and gets checked on Linux, macOS and mingw, under gcc
and clang, on ARM64 and on the one runner where `char` is unsigned. It
enables tests only, because the binaries the default gembox adds are the
ones the bintest on the build above already covers.

The build adds 270 compilation units to the 883 the three existing ones
come to. Over the last eight master runs of the workflow the slowest job
in the matrix, windows mingw-gcc, took between 5m08s and 6m07s and every
other job finished inside three minutes, so a third more compile work
leaves `timeout-minutes: 10` as it is.
@takumin
takumin force-pushed the ci-default-gembox-build branch from efb8467 to 5fe6a01 Compare August 13, 2026 16:39
@matz
matz merged commit 9ff0255 into mruby:master Aug 14, 2026
21 checks passed
@takumin
takumin deleted the ci-default-gembox-build branch August 14, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants