test(config): add Behave coverage for config/logging.py configure_structlog and get_logger #10709

Open
opened 2026-04-19 07:17:49 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • File: src/cleveragents/config/logging.py
  • Commit message: test(config): add Behave unit tests for config/logging configure_structlog and get_logger
  • Branch name: test/config-logging-coverage

Background and Context

The config/logging.py module configures structlog with secrets masking and provides a get_logger factory. It contains two public functions:

  • configure_structlog(env, log_level) -- configures structlog with:
    • Production path: env="production" uses JSONRenderer
    • Development path: any other env uses ConsoleRenderer
    • Invalid log level raises ValueError
    • Integrates secrets_masking_processor from shared/redaction.py
  • get_logger(name) -- returns a structlog BoundLogger instance

There is currently no Behave feature file for this module. The consolidated_security.feature and security_secrets.feature cover the secrets_masking_processor from shared/redaction.py, but the configure_structlog function itself -- including its production vs. development renderer branching and invalid log level validation -- has no dedicated unit test coverage.

Without dedicated unit tests, the following code paths are not exercised by the Behave suite:

  • configure_structlog with env="production" (JSON renderer path)
  • configure_structlog with env="development" (console renderer path)
  • configure_structlog with an invalid log_level (raises ValueError)
  • get_logger returning a bound logger instance
  • The secrets_masking_processor being wired into the structlog processor chain via configure_structlog

Acceptance Criteria

  • A new Behave feature file features/config_logging_coverage.feature exists
  • Feature covers configure_structlog with production environment (JSON renderer)
  • Feature covers configure_structlog with development environment (console renderer)
  • Feature covers configure_structlog with invalid log level (ValueError)
  • Feature covers get_logger returning a usable logger
  • Feature verifies secrets masking processor is active after configure_structlog
  • All new scenarios pass nox -s unit_tests
  • Coverage remains >= 97% (nox -s coverage_report)
  • No regressions in any other nox session

Subtasks

  • Create features/config_logging_coverage.feature with scenarios for all configure_structlog paths
  • Add scenarios for get_logger and secrets masking integration
  • Add step definitions in features/steps/config_logging_coverage_steps.py
  • Run nox -s unit_tests and fix any failures
  • Run nox -s coverage_report and verify >= 97%
  • Run full nox suite and confirm no regressions

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Duplicate Check

  • 2026-04-19: GET /api/v1/repos/cleveragents/cleveragents-core/issues?state=all&limit=50&q=configure_structlog+coverage no dedicated coverage issue found (results were generic coverage issues)
  • 2026-04-19: GET /api/v1/repos/cleveragents/cleveragents-core/issues?state=all&limit=50&q=logging+coverage no dedicated coverage issue for config/logging.py found
  • 2026-04-19: GET /api/v1/repos/cleveragents/cleveragents-core/issues?state=all&limit=50&q=configure_structlog found issues #6732, #6570, #6569 etc. -- none are coverage issues for this module
  • No existing Behave feature file for config/logging.py found in features/ directory

Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker

## Metadata - **File:** `src/cleveragents/config/logging.py` - **Commit message:** `test(config): add Behave unit tests for config/logging configure_structlog and get_logger` - **Branch name:** `test/config-logging-coverage` ## Background and Context The `config/logging.py` module configures `structlog` with secrets masking and provides a `get_logger` factory. It contains two public functions: - `configure_structlog(env, log_level)` -- configures structlog with: - Production path: `env="production"` uses `JSONRenderer` - Development path: any other env uses `ConsoleRenderer` - Invalid log level raises `ValueError` - Integrates `secrets_masking_processor` from `shared/redaction.py` - `get_logger(name)` -- returns a structlog `BoundLogger` instance There is currently **no Behave feature file** for this module. The `consolidated_security.feature` and `security_secrets.feature` cover the `secrets_masking_processor` from `shared/redaction.py`, but the `configure_structlog` function itself -- including its production vs. development renderer branching and invalid log level validation -- has no dedicated unit test coverage. Without dedicated unit tests, the following code paths are not exercised by the Behave suite: - `configure_structlog` with `env="production"` (JSON renderer path) - `configure_structlog` with `env="development"` (console renderer path) - `configure_structlog` with an invalid `log_level` (raises `ValueError`) - `get_logger` returning a bound logger instance - The `secrets_masking_processor` being wired into the structlog processor chain via `configure_structlog` ## Acceptance Criteria - [ ] A new Behave feature file `features/config_logging_coverage.feature` exists - [ ] Feature covers `configure_structlog` with production environment (JSON renderer) - [ ] Feature covers `configure_structlog` with development environment (console renderer) - [ ] Feature covers `configure_structlog` with invalid log level (ValueError) - [ ] Feature covers `get_logger` returning a usable logger - [ ] Feature verifies secrets masking processor is active after `configure_structlog` - [ ] All new scenarios pass `nox -s unit_tests` - [ ] Coverage remains >= 97% (`nox -s coverage_report`) - [ ] No regressions in any other nox session ## Subtasks - [ ] Create `features/config_logging_coverage.feature` with scenarios for all `configure_structlog` paths - [ ] Add scenarios for `get_logger` and secrets masking integration - [ ] Add step definitions in `features/steps/config_logging_coverage_steps.py` - [ ] Run `nox -s unit_tests` and fix any failures - [ ] Run `nox -s coverage_report` and verify >= 97% - [ ] Run full `nox` suite and confirm no regressions ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. ## Duplicate Check - 2026-04-19: `GET /api/v1/repos/cleveragents/cleveragents-core/issues?state=all&limit=50&q=configure_structlog+coverage` no dedicated coverage issue found (results were generic coverage issues) - 2026-04-19: `GET /api/v1/repos/cleveragents/cleveragents-core/issues?state=all&limit=50&q=logging+coverage` no dedicated coverage issue for `config/logging.py` found - 2026-04-19: `GET /api/v1/repos/cleveragents/cleveragents-core/issues?state=all&limit=50&q=configure_structlog` found issues #6732, #6570, #6569 etc. -- none are coverage issues for this module - No existing Behave feature file for `config/logging.py` found in `features/` directory --- **Automated by CleverAgents Bot** Supervisor: Implementation Pool | Agent: implementation-worker
HAL9000 added this to the v3.7.0 milestone 2026-04-19 07:17:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10709
No description provided.