Skip to content

fix(id): treat empty RUST_LOG/LOG_LEVEL as unset in log-level resolution (#5374) - #5406

Merged
dezren39 merged 1 commit into
mainfrom
fix/5374-empty-rust-log
Nov 4, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/5374-empty-rust-log

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #5374.

Root cause (class i — real product bug)

resolve_log_level in pkgs/id/src/main.rs keyed RUST_LOG handling on mere presence: a set-but-empty RUST_LOG returned 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 documented warn default.

nixpkgs' cargo hooks export RUST_LOG= (empty) into every buildRustPackage derivation, so the nix check phase deterministically ran test_structured_logging_text_file_is_plain_text against a muted server: the log file stayed empty for the full 60 s poll. The sibling JSON test passed only because it pins ID_LOG_FILE_LEVEL=debug, bypassing the inherited filter. Everywhere RUST_LOG is 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 the warn default — mirroring how the same function already treats an empty DEBUG. Non-empty RUST_LOG specs are honored exactly as before (verified: error still mutes, debug still floods). The pinned precedence-table unit test is updated to the corrected semantics; the integration test itself is unchanged.

Gate

nix build .#id-web green at this tree, full check phase: test_structured_logging_text_file_is_plain_text ... ok (~2 s, previously a 60 s timeout failure).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…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.
@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 11:11
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 08a63904-f761-48b8-aecc-598efc3152c3
Commits

Reviewing files that changed from the base of the PR and between 964c4b7 and 2767012.

Files selected for processing: 1
  • pkgs/id/src/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T11:12:51.559395Z 2767012 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

pkgs/id check phase: cli_integration structured_logging_text_file_is_plain_text fails — blocks switch attempt 4 pre-flight

1 participant