Feature: Coverage threshold configuration
  The project enforces a minimum 97% code coverage threshold across multiple
  configuration files. This feature validates that pyproject.toml, noxfile.py,
  the CI workflow, and the nightly quality workflow are all correctly configured
  to enforce and report coverage thresholds.

  # -- pyproject.toml coverage configuration --

  Scenario: Coverage run section exists in pyproject.toml
    Given the pyproject toml file is loaded for coverage check
    Then the coverage run section should exist

  Scenario: Coverage source includes src directory
    Given the pyproject toml file is loaded for coverage check
    Then the coverage source should include "src"

  Scenario: Coverage branch tracking is enabled
    Given the pyproject toml file is loaded for coverage check
    Then the coverage branch tracking should be enabled

  Scenario: Coverage data file is stored under build directory
    Given the pyproject toml file is loaded for coverage check
    Then the coverage data file should be "build/.coverage"

  Scenario: Coverage HTML report directory is under build
    Given the pyproject toml file is loaded for coverage check
    Then the coverage html directory should be "build/htmlcov"

  Scenario: Coverage XML output is under build directory
    Given the pyproject toml file is loaded for coverage check
    Then the coverage xml output should be "build/coverage.xml"

  Scenario: Coverage omit patterns exclude test directories
    Given the pyproject toml file is loaded for coverage check
    Then the coverage omit patterns should include "*/tests/*"

  # -- noxfile.py coverage session --

  Scenario: Noxfile defines a coverage_report session
    Given the noxfile py is loaded for coverage check
    Then the noxfile should define a coverage_report session

  @tdd_issue @tdd_issue_4227
  Scenario: Noxfile enforces fail-under threshold of at least 97
    Given the noxfile py is loaded for coverage check
    Then the noxfile should contain a fail-under threshold of at least 97

  # -- CI workflow coverage enforcement --

  Scenario: CI workflow references nox coverage_report session
    Given the ci workflow file is loaded for coverage check
    Then the ci workflow should reference nox coverage_report session

  # -- Nightly quality workflow coverage enforcement --

  Scenario: Nightly workflow enforces coverage threshold via --coverage-min
    Given the nightly quality workflow file is loaded for coverage check
    Then the nightly workflow should use a fail-under of at least 85
