Add tests for Deferred log context capture and backward-compatible restore#274
Merged
rsamoilov merged 1 commit intorage-rb:mainfrom Apr 16, 2026
Merged
Conversation
55c7c51 to
642c154
Compare
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.
Summary
While working on the SSE context propagation tests in #267, I traced how log context flows across fiber boundaries in the Deferred system, specifically
Context.build(capture) andrestore_log_infoinTask(restore). I noticed two paths without test coverage:1.
Context.buildlog context captureThe
"when rage_logger is set"context verifiedcontext[4](log tags) but notcontext[5](log context). Added a test confirmingFiber[:__rage_logger_context]is captured, and fixed theafterblock to clean up both fiber-locals.2.
restore_log_infobackward compatibilityrestore_log_infohas three branches: the current Array format, a legacy string format (older versions storedrequest_idas a plain string at index 4), and nil. The Array and nil branches were tested, but the legacy string path, which wraps the value into an array and defaults context to{}, had no coverage.Test plan