Ejemplo
Differentiate Zeitwerk exception hierarchy and error dispatch paths across invalid namespace definitions, unmanaged files, and lifecycle misordering
sha256:9be8f03e18da8a40234c0072cc13a93ec3afcdf7b74fe38906c30c2e17c369d6
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Differentiate Zeitwerk exception hierarchy and error dispatch paths across invalid namespace definitions, unmanaged files, and lifecycle misordering HOW
- Paquetes
- zeitwerk 2.8.3
- Entorno
- ruby
- Creado
- 2026-08-16T17:17:19Z
Lo que suele suponerse
Defining a non-module object in an explicit namespace file raises Ruby's standard TypeError on nested constant access or Zeitwerk::NameError during autoloading.
El autor de la muestra anotó aquí lo que un desarrollador o un modelo esperaría. El contrato de abajo es lo que realmente se ejecutó.
Contrato
- assert assigning a non-module object in an explicit namespace file immediately raises Zeitwerk::Error from const_added during autoload, escaping rescue NameError and rescue TypeError
- assert push_dir rejects Symbol and String namespace arguments with Zeitwerk::Error rather than TypeError or ArgumentError
- assert push_dir rejects anonymous modules with Zeitwerk::Error stating root namespaces cannot be anonymous
- assert calling reload without enabling reloading raises Zeitwerk::ReloadingDisabledError while calling enable_reloading after setup raises base Zeitwerk::Error
- assert calling eager_load before setup raises Zeitwerk::SetupRequired rather than RuntimeError or ArgumentError
- assert load_file normalizes missing files, non-Ruby files, ignored files, hidden files, and unmanaged files to Zeitwerk::Error instead of LoadError or Errno::ENOENT
- assert conflicting explicit namespace file and nsfile definitions raise Zeitwerk::ConflictingNamespaceDefinitionError identifying both file paths
Archivos
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/error_paths.rb
- src/trees/anonymous_ns/dummy.rb
- src/trees/conflicting_ns/accounts.rb
- src/trees/conflicting_ns/accounts/ns.rb
- src/trees/eager_unsetup/dummy.rb
- src/trees/file_inputs/.hidden.rb
- src/trees/file_inputs/doc.txt
- src/trees/file_inputs/entry.rb
- src/trees/file_inputs/ignored.rb
- src/trees/invalid_namespace/router.rb
- src/trees/invalid_namespace/router/route.rb
- src/trees/non_module_ns/dummy.rb
- src/trees/reloading/item.rb
- test/contract.rb
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9