Exemplo
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
- Pacotes
- zeitwerk 2.8.3
- Ambiente
- ruby
- Criado
- 2026-08-16T17:17:19Z
O que costuma-se supor
Defining a non-module object in an explicit namespace file raises Ruby's standard TypeError on nested constant access or Zeitwerk::NameError during autoloading.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
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
Arquivos
- 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
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9