Skip to content

Set root namespace for Audit::Changes

Tan Le requested to merge tancnle/fix-audit-changes-root-namespace into master

What does this MR do?

This changes set the correct root namespace for Audit::Changes and avoid failed lookup when included in a different namespace.

The following exception was thrown when I attempted to run bundle exec rails c or bundle exec rails s locally.

Stacktrace
/Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant': uninitialized constant EE::Audit::Changes (NameError)
        101: from bin/rails:4:in `<main>'
        100: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
         99: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
         98: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
         97: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
         96: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
         95: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/commands.rb:18:in `<main>'
         94: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/command.rb:46:in `invoke'
         93: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/command/base.rb:69:in `perform'
         92: from /Users/tanle/.gem/ruby/2.6.5/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
         91: from /Users/tanle/.gem/ruby/2.6.5/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
         90: from /Users/tanle/.gem/ruby/2.6.5/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
         89: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/commands/console/console_command.rb:101:in `perform'
         88: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
         87: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/command/actions.rb:28:in `require_environment!'
         86: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/application.rb:339:in `require_environment!'
         85: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
         84: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
         83: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
         82: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
         81: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
         80: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/environment.rb:5:in `<main>'
         79: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/application.rb:363:in `initialize!'
         78: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
         77: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
         76: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
         75: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
         74: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
         73: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
         72: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
         71: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
         70: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `call'
         69: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/initializable.rb:50:in `tsort_each_child'
         68: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/initializable.rb:50:in `each'
         67: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
         66: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
         65: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
         64: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
         63: from /Users/tanle/.rubies/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
         62: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
         61: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `run'
         60: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
         59: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/engine.rb:623:in `block in <class:Engine>'
         58: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/engine.rb:623:in `each'
         57: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/engine.rb:624:in `block (2 levels) in <class:Engine>'
         56: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/engine.rb:666:in `load_config_initializer'
         55: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/notifications.rb:182:in `instrument'
         54: from /Users/tanle/.gem/ruby/2.6.5/gems/railties-6.0.2.2/lib/rails/engine.rb:667:in `block in load_config_initializer'
         53: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
         52: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
         51: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:190:in `<main>'
         50: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/lib/gitlab/metrics/instrumentation.rb:17:in `configure'
         49: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:191:in `block in <main>'
         48: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:40:in `instrument_classes'
         47: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:40:in `each'
         46: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:43:in `block in instrument_classes'
         45: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:43:in `each'
         44: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/zz_metrics.rb:45:in `block (2 levels) in instrument_classes'
         43: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
         42: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:280:in `constantize'
         41: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:280:in `inject'
         40: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:280:in `each'
         39: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:284:in `block in constantize'
         38: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:284:in `const_get'
         37: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `load_missing_constant'
         36: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry'
         35: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant'
         34: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `require_or_load'
         33: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry'
         32: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:49:in `block in require_or_load'
         31: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
         30: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
         29: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
         28: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
         27: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
         26: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/app/services/users/update_service.rb:99:in `<main>'
         25: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/config/initializers/0_inject_enterprise_edition_module.rb:9:in `prepend_if_ee'
         24: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
         23: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:280:in `constantize'
         22: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:280:in `inject'
         21: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:280:in `each'
         20: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:284:in `block in constantize'
         19: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/inflector/methods.rb:284:in `const_get'
         18: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `load_missing_constant'
         17: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry'
         16: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant'
         15: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `require_or_load'
         14: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry'
         13: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:49:in `block in require_or_load'
         12: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
         11: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
         10: from /Users/tanle/.gem/ruby/2.6.5/gems/activesupport-6.0.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
          9: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
          8: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
          7: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/ee/app/services/ee/users/update_service.rb:3:in `<main>'
          6: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/ee/app/services/ee/users/update_service.rb:4:in `<module:EE>'
          5: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/ee/app/services/ee/users/update_service.rb:5:in `<module:Users>'
          4: from /Users/tanle/Code/gitlab/gitlab-development-kit/gitlab/ee/app/services/ee/users/update_service.rb:8:in `<module:UpdateService>'
          3: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
          2: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `rescue in load_missing_constant'
          1: from /Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:9:in `without_bootsnap_cache'
/Users/tanle/.gem/ruby/2.6.5/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant': uninitialized constant EE::Audit::Changes (NameError)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Yorick Peterse

Merge request reports