示例
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. contract 在 ruby 3 · linux alpine/x64 · docker…
sha256:8f9a1d4bba7bafae896c8862e6cc34aa3d64cb931492106f55207f395dde64bb
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
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