サンプル
csv 3.3.5: Fix LoadError for csv or base64 after a Ruby upgrade, where they used to be built
検証済みサンプル — gem csv 3.3.5: Fix LoadError for csv or base64 after a Ruby upgrade, where they used to be built. ruby 3 · linux alpine/x64 · docker で contract…
sha256:8f9a1d4bba7bafae896c8862e6cc34aa3d64cb931492106f55207f395dde64bb
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 2
- ビルドした署名鍵
- 2
宣言された環境
ruby 3 linux x64 ruby 3 ruby bundler
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| ruby 3 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · gem@1 |
2026-08-14 |
| ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · gem@1 |
2026-08-17 |
ケース
FIX- ゴール
- Fix LoadError for csv or base64 after a Ruby upgrade, where they used to be built in
- パッケージ
- シンボル
-
- CSV.parse
- Base64.strict_encode64
- 環境
- ruby 3
- 作成日
- 2026-08-14T05:46:56Z
コントラクト
- declare the extracted default gems in the Gemfile
- assert requiring csv and base64 works because they are declared
- assert strict_encode64 omits the newlines encode64 inserts
- assert both now appear as resolved gems rather than builtins
ファイル
- Gemfile
- Gemfile.lock
- csx.json
- test/contract.rb
ソース
source "https://rubygems.org"
# Modern Ruby moved several stdlib libraries out of the default gem set.
# Requiring them without declaring them raises LoadError, which is the most
# common "my code broke on the new Ruby" report.
gem "csv", "3.3.5"
gem "base64", "0.3.0"
gem "minitest", "5.25.4"
GEM
remote: https://rubygems.org/
specs:
base64 (0.3.0)
csv (3.3.5)
minitest (5.25.4)
PLATFORMS
ruby
x86_64-linux-musl
DEPENDENCIES
base64 (= 0.3.0)
csv (= 3.3.5)
minitest (= 5.25.4)
CHECKSUMS
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
bundler (4.0.18) sha256=02d9a17429de1847b4e0c9f27a9ee4b20c0a74c0a641b4e77195d6019e3618ac
csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f
minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947
BUNDLED WITH
4.0.18
{"case":{"caseId":"case:sha256:ddc7e373cb2bf4c3b768cbef9d486b18dcec1b994b4ce7c82bca9a4f28abb1d9","constraints":{"runtime":"ruby"},"contract":["declare the extracted default gems in the Gemfile","assert requiring csv and base64 works because they are declared","assert strict_encode64 omits the newlines encode64 inserts","assert both now appear as resolved gems rather than builtins"],"goal":"Fix LoadError for csv or base64 after a Ruby upgrade, where they used to be built in","kind":"FIX","packages":["pkg:gem/csv@3.3.5","pkg:gem/base64@0.3.0"],"schemaVersion":1,"symbols":["CSV.parse","Base64.strict_encode64"]},"contractCommand":["bundle","exec","ruby","test/contract.rb"],"environment":{"arch":"x64","ecosystem":"gem","executionContext":"ruby","language":"ruby","os":"linux","packageManager":"bundler","runtime":"ruby","runtimeVersion":"3","schemaVersion":1},"license":"MIT-0","packages":["pkg:gem/csv@3.3.5","pkg:gem/base64@0.3.0"],"schemaVersion":1,"symbols":["CSV.parse","Base64.strict_encode64"],"verifierAdapter":"gem@1"}
require "minitest/autorun"
# The point: these used to come free with the interpreter. They are ordinary
# gems now, so this file loads only because the Gemfile declares them.
# Removing either line reproduces the LoadError an undeclared application
# hits after the upgrade.
require "csv"
require "base64"
class DefaultGemExtractionTest < Minitest::Test
def test_csv_is_available_because_it_is_declared
rows = CSV.parse("a,b\n1,2", headers: true)
assert_equal ["a", "b"], rows.headers
assert_equal "1", rows.first["a"]
end
def test_base64_round_trips_and_strict_refuses_newlines
assert_equal "codesamplex", Base64.decode64(Base64.encode64("codesamplex"))
# encode64 inserts newlines every 60 chars; strict_encode64 does not.
# Tokens built with the non-strict form are the usual breakage.
assert_equal "Y29kZXNhbXBsZXg=", Base64.strict_encode64("codesamplex")
long = "a" * 100
assert_includes Base64.encode64(long), "\n"
refute_includes Base64.strict_encode64(long), "\n"
end
def test_they_are_resolved_gems_now
assert Gem.loaded_specs.key?("csv"), "csv should be a resolved gem"
assert Gem.loaded_specs.key?("base64"), "base64 should be a resolved gem"
end
end