Feature: Coverage boost for files with 1-5 missing lines
  As a developer
  I want to cover the remaining 1-5 missing lines in small files
  So that overall code coverage meets the 97% threshold

  # =============================================================================
  # bootstrap.py - Line 26: double-check inside lock when already bootstrapped
  # =============================================================================

  Scenario: ensure_cli_database_bootstrapped skips inside lock when already bootstrapped
    Given the CLI database is already bootstrapped
    When I call ensure_cli_database_bootstrapped without force
    Then no migration runner should be created

  # =============================================================================
  # tool/builtins/adapter.py - Lines 106, 111: register method with None registry
  # =============================================================================

  Scenario: BuiltinAdapter register raises ValueError for None registry
    When I call BuiltinAdapter register with None registry
    Then a ValueError should be raised for adapter register

  # =============================================================================
  # tui/search/fuzzy.py - Lines 21, 28: score_match edge cases
  # =============================================================================

  Scenario: score_match returns empty candidate for empty query
    When I score a match with empty query against "hello"
    Then the fuzzy candidate score should be 0.0
    And the fuzzy candidate reason should be "empty"

  Scenario: score_match returns path-component match
    When I score a match with "src/utils" against "src/main/utils.py"
    Then the fuzzy candidate score should be 0.8
    And the fuzzy candidate reason should be "path-component"

  # =============================================================================
  # phase_gating.py - Lines 29, 76: TYPE_CHECKING import and PlanPhase enum passthrough
  # =============================================================================

  Scenario: resolve_plan_phase returns PlanPhase enum directly
    Given a PlanPhase EXECUTE enum value
    When I call resolve_plan_phase with the enum
    Then the resolved phase should be EXECUTE

  # =============================================================================
  # lsp/registry.py - Lines 61, 83, 151: get, remove, list_servers edge cases
  # =============================================================================

  Scenario: LspRegistry get returns None for unknown server
    Given a fresh empty LspRegistry for coverage
    When I coverage get LSP server "nonexistent"
    Then the coverage LSP server result should be None

  Scenario: LspRegistry remove returns False for unknown server
    Given a fresh empty LspRegistry for coverage
    When I coverage remove LSP server "nonexistent"
    Then the coverage LSP remove result should be False

  Scenario: LspRegistry list_servers returns empty list when empty
    Given a fresh empty LspRegistry for coverage
    When I coverage list all LSP servers
    Then the coverage LSP servers list should be empty

  # =============================================================================
  # application/services/skill_registry_service.py - Lines 144, 192, 202
  # =============================================================================

  Scenario: SkillRegistryService get_skill returns None for unknown skill
    Given a fresh SkillRegistryService with no skills
    When I coverage get skill "nonexistent"
    Then the coverage skill result should be None

  # =============================================================================
  # a2a/errors.py - Lines 144, 155, 157, 159: map_domain_error edge cases
  # =============================================================================

  Scenario: map_domain_error raises TypeError for non-Exception
    When I call map_domain_error with a non-Exception
    Then a TypeError should be raised for map_domain_error

  Scenario: map_domain_error maps AuthenticationError
    When I call map_domain_error with AuthenticationError
    Then the map_domain error code should be -32002

  Scenario: map_domain_error maps AuthorizationError
    When I call map_domain_error with AuthorizationError
    Then the map_domain error code should be -32003

  Scenario: map_domain_error maps ConfigurationError
    When I call map_domain_error with ConfigurationError
    Then the map_domain error code should be -32009

  # =============================================================================
  # application/services/uko_inference.py - Lines 131, 132, 133, 135
  # =============================================================================

  Scenario: uko inference with empty context returns empty result
    When I infer UKO with empty context
    Then the inference result should be empty

  # =============================================================================
  # core/async_cleanup.py - Lines 122, 123, 124, 125
  # =============================================================================

  Scenario: async cleanup handles exception during close
    When I close async resources with a failing resource
    Then the close should complete without raising

  # =============================================================================
  # application/services/strategy_resolution.py - Lines 17, 30, 34, 43
  # =============================================================================

  Scenario: resolve_strategy returns None when no strategies available
    When I resolve strategy with no arguments
    Then the strategy result should be None

  # =============================================================================
  # infrastructure/sandbox/_fs_utils.py - Lines 69, 70, 94, 95, 96
  # =============================================================================

  Scenario: safe_restore raises for invalid path outside sandbox
    When I check if "/etc/passwd" is safe in "/tmp/sandbox"
    Then the safe path result should be an error

  # =============================================================================
  # resource/handlers/discovery.py - Lines 76, 77, 80, 81, 159
  # =============================================================================

  Scenario: discover_resources in empty directory returns empty list
    When I discover resources in an empty directory
    Then the discovery result should be empty

  # =============================================================================
  # infrastructure/sandbox/strategy_adapter.py - Lines 165, 166, 174, 175, 252
  # =============================================================================

  Scenario: BuiltInSandboxStrategyAdapter cleanup unknown ref is a no-op
    Given a BuiltInSandboxStrategyAdapter with no strategies
    When I cleanup an unknown sandbox ref
    Then no exception should be raised for coverage

  # =============================================================================
  # infrastructure/sandbox/merge.py - Lines 73, 131, 132, 134, 136
  # =============================================================================

  Scenario: merge_changes with no changes returns empty
    When I merge changes with empty list
    Then the merge result should indicate success with empty content

  # =============================================================================
  # application/services/fusion_engine.py - Lines 147, 152, 157, 162, 167
  # =============================================================================

  Scenario: FusionEngine fuse with no inputs returns empty
    When I fuse with no inputs
    Then the fusion result should be empty

  # =============================================================================
  # application/services/subplan_merge_service.py - Lines 197, 198, 199, 200, 201
  # =============================================================================

  Scenario: SubplanMergeService merge with no subplans raises ValueError
    When I merge subplans with empty list
    Then a ValueError should be raised for empty subplans

  # =============================================================================
  # infrastructure/database/unit_of_work.py - Lines 31, 304, 305, 306, 308
  # =============================================================================

  Scenario: UnitOfWork transaction with no changes succeeds
    Given a UnitOfWork with no pending changes
    When I run a transaction on the UnitOfWork
    Then the transaction should succeed without error
