Skip to content

Add structured debug logging to the configuration merge pipeline #318

Description

@coderabbitai

Summary

The configuration merge pipeline in src/cli/merge.rs silently accumulates errors and makes no observability available to operators trying to diagnose configuration failures. Adding structured debug logging at each layer boundary would make the merge process auditable.

Context

PR #273 introduced merge_with_config and resolve_merged_diag_json in src/cli/merge.rs. The pipeline traverses four layers (defaults, file, environment, CLI) but emits no log output at discovery or merge time.

Proposed work

  • Add tracing::debug! calls in merge_with_config for each layer push (defaults applied, file discovered, environment merged, CLI overrides applied)
  • Log config file discovery attempts (path tried, found/not found)
  • Log validation rejections with structured fields (key, reason)
  • Ensure log output is suppressed when diag_json mode is active (to avoid polluting machine-readable output)

Backlinks

Rescope (2026-08-12)

The discovery half of this work has landed: src/cli/discovery.rs now uses tracing::{debug, debug_span} (emissions at lines 101 and 168) with a dedicated src/cli/discovery_tracing_tests.rs. Remaining scope: src/cli/merge.rs itself still has zero tracing calls — no per-layer logging in merge_with_config (defaults / file / env / CLI) and no structured validation-rejection logging. Note also the rename since filing: resolve_merged_diag_json is now resolve_merged_json, and "diag_json mode" is now the --json flag.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmediumRoadmap items to schedule within the current quarter. Clear scope, normal review cycles.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions