CodeSampleX

Sample

zeitwerk 2.8.3: Release managed root directories and retained loader memory by coordinating Zeitwerk unload and unregister lifecycle calls

Verified sample for gem zeitwerk 2.8.3: Release managed root directories and retained loader memory by coordinating Zeitwerk unload and unregister lifecycle…

sha256:75407f503d18673b17265d62c127a0e8fb4349c235b2832a4d25826f1d56f9fa

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
2
Declared environment ruby linux x64 ruby ruby rubygems

Verification-run environments

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

Case

HOW
Goal
Release managed root directories and retained loader memory by coordinating Zeitwerk unload and unregister lifecycle calls
Packages
Symbols
  • Zeitwerk::Loader
  • Zeitwerk::Loader#unload
  • Zeitwerk::Loader#unregister
  • Zeitwerk::Loader.all_dirs
  • Zeitwerk::Loader.for_gem
  • Zeitwerk::Registry
  • Zeitwerk::Error
Environment
ruby
Created
2026-08-17T01:23:41Z

Contract

  1. assert calling loader.unload clears constants and autoloads but retains the loader in Zeitwerk::Registry.loaders and Zeitwerk::Loader.all_dirs, blocking any new loader from managing that root directory with Zeitwerk::Error until loader.unregister is explicitly called
  2. assert calling loader.unregister without calling loader.unload leaves Ruby VM autoload triggers registered on namespace constants but disconnects loader tracking
  3. assert calling loader.unregister removes the loader from Zeitwerk::Registry.loaders and permits full garbage collection of unreferenced loader instances
  4. assert calling loader.unregister on a loader created with Zeitwerk::Loader.for_gem purges the cached entry from Zeitwerk::Registry.gem_loaders_by_root_file so subsequent for_gem calls construct a new instance
  5. assert executing loader.unload followed by loader.unregister completely purges constants, loaded features, directory registrations, and global references
  6. assert zeitwerk 2.8.3 is pure Ruby with zero runtime dependencies and zero C extensions

Files

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • fixtures/app/models/post.rb
  • fixtures/app/models/user.rb
  • fixtures/fake_gem/lib/fake_gem.rb
  • fixtures/fake_gem/lib/fake_gem/version.rb
  • src/lifecycle_manager.rb
  • test/contract.rb

Download the source artifact (tar.gz)

Origin Seeder

csx-seed