@tdd_issue @tdd_issue_658 @tdd_issue_4178
Feature: TDD Issue #658 — E2E verification suites use mocks instead of real system
  As a developer
  I want to verify that M1-M6 E2E verification suites exercise at least one
  real (non-mocked) CLI code path via subprocess invocation
  So that integration failures in DI wiring, database, and process-level
  behavior are detectable by the E2E test suites

  The root cause is that all 21 CLI-facing tests in the M1-M6 E2E helper
  files use ``unittest.mock.patch`` to replace service factories with
  ``MagicMock`` objects and invoke the CLI via Typer's in-process
  ``CliRunner`` instead of ``subprocess.run``.  This means:

  - DI wiring bugs (e.g. the ``container.db()`` AttributeError in #554,
    #570) are invisible to the E2E suites.
  - Database schema/migration issues are invisible.
  - Process-level behavior (exit codes, environment variables, Rich
    console routing) is never tested.

  The 35 remaining tests are pure domain/service-level tests that never
  invoke the CLI at all — they are legitimate unit/integration tests but
  should not be labeled "E2E verification."

  Background:
    Given the M1-M6 E2E verification helper files exist for e2e-mock-audit

  Scenario: At least one CLI-facing E2E test invokes the real CLI via subprocess
    When I analyze mock and subprocess usage in M1-M6 helpers for e2e-mock-audit
    Then at least one CLI-facing test should use subprocess instead of CliRunner for e2e-mock-audit

  Scenario: At least one CLI-facing E2E test exercises the real service layer
    When I analyze mock and subprocess usage in M1-M6 helpers for e2e-mock-audit
    Then at least one CLI-facing test should not mock the service factory for e2e-mock-audit

  Scenario: No E2E suite has 100% mocked CLI tests
    When I analyze mock and subprocess usage per suite for e2e-mock-audit
    Then every suite with CLI tests should have at least one unmocked test for e2e-mock-audit
