Skip to content

Replace DeprecatedConstantProxy with const_missing for Dotenv::Railtie#545

Open
agrberg wants to merge 1 commit intobkeepers:mainfrom
agrberg:ar/tapioca-deprecation-warning-fix
Open

Replace DeprecatedConstantProxy with const_missing for Dotenv::Railtie#545
agrberg wants to merge 1 commit intobkeepers:mainfrom
agrberg:ar/tapioca-deprecation-warning-fix

Conversation

@agrberg
Copy link
Copy Markdown

@agrberg agrberg commented Mar 30, 2026

Summary

  • Replace ActiveSupport::Deprecation::DeprecatedConstantProxy with a const_missing hook on Dotenv so that Dotenv::Railtie only emits a deprecation warning when actually used in code, not when tools enumerate Dotenv.constants
  • Add tests verifying the deprecation warning, return value, and that :Railtie is not visible in Dotenv.constants

Closes #544

Test plan

  • Dotenv::Railtie still returns Dotenv::Rails
  • Accessing Dotenv::Railtie emits a deprecation warning
  • Dotenv.constants does not include :Railtie
  • Full test suite passes (198 specs, 2 minitest)

🤖 Generated with Claude Code

`DeprecatedConstantProxy` registers a real constant, which means static
analysis tools like tapioca emit deprecation warnings when enumerating
Dotenv.constants even if Dotenv::Railtie is never referenced.

`const_missing` keeps the deprecation behavior for actual usage while
hiding the constant from introspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dotenv::Railtie deprecation warning triggered by static analysis tools

1 participant