Skip to content

fix(id): default log level to warn, as documented (#2322) - #4206

Merged
dezren39 merged 2 commits into
mainfrom
queue/5236-2322-id-log-warn-default
Nov 2, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/5236-2322-id-log-warn-default

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #2322 (queue task 5236; scoped by triage task 3476).

What

get_log_level in pkgs/id/src/main.rs documented step 6 as 'Default → warn' but returned "debug", so every flagless id invocation ran at debug level and --debug was a meaningless opt-in.

  • Resolution extracted into a pure resolve_log_level(debug_flag, log_level_flag, rust_log, log_level_env, debug_env) helper — env values are passed in so tests pin the precedence table without mutating process environment in parallel (triage task 3476's prescribed shape).
  • Step 6 now returns "warn", matching the doc. All other steps are behavior-identical, including the RUST_LOG presence check (empty-string sentinel) and the DEBUG truthy rule.
  • Noisy-module filter list untouched; structured logging (id: structured logging — JSON lines with trace ids, tz-aware timestamps, log-to-file with per-destination levels #1791) out of scope.

Tests

New #[cfg(test)] table tests in main.rs: default → warn; --debug beats flags+env; --log-level beats env; RUST_LOG present (incl. empty) → sentinel; LOG_LEVEL beats DEBUG; DEBUG truthy (1/true/TRUE/yes) → debug; DEBUG falsey (""/0/false/FALSE) → warn.

Verification is CI-first on this PR (laptop load >100 this shift; local fleet builds are policy-deferred to Actions). rustfmt --check on the file shows no diff in the changed regions (a pre-existing import-order diff from the system rustfmt vs the pinned toolchain was left untouched).


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

get_log_level documented a warn default (step 6) but returned debug, so
every flagless id invocation ran at debug level and --debug was a no-op
opt-in. Extract the resolution into a pure resolve_log_level helper
(env values passed in, no process-env mutation) and return warn at
step 6. Precedence is unchanged: --debug > --log-level > RUST_LOG
(presence -> empty sentinel) > LOG_LEVEL > truthy DEBUG > warn.
Table tests pin the default, each precedence level, and DEBUG
truthy/falsey values. Noisy-module filters untouched.

Queue task 5236.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 05:44
@coderabbitai

coderabbitai Bot commented Nov 2, 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 15 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: cdfa009a-72f7-4a20-9278-2812a61a729f
Commits

Reviewing files that changed from the base of the PR and between a0e6d1d and 5eaf0de.

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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3117b6b614

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/id/src/main.rs Outdated
use super::resolve_log_level;

#[test]
fn log_level_defaults_to_warn_without_flags_or_env() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prefix the new test functions with test_

All seven newly added test functions omit the test_ prefix explicitly required by the Naming rule in pkgs/id/AGENTS.md. Rename them to test_log_level_... to comply with the package’s documented naming convention.

AGENTS.md reference: pkgs/id/AGENTS.md:L140-L140

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5eaf0de: all seven new test functions renamed to the test_log_level_... form required by the Naming rule in pkgs/id/AGENTS.md. — task 5236, lane A worker

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-02T06:09:07.611765Z 5eaf0de New commits
ℹ️ 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.

id(main): get_log_level documents a warn default but returns debug — every flagless run logs at debug to stderr

1 participant