Repository navigation
fix(id): treat empty RUST_LOG/LOG_LEVEL as unset in log-level resolution (#5374) - #5406
Merged
Merged
Conversation
…ion (#5374) resolve_log_level keyed RUST_LOG handling on mere presence: a set-but- empty RUST_LOG returned the empty sentinel, making the empty string itself the base tracing filter. With only the appended per-module caps left in the filter, every other target - including the serve startup warnings the structured-logging file destination exists to record - was silently muted, discarding the documented warn default. Environments routinely export RUST_LOG empty (nixpkgs cargo hooks put RUST_LOG= into every buildRustPackage derivation), so the nix check phase ran the cli_integration structured-logging text-file test against a muted server and the file stayed empty for the full 60s poll: test_structured_logging_text_file_is_plain_text failed deterministically in the sandbox while passing everywhere else. Empty or whitespace-only RUST_LOG (and, by the same principle, LOG_LEVEL) now falls through to the remaining sources and the warn default. Non-empty RUST_LOG specs are honored exactly as before. Updates the pinned precedence-table unit test to the corrected semantics.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Fixes #5374.
Root cause (class i — real product bug)
resolve_log_levelinpkgs/id/src/main.rskeyedRUST_LOGhandling on mere presence: a set-but-emptyRUST_LOGreturned the empty sentinel, and the caller then used the empty string itself as the base tracing filter. With no global directive in the filter, only the appended per-module caps (mainline::rpc=info, …) remained in effect — every other target, including the serve startup warnings the structured-logging file destination exists to record, was silently muted, discarding the documentedwarndefault.nixpkgs' cargo hooks export
RUST_LOG=(empty) into every buildRustPackage derivation, so the nix check phase deterministically rantest_structured_logging_text_file_is_plain_textagainst a muted server: the log file stayed empty for the full 60 s poll. The sibling JSON test passed only because it pinsID_LOG_FILE_LEVEL=debug, bypassing the inherited filter. EverywhereRUST_LOGis unset (dev shells, host runs), the same test passes in ~0.5 s.Evidence trail: reproduced the failure 3x via
nix build .#id-web; the sandbox-built binaries pass the same test on the host and in an isolated sandbox derivation; a diagnostic run inside the genuine check showed the child fully started (endpoint sockets open, log file open on fd 9) with zero bytes on file and stderr; a host probe matrix then isolated it:RUST_LOG=→ 0 bytes, unset/warn→ the 142-byte discovery warning.Fix
Empty or whitespace-only
RUST_LOG(and, by the same principle,LOG_LEVEL) is treated as unset and falls through to the remaining sources and thewarndefault — mirroring how the same function already treats an emptyDEBUG. Non-emptyRUST_LOGspecs are honored exactly as before (verified:errorstill mutes,debugstill floods). The pinned precedence-table unit test is updated to the corrected semantics; the integration test itself is unchanged.Gate
nix build .#id-webgreen at this tree, full check phase:test_structured_logging_text_file_is_plain_text ... ok(~2 s, previously a 60 s timeout failure).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.