CodeSampleX

샘플

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

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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

컨트랙트

  1. declare the extracted default gems in the Gemfile
  2. assert requiring csv and base64 works because they are declared
  3. assert strict_encode64 omits the newlines encode64 inserts
  4. assert both now appear as resolved gems rather than builtins

파일

  • Gemfile
  • Gemfile.lock
  • csx.json
  • test/contract.rb

소스 아티팩트 내려받기 (tar.gz)

소스

Gemfile
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"
Gemfile.lock
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
csx.json
{"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"}
test/contract.rb
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

오리진 시더

anonymous