@session
@tdd_issue @tdd_issue_3046 @tdd_expected_fail @tdd_issue_4178
Feature: Session list summary consistency between JSON and rich table output
  As a developer
  I want the session list summary values to be consistent between JSON and rich table output
  So that the deduplicated summary logic in _session_list_dict is the single source of truth

  Background:
    Given a session-list-summary mock service with two sessions

  Scenario: JSON output summary matches rich table summary for total count
    When I invoke session list with JSON format
    And I invoke session list with rich format
    Then the JSON summary total should match the rich table total

  Scenario: JSON output summary matches rich table summary for total messages
    When I invoke session list with JSON format
    And I invoke session list with rich format
    Then the JSON summary total_messages should match the rich table total messages

  Scenario: JSON output summary matches rich table summary for most recent session
    When I invoke session list with JSON format
    And I invoke session list with rich format
    Then the JSON summary most_recent should appear in the rich table summary panel

  Scenario: JSON output summary matches rich table summary for oldest session
    When I invoke session list with JSON format
    And I invoke session list with rich format
    Then the JSON summary oldest should appear in the rich table summary panel

  Scenario: JSON output summary contains all required fields
    When I invoke session list with JSON format
    Then the JSON output has a summary key with total
    And the JSON output has a summary key with most_recent
    And the JSON output has a summary key with oldest
    And the JSON output has a summary key with total_messages
    And the JSON output has a summary key with storage
