Feature: Services Full Coverage
  As a developer
  I want to test all service methods
  So that service layer has complete coverage

  # Context Service Tests
  Scenario: Context service adds file successfully
    Given a context service instance
    When I add a file path to context
    Then the file should be tracked in context

  Scenario: Context service adds directory recursively
    Given a context service instance
    When I add a directory recursively to context
    Then all files in directory should be tracked

  Scenario: Context service removes file from context
    Given a context service instance with files
    When I remove a file from context
    Then the file should not be in context

  Scenario: Context service clears all context
    Given a context service instance with files
    When I clear the service context
    Then the services context should be empty

  Scenario: Context service lists all files
    Given a context service instance with files
    When I list the context files
    Then I should get all tracked files

  Scenario: Context service handles missing file
    Given a context service instance
    When I add a non-existent file to context
    Then it should handle the error gracefully

  Scenario: Context service loads context from disk
    Given a context service instance
    And saved context on disk
    When I load the context
    Then the context should be restored

  Scenario: Context service saves context to disk
    Given a context service instance with files
    When I save the context
    Then the context should be persisted

  # Plan Service Tests
  Scenario: Plan service creates new plan
    Given a plan service instance
    When I create a new plan with instruction
    Then a new service plan should be created

  Scenario: Plan service builds plan
    Given a plan service instance with a plan
    When I build the service plan
    Then the plan should be built

  Scenario: Plan service applies plan
    Given a plan service instance with a built plan
    When I apply the plan
    Then the service changes should be applied

  Scenario: Plan service lists all plans
    Given a plan service instance with multiple plans
    When I list all service plans
    Then I should get all plans

  Scenario: Plan service gets plan by id
    Given a plan service instance with a plan
    When I get the plan by id
    Then I should receive the plan details

  Scenario: Plan service deletes plan
    Given a plan service instance with a plan
    When I delete the plan
    Then the plan should be removed

  Scenario: Plan service updates plan status
    Given a plan service instance with a plan
    When I update the plan status
    Then the status should be changed

  Scenario: Plan service reverts plan
    Given a plan service instance with an applied plan
    When I revert the plan
    Then the changes should be reverted

  # Project Service Tests
  Scenario: Project service initializes project
    Given a project service instance
    When I initialize a new project
    Then the project should be created

  Scenario: Project service gets project status
    Given a project service instance with a project
    When I get the project status
    Then I should receive project information

  Scenario: Project service detects existing project
    Given a project service instance with a project
    When I check if project exists
    Then it should detect the existing project

  Scenario: Project service forces reinitialization
    Given a project service instance with a project
    When I reinitialize with force
    Then the project should be recreated

  Scenario: Project service creates default ignore file
    Given a project service instance
    When I initialize a project with default ignore file
    Then the default ignore file should be created

  Scenario: Project service reports stats with no plans
    Given a project service instance
    When I request stats for a project without plans
    Then the stats should show zero project activity

  Scenario: Project service updates file filters
    Given a project service instance with a project
    When I update project file filters with changes
    Then the project filters should be updated and deduplicated

  Scenario: Project service handles missing project on filter update
    Given a project service instance
    When I update filters for a missing project
    Then a project not found error should be raised

  Scenario: Project service skips deleting projects without ids
    Given a project service instance
    When I delete a project without an id
    Then deleting the project should be a no-op

  # Application Container Tests
  Scenario: Application container provides services
    Given an application container
    When I request each service
    Then all services should be available

  Scenario: Application container is singleton
    Given an application container
    When I get the container multiple times
    Then it should return the same instance
