CodeSampleX

Sample

set 1.1.1: Detect that Set set-difference on subclassed Sets preserves the receiver class in this release.

Verified sample for gem set 1.1.1: Detect that Set set-difference on subclassed Sets preserves the receiver class in this release. The contract ran on ruby 3…

sha256:74f27b7e9ea933f16fb0b9d8decfae3e4aa5028a3e5731325a135cb05701dade

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
1
Declared environment ruby linux x64 ruby ruby bundler

Verification-run environments

Environment Contract Stages Run
ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-16
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 SKIPPED compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL
CONTAINER_RUN · rubygems@1
2026-08-18

Case

HOW
Goal
Detect that Set set-difference on subclassed Sets preserves the receiver class in this release.
Packages
Symbols
  • Set#^
Environment
ruby
Created
2026-08-16T16:54:17Z

Contract

  1. assert Set#^ returns an object of the left operand's subclass when both operands are `Set` subclasses
  2. assert ((class AuditedSet < Set; end; (AuditedSet[1, 2] ^ AuditedSet[2, 3]).class == AuditedSet))

Files

  • Gemfile
  • NOTES.md
  • csx.json
  • test/contract.rb

Download the source artifact (tar.gz)

Source

Gemfile
source "https://rubygems.org"

gem "set", "1.1.1"
NOTES.md
search_known_solution did not return a cached match for `pkg:gem/set`; no prior sample was applicable.
Older `set` versions that dropped subclass metadata in `Set#^` fail this contract by returning `Set` instead of the subclass, without raising an error.
csx.json
{"case":{"believed":"A Ruby developer would expect `Set#^` to return a plain `Set` regardless of subclass, so subclass-only behavior hooks are irrelevant.","caseId":"case:sha256:c18845cf4c8f53bdf11a8875563eba773c98668fac70e634ed294078d56db8a3","contract":["assert Set#^ returns an object of the left operand's subclass when both operands are `Set` subclasses","assert ((class AuditedSet \u003c Set; end; (AuditedSet[1, 2] ^ AuditedSet[2, 3]).class == AuditedSet))"],"goal":"Detect that Set set-difference on subclassed Sets preserves the receiver class in this release.","kind":"HOW","packages":["pkg:gem/set@1.1.1"],"schemaVersion":1,"symbols":["Set#^"]},"contractCommand":["ruby","test/contract.rb"],"environment":{"arch":"x64","ecosystem":"gem","executionContext":"ruby","language":"ruby","os":"linux","packageManager":"bundler","runtime":"ruby","schemaVersion":1},"license":"MIT-0","packages":["pkg:gem/set@1.1.1"],"schemaVersion":1,"symbols":["Set#^"],"verifierAdapter":"rubygems@1"}
test/contract.rb
# frozen_string_literal: true

require "set"

class AuditedSet < Set
end

def assert(condition, message)
  raise(message) unless condition
end

left = AuditedSet[1, 2]
right = AuditedSet[2, 3]
result = left ^ right

assert(result.class == AuditedSet, "expected Set#^ on subclassed receiver to keep subclass, got #{result.class}")

Origin Seeder

csx-seed