Feature: Devcontainer discovery handler - uncovered code paths
  As a developer maintaining CleverAgents
  I want full test coverage for the devcontainer discovery module
  So that edge cases and error paths are exercised

  Background:
    Given the devcontainer discovery module is imported

  # ── DevcontainerDiscoveryResult validation (lines 57-58) ───

  Scenario: Reject non-Path config_path in DevcontainerDiscoveryResult
    When I create a DevcontainerDiscoveryResult with a string config_path
    Then a discovery TypeError should be raised with message containing "config_path must be a Path"

  # ── DevcontainerDiscoveryResult validation (lines 61-62) ───

  Scenario: Reject non-dict config_data in DevcontainerDiscoveryResult
    When I create a DevcontainerDiscoveryResult with a list config_data
    Then a discovery TypeError should be raised with message containing "config_data must be a dict"

  # ── discover_devcontainers empty resource_location (line 94) ───

  Scenario: Raise ValueError for empty resource_location
    When I call discover_devcontainers with an empty resource_location
    Then a discovery ValueError should be raised with message containing "resource_location must not be empty"

  # ── discover_devcontainers empty resource_type (line 96) ────

  Scenario: Raise ValueError for empty resource_type
    When I call discover_devcontainers with an empty resource_type
    Then a discovery ValueError should be raised with message containing "resource_type must not be empty"

  # ── discover_devcontainers non-directory location (lines 103-107) ──

  Scenario: Return empty list when resource location is not a directory
    Given a temporary file that is not a directory
    When I call discover_devcontainers with that file path as location and type "git-checkout"
    Then the discovery result list should be empty

  # ── is_trigger_type empty resource_type (line 140) ──────────

  Scenario: Raise ValueError for empty resource_type in is_trigger_type
    When I call is_trigger_type with an empty string
    Then a discovery ValueError should be raised with message containing "resource_type must not be empty"

  # ── _load_devcontainer_json OSError handling (lines 155-157) ──

  Scenario: Return empty results when devcontainer.json is unreadable
    Given a temporary directory with an unreadable devcontainer.json
    When I call discover_devcontainers on that directory as "git-checkout"
    Then the discovery result list should be empty
