@phase1 @database @models @uncovered_branches
Feature: Database models uncovered branch coverage
  As a developer
  I want to exercise uncovered branches in database model from_domain methods
  So that branch and line coverage improves for models.py

  # -------------------------------------------------------------------
  # LifecyclePlanModel.from_domain: empty arguments (L948 loop zero iterations)
  # -------------------------------------------------------------------

  @plan @from_domain @empty_arguments
  Scenario: PlanModel from_domain with empty arguments produces no argument rows
    Given db models branch a Plan domain object with empty arguments
    When db models branch the plan is converted via LifecyclePlanModel from_domain
    Then db models branch the resulting plan model has no argument rows

  # -------------------------------------------------------------------
  # ToolModel.from_domain: dict-based tool (L1665-1666 dict branch of _get)
  # -------------------------------------------------------------------

  @tool @from_domain @dict_tool
  Scenario: ToolModel from_domain accepts a plain dict and reads fields via dict.get
    Given db models branch a plain dict describing a tool
    When db models branch the dict is converted via ToolModel from_domain
    Then db models branch the resulting tool model has the expected name and description

  @tool @from_domain @dict_tool_bindings
  Scenario: ToolModel from_domain with dict tool and resource bindings
    Given db models branch a plain dict describing a tool with resource bindings
    When db models branch the binding dict is converted via ToolModel from_domain
    Then db models branch the resulting tool model has resource binding rows

  # -------------------------------------------------------------------
  # SessionModel.from_domain: non-empty messages (L1920-1921)
  # -------------------------------------------------------------------

  @session @from_domain @messages
  Scenario: SessionModel from_domain populates child message models
    Given db models branch a Session domain object with two messages
    When db models branch the session is converted via SessionModel from_domain
    Then db models branch the resulting session model has two message children

  # -------------------------------------------------------------------
  # SkillModel class columns: short_name, description (L2131-2132)
  # -------------------------------------------------------------------

  @skill @from_domain @columns
  Scenario: SkillModel from_domain populates short_name and description columns
    Given db models branch a Skill domain dict with name and description
    When db models branch the skill dict is converted via SkillModel from_domain
    Then db models branch the resulting skill model has correct short_name and description
