Repository navigation
Use T.unsafe only where Sorbet can't type the code, and remove mailer metadata that never collected anything - #23
Merged
Conversation
add_current_tags_to_log_data asked ActiveSupport::TaggedLogging and ActiveJob::Logging for current_tags and job_id, which neither has (the tags belong to each tagged logger's formatter, and the job ID to each job), and its fallback read a thread-local key Rails doesn't use. So it never added tags or a job ID to a mailer's log lines; its tests passed only because they defined those methods first.
Most uses wrapped values that are already T.untyped (const_get, instance_variable_get, an untyped parameter), so they did nothing. The others now have typed alternatives: an override saying ActiveSupport.on_load's block runs with an untyped self, a shim for Shrine's subscribe (added by its instrumentation plugin), requires_ancestor in the Rails server command patch and the test line filter, and typed Arrays in two tests. The tagged logging formatter calls current_tags directly: Rails 7.1, the oldest version LogStruct supports, always has it. T.unsafe stays for a splat Sorbet can't size, a duck-typed call after respond_to?, Minitest::Mock and a test that passes a wrong type on purpose. AGENTS.md now lists what to try first and these cases, in place of a ban that pushed code towards equivalent workarounds.
|
Warning Review limit reached
This review includes 23 billable files and costs up to $5.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 40 minutes for your next included review. View limit details
Comment |
This was referenced Oct 17, 2026
Merged
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.
Eighth of twelve stacked PRs for 0.2.0.
What this changes
T.unsafe: from 32 uses inlibto 3. Most uses wrapped values that are alreadyT.untyped(
const_get,instance_variable_get, an untyped parameter), so they did nothing. The others have typedalternatives now: an override saying
ActiveSupport.on_load's block runs with an untypedself, a shim forShrine's
subscribe(added by its instrumentation plugin),requires_ancestorin the Rails server command patch andthe test line filter, and typed Arrays in two tests. The tagged logging formatter calls
current_tagsdirectly:Rails 7.1, the oldest version LogStruct supports, always has it.
T.unsafestays for a splat Sorbet can't size, a duck-typed call afterrespond_to?,Minitest::Mock, and a testthat passes a wrong type on purpose. AGENTS.md lists what to try first and these cases, instead of a ban that pushed
code towards equivalent workarounds.
add_current_tags_to_log_data. It askedActiveSupport::TaggedLoggingandActiveJob::Loggingforcurrent_tagsandjob_id, which neither has, and its fallback read a thread-local keyRails doesn't use, so it never added anything to a mailer's lines. Its tests passed only because they defined those
methods first.
Testing
Sorbet and the unit suite (308 tests) pass at this branch's tip.
Stack for 0.2.0, merged in order: #16 → #17 → #18 → #19 → #20 → #21 → #22 → #23 → #24 → #25 → #26 → #27