Fix NoMethodError in deprecations run - #198
Merged
Merged
Conversation
`run` called DeprecationTracker.sanitize_mode, which lived in deprecation_tracker.rb, but the CLI only required valid_modes and shard_merger. Every invocation of run mode raised NoMethodError before reaching any of its own logic. Move sanitize_mode to valid_modes.rb, next to valid_mode? and valid_modes_display, rather than making the CLI require the whole tracker. deprecation_tracker.rb already requires valid_modes, so tracker behavior is unchanged, and the CLI keeps its two narrow requires. That matters because requiring deprecation_tracker.rb prepends KernelWarnTracker onto Object and Kernel at require time: a summary-printing CLI has no business patching Kernel#warn, and doing so also misattributes any `warn ..., uplevel:` in the process to the tracker's wrapper instead of the real caller. Also resolve "next_rails/tint" relatively in deprecation_tracker.rb. Unrelated to this bug, but requiring the tracker by absolute path from outside a checkout raised LoadError without it. Adds the smoke spec that would have caught this. It executes the real script in a subprocess, which is the only thing that exercises exe/ at all; verified to fail with NoMethodError when sanitize_mode is removed again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deprecations runraisedNoMethodErroron every invocation: it callsDeprecationTracker.sanitize_mode, which lived indeprecation_tracker.rb, while the CLI only requiresvalid_modes.Moves
sanitize_modetovalid_modes.rb, next tovalid_mode?.deprecation_tracker.rbalready requires that file, so tracker behavior is unchanged andexe/deprecationsneeds no change. Requiring the whole tracker from the CLI was the other option, but that prependsKernelWarnTrackerontoObjectandKernelat require time.Adds a subprocess smoke spec for the executable, the first thing that exercises
exe/at all. Verified it fails with the originalNoMethodErrorwhensanitize_modeis removed again.