fix(tests): add missing Behave feature file for coverage_threshold #3237

Merged
freemo merged 1 commit from fix/coverage-threshold-feature-file into master 2026-04-05 21:09:22 +00:00
Owner

Summary

Creates features/coverage_threshold_config.feature, the missing Gherkin feature file that exercises all 15 step functions in features/steps/coverage_threshold_config_steps.py. Prior to this PR, every step in that module was dead code — no scenario invoked any of them — meaning the coverage threshold configuration was entirely untested by Behave. This PR resolves the gap introduced by PR #2629 and ensures the --coverage-min pattern support added to step_nightly_fail_under is actually exercised.

Changes

  • Added features/coverage_threshold_config.feature — a new Gherkin feature file containing 11 BDD scenarios organized into four logical groups:
    • pyproject.toml coverage configuration (7 scenarios): validates the [tool.coverage.run] section exists, that src is listed as a coverage source, that branch tracking is enabled (branch = true), that the data file is build/.coverage, that the HTML output directory is build/htmlcov, that the XML output is build/coverage.xml, and that the omit patterns include */tests/*.
    • noxfile.py coverage session (2 scenarios): asserts that a coverage_report session is defined and that the fail-under threshold is at least 97 (matching the COVERAGE_THRESHOLD = 97 constant).
    • CI workflow (1 scenario): confirms the CI workflow invokes nox -s coverage_report.
    • Nightly quality workflow (1 scenario): confirms the nightly workflow enforces a --coverage-min threshold of at least 85 (matching the actual --coverage-min 85 value in nightly-quality.yml).
  • No Python code added or modified. The step implementations in coverage_threshold_config_steps.py were already complete; only the driving feature file was absent.
  • All 15 step functions are now reachable — none remain as dead code.

Design Decisions

  • Exact step text matching: All Gherkin step lines were copied verbatim from the @given/@then decorator strings in coverage_threshold_config_steps.py to guarantee correct Behave step resolution without any ambiguity.
  • Threshold values sourced from actual project files: The noxfile threshold (97) was taken from the COVERAGE_THRESHOLD = 97 constant; the nightly workflow threshold (85) was taken from the literal --coverage-min 85 argument in .forgejo/workflows/nightly-quality.yml.
  • Scenario grouping with inline comments: Scenarios are organized into four named groups with Gherkin comments to make the intent of each block immediately clear.

Testing

  • Behave: 11 scenarios — all pass against actual project configuration values
  • Ruff lint (ruff check features/): All checks passed
  • No new Python code introduced

Modules Affected

  • features/coverage_threshold_config.feature (new file)

Closes #2767


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-pr-api-creator

## Summary Creates `features/coverage_threshold_config.feature`, the missing Gherkin feature file that exercises all 15 step functions in `features/steps/coverage_threshold_config_steps.py`. Prior to this PR, every step in that module was dead code — no scenario invoked any of them — meaning the coverage threshold configuration was entirely untested by Behave. This PR resolves the gap introduced by PR #2629 and ensures the `--coverage-min` pattern support added to `step_nightly_fail_under` is actually exercised. ## Changes - **Added `features/coverage_threshold_config.feature`** — a new Gherkin feature file containing 11 BDD scenarios organized into four logical groups: - **`pyproject.toml` coverage configuration** (7 scenarios): validates the `[tool.coverage.run]` section exists, that `src` is listed as a coverage source, that branch tracking is enabled (`branch = true`), that the data file is `build/.coverage`, that the HTML output directory is `build/htmlcov`, that the XML output is `build/coverage.xml`, and that the omit patterns include `*/tests/*`. - **`noxfile.py` coverage session** (2 scenarios): asserts that a `coverage_report` session is defined and that the fail-under threshold is at least 97 (matching the `COVERAGE_THRESHOLD = 97` constant). - **CI workflow** (1 scenario): confirms the CI workflow invokes `nox -s coverage_report`. - **Nightly quality workflow** (1 scenario): confirms the nightly workflow enforces a `--coverage-min` threshold of at least 85 (matching the actual `--coverage-min 85` value in `nightly-quality.yml`). - **No Python code added or modified.** The step implementations in `coverage_threshold_config_steps.py` were already complete; only the driving feature file was absent. - **All 15 step functions are now reachable** — none remain as dead code. ## Design Decisions - **Exact step text matching**: All Gherkin step lines were copied verbatim from the `@given`/`@then` decorator strings in `coverage_threshold_config_steps.py` to guarantee correct Behave step resolution without any ambiguity. - **Threshold values sourced from actual project files**: The noxfile threshold (97) was taken from the `COVERAGE_THRESHOLD = 97` constant; the nightly workflow threshold (85) was taken from the literal `--coverage-min 85` argument in `.forgejo/workflows/nightly-quality.yml`. - **Scenario grouping with inline comments**: Scenarios are organized into four named groups with Gherkin comments to make the intent of each block immediately clear. ## Testing - Behave: **11 scenarios — all pass** against actual project configuration values - Ruff lint (`ruff check features/`): **All checks passed** - No new Python code introduced ## Modules Affected - `features/coverage_threshold_config.feature` *(new file)* Closes #2767 --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-pr-api-creator
fix(tests): add missing Behave feature file for coverage_threshold
All checks were successful
CI / lint (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 55s
CI / quality (pull_request) Successful in 40s
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Successful in 6m55s
CI / e2e_tests (pull_request) Successful in 17m13s
CI / integration_tests (pull_request) Successful in 23m21s
CI / coverage (pull_request) Successful in 11m3s
CI / docker (pull_request) Successful in 21s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m1s
2eaf9362a3
- What was implemented
  - Created features/coverage_threshold_config.feature containing 11 BDD scenarios to exercise coverage threshold configurations.
  - All 15 step functions in features/steps/coverage_threshold_config_steps.py are now exercised by the new scenarios.
  - Scenarios cover:
    - pyproject.toml coverage config (7 scenarios)
    - noxfile.py coverage session (2 scenarios)
    - CI workflow (1 scenario)
    - nightly quality workflow (1 scenario)
  - All 11 scenarios verified to pass against actual project configuration values.

- Key design decisions
  - Used the exact step text from the step file to ensure proper Gherkin-to-step matching.
  - Nightly workflow threshold set to 85 (matching the actual --coverage-min 85 value in nightly-quality.yml).
  - Noxfile threshold set to 97 (matching COVERAGE_THRESHOLD = 97 constant).
  - Organized scenarios into logical groups with comments for readability.

- Modules/components affected
  - features/coverage_threshold_config.feature (new feature file)
  - features/steps/coverage_threshold_config_steps.py (all steps now exercised)

ISSUES CLOSED: #2767
freemo added this to the v3.2.0 milestone 2026-04-05 08:23:26 +00:00
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3237-1775372600]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3237-1775372600] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo left a comment

Review: APPROVED

PR Metadata

  • Title: Follows Conventional Changelog format (fix(tests): ...)
  • Body: Includes Closes #2767
  • Milestone: v3.2.0
  • Label: Type/Bug
  • Commit footer: ISSUES CLOSED: #2767

Code Review

Step-to-Scenario Matching: All 11 Gherkin scenarios were verified against the 15 step functions in coverage_threshold_config_steps.py. Every @given and @then decorator string matches its corresponding feature file step text exactly. All 15 step functions are now reachable — zero dead code remains.

Threshold Values:

  • Noxfile threshold of 97 correctly matches the COVERAGE_THRESHOLD = 97 constant in noxfile.py
  • Nightly workflow threshold of 85 correctly matches the actual --coverage-min 85 argument in nightly-quality.yml
  • Note: The original issue #2767 suggested 97 for the nightly threshold, but the PR correctly uses 85 to match the actual configuration. This is the right call — the test should validate what the config actually says, not an aspirational value.

Scenario Organization: Four logical groups (pyproject.toml config, noxfile session, CI workflow, nightly workflow) with clear Gherkin comments. Well-structured and readable.

Risk Assessment: Minimal — this PR adds only a .feature file with no Python code changes. The step implementations were already reviewed in PR #2629.

No issues found. Clean, focused PR that resolves a real testing gap.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer

## Review: APPROVED ✅ ### PR Metadata - **Title**: Follows Conventional Changelog format (`fix(tests): ...`) ✅ - **Body**: Includes `Closes #2767` ✅ - **Milestone**: v3.2.0 ✅ - **Label**: Type/Bug ✅ - **Commit footer**: `ISSUES CLOSED: #2767` ✅ ### Code Review **Step-to-Scenario Matching**: All 11 Gherkin scenarios were verified against the 15 step functions in `coverage_threshold_config_steps.py`. Every `@given` and `@then` decorator string matches its corresponding feature file step text exactly. All 15 step functions are now reachable — zero dead code remains. **Threshold Values**: - Noxfile threshold of 97 correctly matches the `COVERAGE_THRESHOLD = 97` constant in `noxfile.py` ✅ - Nightly workflow threshold of 85 correctly matches the actual `--coverage-min 85` argument in `nightly-quality.yml` ✅ - Note: The original issue #2767 suggested 97 for the nightly threshold, but the PR correctly uses 85 to match the actual configuration. This is the right call — the test should validate what the config actually says, not an aspirational value. **Scenario Organization**: Four logical groups (pyproject.toml config, noxfile session, CI workflow, nightly workflow) with clear Gherkin comments. Well-structured and readable. **Risk Assessment**: Minimal — this PR adds only a `.feature` file with no Python code changes. The step implementations were already reviewed in PR #2629. **No issues found.** Clean, focused PR that resolves a real testing gap. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
freemo scheduled this pull request to auto merge when all checks succeed 2026-04-05 08:59:57 +00:00
freemo merged commit 2e2202e52f into master 2026-04-05 21:09:18 +00:00
freemo removed this from the v3.2.0 milestone 2026-04-06 20:50:49 +00:00
Sign in to join this conversation.
No reviewers
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.

Reference
cleveragents/cleveragents-core!3237
No description provided.